[IMP] purchase: when product qty is change in confirmed PO display log note

This commit is contained in:
Vandan Shah
2017-09-27 13:20:00 +02:00
committed by amoyaux
parent 513c1474a3
commit 41a3c884c0
3 changed files with 24 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@
'views/stock_views.xml',
'views/res_config_settings_views.xml',
'views/res_partner_views.xml',
'views/purchase_template.xml',
'report/purchase_report_views.xml',
'data/mail_template_data.xml',
'views/portal_templates.xml',
+6
View File
@@ -580,6 +580,12 @@ class PurchaseOrderLine(models.Model):
@api.multi
def write(self, values):
if 'product_qty' in values:
for line in self:
if line.order_id.state == 'purchase':
line.order_id.message_post_with_view('purchase.track_po_line_template',
values={'line': line, 'product_qty': values['product_qty']},
subtype_id=self.env.ref('mail.mt_note').id)
result = super(PurchaseOrderLine, self).write(values)
# Update expected date of corresponding moves
if 'date_planned' in values:
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="track_po_line_template">
<div>
<strong>The ordered quantity has been updated.</strong>
<ul>
<li><t t-esc="line.order_id.product_id.display_name"/>:</li>
Ordered Quantity: <t t-esc="line.product_qty" /> -&gt; <t t-esc="float(product_qty)"/><br/>
<t t-if='line.order_id.product_id.type in ("consu", "product")'>
Received Quantity: <t t-esc="line.qty_received" /><br/>
</t>
Billed Quantity: <t t-esc="line.qty_invoiced"/>
</ul>
</div>
</template>
</odoo>