Skip to content

[16.0][IMP] l10n_es_sigaus_sale: call sigaus from sale line creation #4108

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

Merged
merged 2 commits into from
Apr 11, 2025

Conversation

Tisho99
Copy link
Contributor

@Tisho99 Tisho99 commented Apr 2, 2025

There are situations when lines are created directly from the sale order line create method, and the sigaux is not updated because the create or write methods of the sale order are not called.

This PR covers those cases

Related with OCA/sale-workflow#3658

I-7204

@Tisho99
Copy link
Contributor Author

Tisho99 commented Apr 2, 2025

@Tisho99 Tisho99 force-pushed the 16.0-imp-l10n_es_sigaus_sale branch from bb1274d to 6146074 Compare April 2, 2025 13:36
@ValentinVinagre
Copy link
Contributor

@Tisho99 revisa los tests antes de los pings please.

@Tisho99 Tisho99 force-pushed the 16.0-imp-l10n_es_sigaus_sale branch 3 times, most recently from 0417bf8 to 03f4529 Compare April 7, 2025 07:41
Copy link

@Jaimermaccione Jaimermaccione left a comment

Choose a reason for hiding this comment

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

@Tisho99 LGTM! Tested on local enviroment.

@Tisho99 Tisho99 force-pushed the 16.0-imp-l10n_es_sigaus_sale branch 2 times, most recently from 78929e7 to 4e6a9d4 Compare April 8, 2025 10:25
@Tisho99 Tisho99 force-pushed the 16.0-imp-l10n_es_sigaus_sale branch from 4e6a9d4 to 85c5455 Compare April 8, 2025 11:16
Copy link
Contributor

@manuelregidor manuelregidor left a comment

Choose a reason for hiding this comment

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

Technical review. LGTM

lines = super().create(vals_list)
if not self.env.context.get("avoid_line_recursion"):
sales = self.env["sale.order"]
for line in lines.filtered(lambda li: li.product_id.sigaus_has_amount):
Copy link
Contributor

Choose a reason for hiding this comment

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

sales = lines.filtered(lambda li: li.product_id.sigaus_has_amount).mapped('order_id')

Copy link
Contributor

@ValentinVinagre ValentinVinagre left a comment

Choose a reason for hiding this comment

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

some comments

sales += line.order_id
for sale in sales:
sale.automatic_sigaus_exception()
sale.apply_sigaus()
Copy link
Contributor

Choose a reason for hiding this comment

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

apply_sigaus is multi.

for line in lines.filtered(lambda li: li.product_id.sigaus_has_amount):
sales += line.order_id
for sale in sales:
sale.automatic_sigaus_exception()
Copy link
Contributor

Choose a reason for hiding this comment

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

This function could be implemented in multiple ways, not just api.one. Can you review it?
The call can be made much better if the change is made.

Copy link
Contributor Author

@Tisho99 Tisho99 Apr 8, 2025

Choose a reason for hiding this comment

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

I can, i'll do the improvement tomorrow

Copy link
Contributor

Choose a reason for hiding this comment

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

you will have to check which other sites are affected.

@Tisho99 Tisho99 force-pushed the 16.0-imp-l10n_es_sigaus_sale branch from 85c5455 to fc302d1 Compare April 10, 2025 11:10
Copy link
Contributor

@manuelregidor manuelregidor left a comment

Choose a reason for hiding this comment

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

LGTM

@OCA-git-bot
Copy link
Contributor

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

@ValentinVinagre
Copy link
Contributor

@HaraldPanten could you do a review?

Copy link
Contributor

@HaraldPanten HaraldPanten left a comment

Choose a reason for hiding this comment

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

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-4108-by-HaraldPanten-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 1023b7d into OCA:16.0 Apr 11, 2025
5 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 207d857. Thanks a lot for contributing to OCA. ❤️

@HaraldPanten HaraldPanten deleted the 16.0-imp-l10n_es_sigaus_sale branch April 11, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants