[IMP] Improve code for message on chatter RFQ created on PO created.

bzr revid: bth@tinyerp.com-20130218054017-s5kdnnhizlg8x7j5
This commit is contained in:
Bhumi Thakkar (Open ERP) 2013-02-18 11:10:17 +05:30
parent 13b819939a
commit bdae636bca
2 changed files with 7 additions and 1 deletions

View File

@ -248,7 +248,9 @@ 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 '/'
context = dict(context, 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)
return order
def unlink(self, cr, uid, ids, context=None):
@ -789,8 +791,10 @@ 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
context = dict(context, 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)
orders_info.update({neworder_id: old_ids})
allorders.append(neworder_id)

View File

@ -132,6 +132,7 @@ 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
context = dict(context, mail_create_nolog=True)
purchase_id = purchase_order.create(cr, uid, {
'origin': requisition.name,
'partner_id': supplier.id,
@ -143,6 +144,7 @@ class purchase_requisition(osv.osv):
'notes':requisition.description,
'warehouse_id':requisition.warehouse_id.id ,
})
purchase_order.message_post(cr, uid, [purchase_id], body=_("RFQ <b>Created</b>"), context=context)
res[requisition.id] = purchase_id
for line in requisition.line_ids:
product = line.product_id