Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] sale_coupon_order_line_link: Migration to version 16.0 #151

Conversation

pilarvargas-tecnativa
Copy link
Contributor

@pilarvargas-tecnativa pilarvargas-tecnativa commented Sep 18, 2023

cc @Tecnativa TT44349

TODO: Renamed to sale_loyalty_order_line_link and script for migration

Please @chienandalu can you check it? If it is correct I rename it

OCA-git-bot and others added 30 commits October 3, 2022 22:04
Signed-off-by pedrobaeza
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-promotion-13.0/sale-promotion-13.0-website_sale_coupon_page
Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-13-0/sale-promotion-13-0-website_sale_coupon_page/
This way, you can put richer text with multi-lines as description.

TT33564
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-promotion-15.0/sale-promotion-15.0-website_sale_coupon_page
Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-website_sale_coupon_page/
Signed-off-by pedrobaeza
ilyasProgrammer and others added 14 commits September 15, 2023 11:23
Currently translated at 100.0% (15 of 15 strings)

Translation: sale-promotion-14.0/sale-promotion-14.0-sale_coupon_order_line_link
Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-14-0/sale-promotion-14-0-sale_coupon_order_line_link/it/
If a third module adds an extra discount scope, we should:

- Allow integration returning always at least an empty object
- Allow compatibility by inheritance hooking into the method that
defines the scoped lines.

TT36131
In some cases the `recompute_coupon_lines` method could lead to miss the
previously created links. We want to ensure those links at the end of
such method.

TT40205
Currently translated at 100.0% (15 of 15 strings)

Translation: sale-promotion-15.0/sale-promotion-15.0-sale_coupon_order_line_link
Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_order_line_link/it/
Currently translated at 100.0% (15 of 15 strings)

Translation: sale-promotion-15.0/sale-promotion-15.0-sale_coupon_order_line_link
Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_order_line_link/it/
Currently translated at 100.0% (15 of 15 strings)

Translation: sale-promotion-15.0/sale-promotion-15.0-sale_coupon_order_line_link
Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_order_line_link/it/
Currently translated at 100.0% (15 of 15 strings)

Translation: sale-promotion-15.0/sale-promotion-15.0-sale_coupon_order_line_link
Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_order_line_link/it/
@pilarvargas-tecnativa pilarvargas-tecnativa marked this pull request as draft September 18, 2023 21:57
@pilarvargas-tecnativa pilarvargas-tecnativa marked this pull request as ready for review September 19, 2023 14:52
Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the rename would be correct IMO.

Some remarks:

sale_coupon_order_line_link/models/sale_order.py Outdated Show resolved Hide resolved
sale_coupon_order_line_link/reports/sale_report.py Outdated Show resolved Hide resolved
<group name="promo_info" string="Promotions">
<field
<!-- <field
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This view needs to be revised because the fields have changed and may need to be added to the sale.order model to display them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fields no longer exist in the sale.order model nor have they been renamed, I would have to add them to the model to get the promotion/coupon applied and in the case that a coupon is generated also add a field to display those generated coupons. I don't know if this is necessary to complete the functionality of the module or if this would be a parallel functionality.

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the migration script

@pilarvargas-tecnativa pilarvargas-tecnativa force-pushed the 16.0-mig-sale_coupon_order_line_link branch 2 times, most recently from 2229958 to 4f462f9 Compare September 20, 2023 16:17
Comment on lines 6 to 10
def _fill_reward_id_field(env):
for line in env["sale.order.line"].filtered("loyalty_program_id"):
line.reward_id = env["reward.program"].search(
[["program_id", "=", line.loyalty_program_id.id]]
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better do this in pre and with sql for performance and to avoid to trigger ORM operations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubted whether such a field will already exist in pre

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably won't. You should try to pre-create the column:

        ALTER TABLE sale_order_line
        ADD COLUMN IF NOT EXISTS reward_id INTEGER;

@pilarvargas-tecnativa
Copy link
Contributor Author

Continued in #152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.