purchase-workflow icon indicating copy to clipboard operation
purchase-workflow copied to clipboard

[18.0][MIG] purchase_reception_status

Open astirpe opened this issue 11 months ago • 3 comments

From https://github.com/OCA/purchase-workflow/pull/2201

astirpe avatar Dec 30 '24 08:12 astirpe

@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.

bizzappdev avatar Apr 28 '25 08:04 bizzappdev

@astirpe Thanks for the migration, could you apply the quick fix and those unit tests.

TDu avatar May 01 '25 08:05 TDu

@bizzappdev Thank you!

astirpe avatar May 06 '25 08:05 astirpe

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). 🤖

OCA-git-bot avatar May 13 '25 08:05 OCA-git-bot

/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.

sebalix avatar May 13 '25 09:05 sebalix

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

AaronHForgeFlow avatar May 21 '25 08:05 AaronHForgeFlow

The change related to receipt_status is applied in our PR: https://github.com/astirpe/purchase-workflow/pull/2

bizzappdev avatar Jul 30 '25 08:07 bizzappdev

Thank you @bizzappdev

astirpe avatar Jul 30 '25 09:07 astirpe

Finally, it seems it it going to be a module split: https://github.com/OCA/purchase-workflow/pull/2781

AaronHForgeFlow avatar Sep 02 '25 13:09 AaronHForgeFlow

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!

JoanSForgeFlow avatar Sep 08 '25 08:09 JoanSForgeFlow