From 519bde9c6f5a869db2ceaa3939ead8a241e8f6be Mon Sep 17 00:00:00 2001 From: "P. Christeas" <> Date: Tue, 7 Sep 2010 13:19:46 +0530 Subject: [PATCH 1/1] [IMP] procurement:Improve translatable strings bzr revid: hmo@tinyerp.com-20100907074946-w40hs2lunoq7hayr --- addons/procurement/procurement.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 145395e..5c6caf1 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -135,7 +135,9 @@ class procurement_order(osv.osv): if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state'])) + raise osv.except_osv(_('Invalid action !'), + _('Cannot delete Procurement Order(s) which are in %s State!') % \ + s['state']) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def onchange_product_id(self, cr, uid, ids, product_id, context={}): @@ -297,7 +299,8 @@ class procurement_order(osv.osv): if procurement.product_id.product_tmpl_id.supply_method <> 'buy': return False if not procurement.product_id.seller_ids: - cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id)) + cr.execute('update procurement_order set message=%s where id=%s', + (_('No supplier defined for this product !'), procurement.id)) return False partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement. @@ -306,7 +309,8 @@ class procurement_order(osv.osv): return False address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery'] if not address_id: - cr.execute('update procurement_order set message=%s where id=%s', (_('No address defined for the supplier'), procurement.id)) + cr.execute('update procurement_order set message=%s where id=%s', + (_('No address defined for the supplier'), procurement.id)) return False return True @@ -326,7 +330,8 @@ class procurement_order(osv.osv): move_obj = self.pool.get('stock.move') for procurement in self.browse(cr, uid, ids): if procurement.product_qty <= 0.00: - raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity in Procurement Order(s), it should not be less than 1!')) + raise osv.except_osv(_('Data Insufficient !'), + _('Please check the Quantity in Procurement Order(s), it should not be less than 1!')) if procurement.product_id.type in ('product', 'consu'): if not procurement.move_id: source = procurement.location_id.id @@ -345,7 +350,7 @@ class procurement_order(osv.osv): }) move_obj.action_confirm(cr, uid, [id], context=context) self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1}) - message = _('Procurement ') + " '" + procurement.name + "' "+ _("is running.") + message = _("Procurement '%s' is running.") % procurement.name self.log(cr, uid, procurement.id, message) self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''}) return True @@ -354,7 +359,8 @@ class procurement_order(osv.osv): """ Changes procurement state to Running and writes message. @return: True """ - self.write(cr, uid, ids, {'state': 'running', 'message': _('from stock: products assigned.')}) + self.write(cr, uid, ids, {'state': 'running', + 'message': _('from stock: products assigned.')}) return True def _check_make_to_stock_service(self, cr, uid, procurement, context={}): @@ -376,11 +382,16 @@ class procurement_order(osv.osv): ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id]) cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,)) if not cr.fetchone()[0]: - cr.execute('update procurement_order set message=%s where id=%s', (_('Not enough stock and no minimum orderpoint rule defined.'), procurement.id)) - message = _('Procurement ') + " '" + procurement.name + "' "+ _("has an exception.") + _('Not enough stock and no minimum orderpoint rule defined.') + cr.execute('update procurement_order set message=%s where id=%s', + (_('Not enough stock and no minimum orderpoint rule defined.'), + procurement.id)) + message = _("Procurement '%s' has an exception." \ + "Not enough stock and no minimum orderpoint rule defined.") % \ + procurement.name self.log(cr, uid, procurement.id, message) if procurement.state=='exception' and procurement.message=='': - cr.execute('update procurement_order set message=%s where id=%s', (_('Not enough stock '), procurement.id)) + cr.execute('update procurement_order set message=%s where id=%s', + (_('Not enough stock '), procurement.id) ) return ok @@ -459,7 +470,7 @@ class procurement_order(osv.osv): if procurement.move_id: if procurement.close_move and (procurement.move_id.state <> 'done'): move_obj.action_done(cr, uid, [procurement.move_id.id]) - message = _('Procurement ') + " '" + procurement.name + "' "+ _("is done.") + message = _("Procurement '%s' is done.") % procurement.name self.log(cr, uid, procurement.id, message) res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')}) wf_service = netsvc.LocalService("workflow") @@ -530,7 +541,8 @@ class stock_warehouse_orderpoint(osv.osv): 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c) } _sql_constraints = [ - ('qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')), + ('qty_multiple_check', 'CHECK( qty_multiple > 0 )', + _('Qty Multiple must be greater than zero.')), ] def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}): -- 1.7.10.4