details: https://code.tryton.org/tryton/commit/6861e9cfe2ae
branch: default
user: Xavi Hermoso <[email protected]>
date: Tue Oct 28 11:45:10 2025 +0100
description:
Copy productions at once when splitting
closes #14325
diffstat:
modules/production_split/production.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (35 lines):
diff -r 65cfcdc70794 -r 6861e9cfe2ae modules/production_split/production.py
--- a/modules/production_split/production.py Sat Nov 29 14:59:43 2025 +0100
+++ b/modules/production_split/production.py Tue Oct 28 11:45:10 2025 +0100
@@ -36,6 +36,7 @@
Uom = pool.get('product.uom')
productions = [self]
+ n_productions = 0
remainder = Uom.compute_qty(self.unit, self.quantity, unit)
if remainder <= quantity:
return productions
@@ -47,16 +48,18 @@
count -= 1
while (remainder > quantity
and (count or count is None)):
- productions.extend(self.copy([self], {
+ n_productions += 1
+ remainder -= quantity
+ remainder = unit.round(remainder)
+ if count:
+ count -= 1
+ if n_productions:
+ productions.extend(self.copy([self] * n_productions, {
'quantity': quantity,
'unit': unit.id,
'inputs': None,
'outputs': None,
}))
- remainder -= quantity
- remainder = unit.round(remainder)
- if count:
- count -= 1
assert remainder >= 0
if remainder:
productions.extend(self.copy([self], {