[18.0][MIG] purchase_reception_status
From https://github.com/OCA/purchase-workflow/pull/2201
@astirpe We have prepared the Test Cases PR: https://github.com/astirpe/purchase-workflow/pull/1/ to increase the coverage, as there were no test cases for this module.
@astirpe Thanks for the migration, could you apply the quick fix and those unit tests.
@bizzappdev Thank you!
This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖
/ocabot migration purchase_reception_status
We need to merge first #2201 as this one is based on it. Once merged, 17.0 history should be refreshed there.
so the proposal would be to overwrite the odoo standard compute field like this?
receipt_status = fields.Selection([compute='_compute_good_receipt_status')
@api.depends(
"state", "force_received", "order_line.qty_received", "order_line.product_qty"
)
def _compute_good_receipt_status(self):
prec = self.env["decimal.precision"].precision_get("Product Unit of Measure")
for order in self:
status = "no"
if order.state in ("purchase", "done"):
if order.force_received:
status = "received"
elif all(
[
float_compare(
line.qty_received, line.product_qty, precision_digits=prec
)
>= 0
for line in order.order_line
]
):
status = "received"
elif any(
[
float_compare(line.qty_received, 0, precision_digits=prec) > 0
for line in order.order_line
]
):
status = "partial"
order.reception_status = status
I am ok with that, but a migration script is needed in v17
The change related to receipt_status is applied in our PR: https://github.com/astirpe/purchase-workflow/pull/2
Thank you @bizzappdev
Finally, it seems it it going to be a module split: https://github.com/OCA/purchase-workflow/pull/2781
Hi @astirpe,
Since the migration in 17.0 was not compatible with the new Odoo field, we applied a module split to make it compatible.
Here is the detailed proposal: https://github.com/OCA/purchase-workflow/pull/2201#issuecomment-3160414941
And here it’s already implemented for 17.0: https://github.com/OCA/purchase-workflow/pull/2781
Would you be open to adapting your migration to follow this approach?
Thanks a lot!