Steps to reproduce:
- Create + confirm a MO
- Add a byproduct with a Produced (qty) > 1
- Change the `qty_producing` to a non-zero qty
Expected result:
Byproduct's "Produced" qty stays unchanged and its "To Produce" is 0
Actual result:
Byproduct's "To Produce" defaults to 1 and its "Produced" qty is
updated to scale to the according to the amount `qty_producing` (i.e.
if `product_qty` = 2 and `qty_producing` = 1, then by-product's
"Produced" = .5
Additionally, a Missing Record error pops up because of missing
stock.move.line
Solution, don't allow byproducts added after MO is confirmed to default
to 0. Additionally allow byproducts to have 0 "To Produce" quantity and
don't sum the cost share of merged byproduct moves since when Produced
> To Produce then an extra move is created and the cost share ends up
being doubled during the merge.
closesodoo/odoo#85130
Task: 2716164
X-original-commit: 51ff14a56b909bdf22c9f1c4540347655578e1f4
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>