[IMP] purchase(_stock): track qty_received in chatter
Track the change of qty_received of POL in the chatter of PO. Task 2265912 PR #52809 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
@@ -920,6 +920,12 @@ class PurchaseOrderLine(models.Model):
|
||||
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)
|
||||
if 'qty_received' in values:
|
||||
for line in self:
|
||||
if values['qty_received'] != line.qty_received and line.order_id.state == 'purchase':
|
||||
line.order_id.message_post_with_view('purchase.track_po_line_qty_received_template',
|
||||
values={'line': line, 'qty_received': values['qty_received']},
|
||||
subtype_id=self.env.ref('mail.mt_note').id)
|
||||
return super(PurchaseOrderLine, self).write(values)
|
||||
|
||||
def unlink(self):
|
||||
|
||||
@@ -15,4 +15,14 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="track_po_line_qty_received_template">
|
||||
<div>
|
||||
<strong>The received quantity has been updated.</strong>
|
||||
<ul>
|
||||
<li><t t-esc="line.product_id.display_name"/>:</li>
|
||||
Received Quantity: <t t-esc="line.qty_received" /> -> <t t-esc="float(qty_received)"/><br/>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -333,7 +333,7 @@ class PurchaseOrderLine(models.Model):
|
||||
total -= move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
|
||||
else:
|
||||
total += move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
|
||||
line.qty_received = total
|
||||
line.write({'qty_received': total})
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
|
||||
Reference in New Issue
Block a user