Not check lot when update fifo_quantity and move is done, has not lot and now the lot is required in the product
Scenario modules activated:
- production
- product_cost_fifo
Scenario:
- create a product. Cost method: fifo
- create an inventory and done (a move was created and has not lot).
- Edit the product and now the lot is required
- Create a production and run.
When try to run a production and do production moves, call update_fifo_out_product_cost_price method (Update the product cost price of the given product on the move. Update fifo_quantity on the concerned incomming moves).
But the moves that you want to update fifo, can not save "fifo_quantity" data, because move is done and has not lot: raise the lot is required.
Example data:
> /home/raimon/projectes/nandev2/161970/trytond/trytond/modules/stock/move.py(701)do()
-> cls.save(to_save)
(Pdb) for move in to_save: move.id, move._save_values
(475769, {'fifo_quantity': 215.0})
(491968, {'fifo_quantity': 145.0})
(547333, {'state': 'done', 'product_cost_price': Decimal('1.65118'), 'effective_date': datetime.date(2023, 9, 4), 'cost_price': Decimal('1.66547')})
(529132, {'fifo_quantity': 2.0})
(547332, {'state': 'done', 'product_cost_price': Decimal('0.43190'), 'effective_date': datetime.date(2023, 9, 4), 'cost_price': Decimal('0.38403')})
Move ID 529132 was created when product has not lot required.
When try to write stock move, call validate() and check_lot() methods, and raise ValidationError. The reason is the new configuration of the product, lot is required.
id | create_date | state | effective_date | production_input | internal_quantity | lot | product
--------+----------------------------+----------+----------------+------------------+-------------------+-------+---------
529132 | 2023-08-08 13:35:03.013881 | done | 2023-08-03 | | 1355 | | 13874
547332 | 2023-08-30 07:46:04.735328 | assigned | | 46858 | 2 | 10843 | 13874
547333 | 2023-08-30 07:46:04.735328 | assigned | | 46858 | 245 | 24872 | 67581