From 8da5bec19ee2362141cbe4fb8b89779f56d6f77a Mon Sep 17 00:00:00 2001 From: "pso (OpenERP)" Date: Tue, 17 Jul 2012 17:00:57 +0530 Subject: [PATCH] [IMP] Improved warning messages/exceptions for purchase modules bzr revid: pso@tinyerp.com-20120717113057-gv6lxsnzpjzkbtdn --- addons/purchase/i18n/purchase.pot | 12 +++++------- addons/purchase/purchase.py | 14 +++++++------- addons/purchase/wizard/purchase_line_invoice.py | 3 +-- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/addons/purchase/i18n/purchase.pot b/addons/purchase/i18n/purchase.pot index c6fc09c6839..306c9501424 100644 --- a/addons/purchase/i18n/purchase.pot +++ b/addons/purchase/i18n/purchase.pot @@ -61,7 +61,7 @@ msgstr "" #. module: purchase #: code:addons/purchase/purchase.py:236 #, python-format -msgid "In order to delete a purchase order, it must be cancelled first.'))" +msgid "In order to delete a purchase order, You must cancel it first.'))" msgstr "" #. module: purchase @@ -634,14 +634,13 @@ msgstr "" #: code:addons/purchase/purchase.py:737 #, python-format msgid "" -"You have to select a partner in the purchase form !\n" -"Please set one partner before choosing a product." +"Select a partner in purchase order to choose a product." msgstr "" #. module: purchase #: code:addons/purchase/purchase.py:349 #, python-format -msgid "No purchase journal is defined for this company: \"%s\" (id:%d)" +msgid "Define purchase journal for this company: \"%s\" (id:%d)" msgstr "" #. module: purchase @@ -1745,7 +1744,7 @@ msgstr "" #: code:addons/purchase/purchase.py:359 #: code:addons/purchase/wizard/purchase_line_invoice.py:112 #, python-format -msgid "No expense account is defined for this company: \"%s\" (id:%d)" +msgid "Define expense account for this company: \"%s\" (id:%d)" msgstr "" #. module: purchase @@ -1762,8 +1761,7 @@ msgstr "" #: code:addons/purchase/purchase.py:735 #, python-format msgid "" -"Before choosing a product,\n select a price list for a supplier in the purchase form.'))\n" -"Please set one before choosing a product." +"Select a price list for a supplier in the purchase form to choose a product." msgstr "" #. module: purchase diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 9e771806c78..3259c4668c4 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -238,7 +238,7 @@ class purchase_order(osv.osv): if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: - raise osv.except_osv(_('Invalid action !'), _('In order to delete a purchase order, it must be cancelled first.')) + raise osv.except_osv(_('Invalid action !'), _('In order to delete a purchase order, You must cancel it first.')) # TODO: temporary fix in 5.0, to remove in 5.2 when subflows support # automatically sending subflow.delete upon deletion @@ -428,7 +428,7 @@ class purchase_order(osv.osv): journal_ids = journal_obj.search(cr, uid, [('type', '=','purchase'),('company_id', '=', order.company_id.id)], limit=1) if not journal_ids: raise osv.except_osv(_('Error !'), - _('No purchase journal is defined for this company: "%s" (id:%d)') % (order.company_id.name, order.company_id.id)) + _('Define purchase journal for this company: "%s" (id:%d)') % (order.company_id.name, order.company_id.id)) # generate invoice line correspond to PO line and link that to created invoice (inv_id) and PO line inv_lines = [] @@ -438,7 +438,7 @@ class purchase_order(osv.osv): if not acc_id: acc_id = po_line.product_id.categ_id.property_account_expense_categ.id if not acc_id: - raise osv.except_osv(_('Error !'), _('No expense account is defined for this company: "%s" (id:%d)') % (po_line.product_id.name, po_line.product_id.id,)) + raise osv.except_osv(_('Error !'), _('Define expense account for this company: "%s" (id:%d)') % (po_line.product_id.name, po_line.product_id.id,)) else: acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category').id fpos = order.fiscal_position or False @@ -496,14 +496,14 @@ class purchase_order(osv.osv): if pick.state not in ('draft','cancel'): raise osv.except_osv( _('Unable to cancel this purchase order.'), - _('First cancelled all receptions related to this purchase order.')) + _('First cancel all receptions related to this purchase order.')) for pick in purchase.picking_ids: wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr) for inv in purchase.invoice_ids: if inv and inv.state not in ('cancel','draft'): raise osv.except_osv( _('Unable to cancel this purchase order.'), - _('First cancelled all receptions related to this purchase order.')) + _('First cancel all receptions related to this purchase order.')) if inv: wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) self.write(cr,uid,ids,{'state':'cancel'}) @@ -886,9 +886,9 @@ class purchase_order_line(osv.osv): # - check for the presence of partner_id and pricelist_id if not pricelist_id: - raise osv.except_osv(_('No Pricelist !'), _('Before choosing a product,\n select a price list for a supplier in the purchase form.')) + raise osv.except_osv(_('No Pricelist !'), _('Select a price list for a supplier in the purchase form to choose a product.')) if not partner_id: - raise osv.except_osv(_('No Partner!'), _('Before choosing a product.\n select a partner in purchase order.')) + raise osv.except_osv(_('No Partner!'), _('Select a partner in purchase order to choose a product.')) # - determine name and notes based on product in partner lang. lang = res_partner.browse(cr, uid, partner_id).lang diff --git a/addons/purchase/wizard/purchase_line_invoice.py b/addons/purchase/wizard/purchase_line_invoice.py index d43f617265f..a8b99c4b207 100644 --- a/addons/purchase/wizard/purchase_line_invoice.py +++ b/addons/purchase/wizard/purchase_line_invoice.py @@ -107,8 +107,7 @@ class purchase_line_invoice(osv.osv_memory): a = line.product_id.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), - _('There is no expense account defined ' \ - 'for this product: "%s" (id:%d)') % \ + _('Define expense account for this product: "%s" (id:%d)') % \ (line.product_id.name, line.product_id.id,)) else: a = property_obj.get(cr, uid,