[IMP] Add context as a dictionary if it is none.

bzr revid: bth@tinyerp.com-20130218085340-qqnw8n27my6mji5m
This commit is contained in:
Bhumi Thakkar (Open ERP) 2013-02-18 14:23:40 +05:30
parent 88e8efcc12
commit c1951e6043
2 changed files with 7 additions and 1 deletions

View File

@ -248,6 +248,8 @@ class purchase_order(osv.osv):
def create(self, cr, uid, vals, context=None):
if vals.get('name','/')=='/':
vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'purchase.order') or '/'
if not context:
context = {}
context.update({ 'mail_create_nolog' : True })
order = super(purchase_order, self).create(cr, uid, vals, context=context)
self.message_post(cr, uid, [order], body=_("RFQ <b>Created</b>"), context=context)
@ -791,7 +793,9 @@ class purchase_order(osv.osv):
value.update(dict(key))
order_data['order_line'] = [(0, 0, value) for value in order_data['order_line'].itervalues()]
# create the new order
# create the new order
if not context:
context = {}
context.update({ 'mail_create_nolog' : True })
neworder_id = self.create(cr, uid, order_data)
self.message_post(cr, uid, [neworder_id], body=_("RFQ <b>Created</b>"), context=context)

View File

@ -132,6 +132,8 @@ class purchase_requisition(osv.osv):
if supplier.id in filter(lambda x: x, [rfq.state <> 'cancel' and rfq.partner_id.id or None for rfq in requisition.purchase_ids]):
raise osv.except_osv(_('Warning!'), _('You have already one %s purchase order for this partner, you must cancel this purchase order to create a new quotation.') % rfq.state)
location_id = requisition.warehouse_id.lot_input_id.id
if not context:
context = {}
context.update({ 'mail_create_nolog' : True })
purchase_id = purchase_order.create(cr, uid, {
'origin': requisition.name,