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={}):
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.
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
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
})
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
""" 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={}):
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
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")
'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={}):