diff --git a/shopinvader_api_sale_loyalty/README.rst b/shopinvader_api_sale_loyalty/README.rst index ea76a69171..693569ca1d 100644 --- a/shopinvader_api_sale_loyalty/README.rst +++ b/shopinvader_api_sale_loyalty/README.rst @@ -7,7 +7,7 @@ Shopinvader API Sale Loyalty !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:ea4ed00a2cf38d60f1d6fdd88017d9839a45051ee4cf6d4daa218c3949c5cdea + !! source digest: sha256:391d35cc5245fa96f9a0c90cd3c22945079d773736d58e9e02c57b812964e4d0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -16,11 +16,17 @@ Shopinvader API Sale Loyalty .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github - :target: https://github.com/shopinvader/odoo-shopinvader/tree/16.0/shopinvader_api_sale_loyalty - :alt: shopinvader/odoo-shopinvader - -|badge1| |badge2| |badge3| +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fodoo--shopinvader-lightgray.png?logo=github + :target: https://github.com/OCA/odoo-shopinvader/tree/16.0/shopinvader_api_sale_loyalty + :alt: OCA/odoo-shopinvader +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/odoo-shopinvader-16-0/odoo-shopinvader-16-0-shopinvader_api_sale_loyalty + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/odoo-shopinvader&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| This module extends the functionality of Shopinvader to support Coupons and Promotions from `sale_loyalty` core module. @@ -51,13 +57,19 @@ But you must ensure that this prefix is added when using this router. See the README of `shopinvader_api_cart` for more details on how to do it. +Known issues / Roadmap +====================== + +Currently, sale.order:_update_programs_and_rewards() is called only when strictly needed (when no reward line exists), and of course only if not locked order. +It would be a good addition to add a new POST route in the module to explicitly call ``sale.order:_update_programs_and_rewards()`` + Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -83,6 +95,16 @@ Contributors Maintainers ~~~~~~~~~~~ -This module is part of the `shopinvader/odoo-shopinvader `_ project on GitHub. +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/odoo-shopinvader `_ project on GitHub. -You are welcome to contribute. +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/shopinvader_api_sale_loyalty/readme/ROADMAP.rst b/shopinvader_api_sale_loyalty/readme/ROADMAP.rst new file mode 100644 index 0000000000..04684f1e6c --- /dev/null +++ b/shopinvader_api_sale_loyalty/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +Currently, sale.order:_update_programs_and_rewards() is called only when strictly needed (when no reward line exists), and of course only if not locked order. +It would be a good addition to add a new POST route in the module to explicitly call ``sale.order:_update_programs_and_rewards()`` diff --git a/shopinvader_api_sale_loyalty/schemas/sale.py b/shopinvader_api_sale_loyalty/schemas/sale.py index 747b96b41c..87ce9a0bca 100644 --- a/shopinvader_api_sale_loyalty/schemas/sale.py +++ b/shopinvader_api_sale_loyalty/schemas/sale.py @@ -35,8 +35,11 @@ def from_sale_order(cls, odoo_rec): for card in odoo_rec.generated_coupon_ids ] # Get claimable rewards - odoo_rec._update_programs_and_rewards() claimable_rewards = odoo_rec._get_claimable_rewards() + if not odoo_rec.state == "done" and not claimable_rewards.items(): + odoo_rec._update_programs_and_rewards() + claimable_rewards = odoo_rec._get_claimable_rewards() + obj.claimable_rewards = [] for _, rewards in claimable_rewards.items(): obj.claimable_rewards += [ diff --git a/shopinvader_api_sale_loyalty/static/description/index.html b/shopinvader_api_sale_loyalty/static/description/index.html index e5383b76e2..d0a9a1c4bc 100644 --- a/shopinvader_api_sale_loyalty/static/description/index.html +++ b/shopinvader_api_sale_loyalty/static/description/index.html @@ -1,20 +1,20 @@ - + - + Shopinvader API Sale Loyalty