[IMP] purchase: when product qty is change in confirmed PO display log note
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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" /> -> <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>
|
||||
Reference in New Issue
Block a user