[IMP] nfu_sale_order_batch_packaging: add regeneration of batch products

This commit is contained in:
Niels Göttsch 2024-10-15 08:39:48 +02:00 committed by Niels Göttsch
parent 13efd90944
commit 676215ad9c
6 changed files with 9 additions and 5 deletions

View file

@ -36,6 +36,7 @@ Changelog
:0.0.1: Initial module.
:1.0.0: Add Multi Company ability
:1.0.1: rename product creation methode
Bug Tracker
===========

View file

@ -4,7 +4,7 @@
"author": "BAKEUP",
"website": "https://www.bakeup.org",
"category": "Sale",
"version": "16.0.1.0.0",
"version": "16.0.1.0.1",
"depends": ["sale", "product"],
"data": [
"data/ir_sequence_data.xml",

View file

@ -52,5 +52,5 @@ class SaleOrder(models.Model):
raise UserError(_(f"Sale Order not in State Draft or Sent: {', '.join(invalid_orders)}"))
res = super().write(vals)
if "batch_id" in vals:
self.order_line._update_batch_products()
self.order_line._update_batch_product()
return res

View file

@ -6,7 +6,7 @@ class SaleOrderLine(models.Model):
batch_id = fields.Many2one(related="order_id.batch_id")
def _update_batch_products(self):
def _update_batch_product(self):
for order_line in self:
batch_id = order_line.order_id.batch_id
if batch_id:
@ -19,5 +19,5 @@ class SaleOrderLine(models.Model):
@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
res._update_batch_products()
res._update_batch_product()
return res

View file

@ -1,2 +1,3 @@
:0.0.1: Initial module.
:1.0.0: Add Multi Company ability
:1.0.0: Add Multi Company ability
:1.0.1: rename product creation methode

View file

@ -396,6 +396,8 @@ anymore as log as they are part of a batch. Only Sale Orders in state Qutotation
</tr>
<tr class="field"><th class="field-name">1.0.0:</th><td class="field-body">Add Multi Company ability</td>
</tr>
<tr class="field"><th class="field-name">1.0.1:</th><td class="field-body">rename product creation methode</td>
</tr>
</tbody>
</table>
</div>