delivery-carrier icon indicating copy to clipboard operation
delivery-carrier copied to clipboard

[16.0][IMP-FIX] delivery_auto_refresh - performance & compatibility & cleanup

Open jbaudoux opened this issue 10 months ago • 2 comments

In summary:

  • Cleanup code (use a single context variable to prevent re-execution, make dedicated methods for each purpose).
  • Increase performance (there was many recursive execution of the same delete/add line - code is now executed once and only what needs to be modified).
  • Make the module compatible with sale_order_carrier_auto_assign. ~~Move carrier assignment to that module so that this module concentrate on cost delivery line update (i.e. refresh as from its name). See https://github.com/OCA/sale-workflow/pull/3081~~ Marked as migration v17.0 improvement
  • Make module more robust. Implement SO line create/write

Depends on:

  • ~~https://github.com/OCA/sale-workflow/pull/3081~~

Settings: image

In details (one commit for each) - in reverse order:

  • config parameters moved to company. "sale_" prefix added to the parameters
  • add tests from https://github.com/OCA/delivery-carrier/pull/790 & https://github.com/OCA/delivery-carrier/pull/791
  • improve help & readme
  • refresh on SO line create/write
  • set carrier: ~~use https://github.com/OCA/sale-workflow/pull/3081~~ integrated here and marked to move on v17.0
  • refresh the minimum: Create or delete line only if necessary. Update existing line if necessary
  • iterate over list, not set
  • fix write & discount
  • Don't pass discount variable in context
  • fix create in batch (api.model_create_multi instead of api.model)
  • docstring: Don't modify standard method docstring

Compatibility checks/fixes with other modules triggering refresh on SO create/write:

  • [x] https://github.com/OCA/sale-workflow/tree/16.0/sale_product_packaging_container_deposit https://github.com/OCA/product-attribute/pull/1583
  • [x] https://github.com/OCA/sale-workflow/tree/16.0/sale_order_carrier_auto_assign Solved
  • [x] https://github.com/OCA/sale-promotion/pull/208 Looks good
  • [x] https://github.com/OCA/sale-workflow/tree/16.0/sale_product_multi_add https://github.com/OCA/sale-workflow/pull/3084

cc @pedrobaeza @santostelmo @yvaucher @simahawk @francesco-ooops @renda-dev

jbaudoux avatar Apr 17 '24 21:04 jbaudoux

Config parameters moved to company. sale_ prefix added to the parameters

jbaudoux avatar Apr 18 '24 13:04 jbaudoux

Ready for final review

jbaudoux avatar Apr 18 '24 14:04 jbaudoux

hi @pedrobaeza could you review this PR please ?

cyrilmanuel avatar Jun 13 '24 07:06 cyrilmanuel

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

OCA-git-bot avatar Jun 14 '24 15:06 OCA-git-bot

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

OCA-git-bot avatar Jun 14 '24 15:06 OCA-git-bot

Thanks again for your efforts.

@pedrobaeza Thanks for your time on this review :)

jbaudoux avatar Jun 14 '24 17:06 jbaudoux

This PR affects MT-5997 @moduon and https://github.com/OCA/delivery-carrier/pull/815 which is being reviewed by @yajo

@Gelojr @fcvalgar please deep functional review 😄 ❤️

rafaelbn avatar Jun 17 '24 11:06 rafaelbn

Hello @jbaudoux ,

We don't want to use sale_order_carrier_auto_assign module. It's mandatory?

We wouldn't be forced yo use it 😢

Let me know please! 😄

Thank you!

rafaelbn avatar Jun 17 '24 11:06 rafaelbn

Hello @jbaudoux ,

We don't want to use sale_order_carrier_auto_assign module. It's mandatory?

We wouldn't be forced yo use it 😢.

Let me know please! 😄

Thank you!

There is no new dependency in v16.

jbaudoux avatar Jun 17 '24 11:06 jbaudoux

OK, sorry. I miss some comments 🙏🏼 . Thank you! 😄

rafaelbn avatar Jun 17 '24 12:06 rafaelbn

It seems v16 settings layout broke:

image

yajo avatar Jun 17 '24 12:06 yajo

It seems v16 settings layout broke:

@jbaudoux

rousseldenis avatar Jul 17 '24 12:07 rousseldenis

@rousseldenis I'm not sure if it can help, but this is my attempt to fix the layout e6214da220132e6289d01741fd08d00229ee2efb

toita86 avatar Jul 17 '24 15:07 toita86