fix: Se actualiza a 6.8

This commit is contained in:
sinergia 2023-12-10 19:42:38 -05:00
parent 6c3052902d
commit 741d8f4ad3
2 changed files with 29 additions and 32 deletions

View File

@ -12,12 +12,14 @@ from trytond.exceptions import UserError
BOM_CHANGES = ['bom', 'product', 'quantity', 'uom', 'warehouse', 'location',
'company', 'inputs', 'outputs']
class Production(metaclass=PoolMeta):
"Production"
__name__ = 'production'
@fields.depends(*BOM_CHANGES)
@fields.depends(
'bom', 'product', 'uom', 'quantity', 'company', 'inputs', 'outputs',
methods=['_explode_move_values'])
def explode_bom(self):
pool = Pool()
Uom = pool.get('product.uom')
@ -29,32 +31,27 @@ class Production(metaclass=PoolMeta):
inputs = []
for input_ in self.bom.inputs:
if input_.product.producible:
for input_ in input_.product.template.boms.inputs:
# if input_.product.producible:
# for input_ in input_.product.template.boms.inputs:
quantity = input_.compute_quantity(factor)
move = self._explode_move_values(
self.picking_location, self.location, self.company,
input_, quantity)
if move:
inputs.append(move)
quantity = Uom.compute_qty(input_.uom, quantity,
input_.product.default_uom, round=False)
else:
quantity = input_.compute_quantity(factor)
move = self._explode_move_values(
self.picking_location, self.location, self.company,
input_, quantity)
move = self._explode_move_values('input', input_, quantity)
if move:
inputs.append(move)
quantity = Uom.compute_qty(input_.uom, quantity,
input_.product.default_uom, round=False)
# else:
# quantity = input_.compute_quantity(factor)
# move = self._explode_move_values('output', input_, quantity)
# if move:
# inputs.append(move)
# quantity = Uom.compute_qty(input_.uom, quantity,
# input_.product.default_uom, round=False)
self.inputs = inputs
outputs = []
for output in self.bom.outputs:
quantity = output.compute_quantity(factor)
move = self._explode_move_values(
self.location, self.output_location, self.company, output,
move = self._explode_move_values('output', output,
quantity)
if move:
move.unit_price = Decimal(0)