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][REF] pos_order_to_sale_order: create method optimization #1042

Merged

Conversation

GabbasovDinar
Copy link
Member

Optimized the process of sales order creation.

Before this changes:

Executing the create command creates an empty order, which can lead to unexpected effects if the create method has been extended by another module

After this changes:

The create method will return the order with the product lines included.

@OCA-git-bot
Copy link
Contributor

Hi @legalsylvain,
some modules you are maintaining are being modified, check this out!

@GabbasovDinar GabbasovDinar force-pushed the 16.0-pos_order_to_sale_order-refactoring branch from 5665631 to 2a79a4c Compare August 14, 2023 20:36
return {
"partner_id": order_data["partner_id"],
"origin": _("Point of Sale %s") % (session.name),
"client_order_ref": order_data["name"],
"user_id": order_data["user_id"],
"pricelist_id": order_data["pricelist_id"],
"fiscal_position_id": order_data["fiscal_position_id"],
"order_lines": order_lines,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"order_lines": order_lines,
"order_line": order_lines,

https://github.com/odoo/odoo/blob/16.0/addons/sale/models/sale_order.py#L208

Should fix the CI

Copy link
Member Author

Choose a reason for hiding this comment

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

@GabbasovDinar GabbasovDinar force-pushed the 16.0-pos_order_to_sale_order-refactoring branch from 2a79a4c to 0d75cb9 Compare August 15, 2023 08:51
Copy link
Member

@ivs-cetmix ivs-cetmix left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@Aldeigja Aldeigja left a comment

Choose a reason for hiding this comment

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

Functional, ok.

@legalsylvain
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-1042-by-legalsylvain-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7cc7bc6 into OCA:16.0 Aug 16, 2023
6 checks passed
@OCA-git-bot
Copy link
Contributor

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

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.

5 participants