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][FIX] pos_order_to_sale_order: rpc helper #1260

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

danielduqma
Copy link
Contributor

@danielduqma danielduqma commented Oct 30, 2024

rpc attribute used comes from LegacyComponent, that is deprecated and throws an error in some specific cases. Changing it by this.env.services works properly in all cases.

This can be reproduced executing this from other component:

const create_order = new CreateOrderPopup(props, this.env);
const {sale_order_id} = await create_order._createSaleOrder("draft");

FL-556-4346

@OCA-git-bot
Copy link
Contributor

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

@legalsylvain
Copy link
Contributor

Hi. Do you mean it should be changed in all modules ?

rgrep "this\.rpc" ./ --include=*.js
./pos_order_to_sale_order/static/src/js/CreateOrderPopup.js:            return await this.rpc({
./pos_product_label/static/src/PrintLabelPopup.esm.js:            const data = await this.rpc({
./pos_product_label/static/src/PrintLabelPopup.esm.js:        const response = await this.rpc({
./pos_partner_firstname/static/src/js/PartnerDetailsEdit.js:                this.rpc({
./pos_financial_risk/static/src/js/PaymentScreen.esm.js:            this.rpc({
./pos_order_to_sale_order_delivery/static/src/js/Popups/CreateOrderPopup.esm.js:    const response = await this.rpc({
./pos_partner_location_google_map/static/src/js/PartnerMapGoogleEdit.esm.js:            return this.rpc({
./pos_lot_barcode/static/src/js/Screens/ProductScreen.js:                    foundLotIds = await this.rpc({
./pos_order_to_sale_order_sale_financial_risk/static/src/js/CreateOrderPopup.esm.js:            const [partnerRiskValues] = await this.rpc({
./pos_loyalty_redeem_payment/static/src/js/PaymentScreen.esm.js:                const payload = await this.rpc({

rgrep "this\.env\.services\.rpc" ./ --include=*.js
./pos_lot_selection/static/src/js/models.js:                    return await this.env.services.rpc(
./pos_loyalty_redeem_payment/static/src/js/PaymentScreen.esm.js:            return await this.env.services.rpc({

@danielduqma
Copy link
Contributor Author

Thanks for reviewing! I'm not sure enough and I haven't tested globally, but as I analyzed:

  • CreateOrderPopup extends AbstractAwaitablePopup
  • AbstractAwaitablePopup extends PosComponent
  • PosComponent extends LegacyComponent

The last component is defined here, and it's just a wrapper over owl.Component that mainly adds rpc method for legacy. I think direct use of this rpc is deprecated in some way, and in fact LegacyComponent no longer exists in 17.0 and newer, where those calls are managed by orm service.

So, in our case the code in the main comment leads to an error, but I haven't found any other incompatibilities with the other modules.

Regards

@danielduqma danielduqma marked this pull request as ready for review November 6, 2024 14:33
@danielduqma danielduqma changed the title [FIX] pos_order_to_sale_order: rpc helper [16.0][FIX] pos_order_to_sale_order: rpc helper Nov 6, 2024
`rpc` attribute used comes from LegacyComponent, that is deprecated
and throws an error in some specific cases. Changing it by
`this.env.services` works properly in all cases.
@danielduqma danielduqma force-pushed the 16.0-fix-pos_order_to_sale_order branch from 166a634 to 6b84d97 Compare January 10, 2025 12:32
@danielduqma
Copy link
Contributor Author

Hi @OCA/pos-maintainers can this be merged please? Despite it is difficult to be checked (only in code), it doesn't break any behaviour. Thanks!

@legalsylvain
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-1260-by-legalsylvain-bump-patch, awaiting test results.

@OCA-git-bot
Copy link
Contributor

@legalsylvain The merge process could not be finalized, because command git push origin 16.0-ocabot-merge-pr-1260-by-legalsylvain-bump-patch:16.0 failed with output:

To https://github.com/OCA/pos
 ! [rejected]          16.0-ocabot-merge-pr-1260-by-legalsylvain-bump-patch -> 16.0 (fetch first)
error: failed to push some refs to 'https://github.com/OCA/pos'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

@OCA-git-bot OCA-git-bot merged commit 2a5ad46 into OCA:16.0 Jan 10, 2025
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 1f0a93d. 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.

3 participants