diff --git a/pos_partner_alternative_pricelist_load_background/README.rst b/pos_partner_alternative_pricelist_load_background/README.rst new file mode 100644 index 0000000000..f3e3c0f7b1 --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/README.rst @@ -0,0 +1,59 @@ +================================================= +POS Partner Alternative Pricelist Load Background +================================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |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-camptocamp%2Fpos-lightgray.png?logo=github + :target: https://github.com/camptocamp/pos/tree/16.0/pos_partner_alternative_pricelist_load_background + :alt: camptocamp/pos + +|badge1| |badge2| |badge3| + +When a customer is selected `pos_partner_pricelist_load_background` load pricelist defined in property_pricelist_id in background. +With this module, the price lists linked to the customer's price list are also loaded in the background. + + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Telmo Santos + +Maintainers +~~~~~~~~~~~ + +This module is part of the `camptocamp/pos `_ project on GitHub. + +You are welcome to contribute. diff --git a/pos_partner_alternative_pricelist_load_background/__init__.py b/pos_partner_alternative_pricelist_load_background/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_partner_alternative_pricelist_load_background/__manifest__.py b/pos_partner_alternative_pricelist_load_background/__manifest__.py new file mode 100644 index 0000000000..bd0e8e41e9 --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2024 Camptocamp (https://www.camptocamp.com). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "POS Partner Alternative Pricelist Load Background", + "summary": "Load partner alternative pricelist in background", + "version": "16.0.1.0.0", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "category": "Point of Sale", + "depends": [ + "pos_product_pricelist_alternative", + "pos_partner_pricelist_load_background", + ], + "installable": True, +} diff --git a/pos_partner_alternative_pricelist_load_background/models/__init__.py b/pos_partner_alternative_pricelist_load_background/models/__init__.py new file mode 100644 index 0000000000..f7116e3d45 --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/models/__init__.py @@ -0,0 +1 @@ +from . import pos_session diff --git a/pos_partner_alternative_pricelist_load_background/models/pos_session.py b/pos_partner_alternative_pricelist_load_background/models/pos_session.py new file mode 100644 index 0000000000..2f6b195ce6 --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/models/pos_session.py @@ -0,0 +1,24 @@ +# Copyright 2024 Camptocamp +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import models + + +class POSSession(models.Model): + _inherit = "pos.session" + + def get_pos_ui_partner_pricelist_background(self, pricelist_id, product_ids): + pricelists = super().get_pos_ui_partner_pricelist_background( + pricelist_id, product_ids + ) + # By design we do not calculate alternative prices on base pricelits + if self.env.context.get("base_pricelist"): + return pricelists + pricelist_rec = self.env["product.pricelist"].browse(pricelist_id) + alternative_pricelists = [] + for alt_pricelist_rec in pricelist_rec.alternative_pricelist_ids: + alternative_pricelists += self.get_pos_ui_partner_pricelist_background( + alt_pricelist_rec.id, product_ids + ) + if alternative_pricelists: + return pricelists + alternative_pricelists + return pricelists diff --git a/pos_partner_alternative_pricelist_load_background/readme/CONTRIBUTORS.rst b/pos_partner_alternative_pricelist_load_background/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..8ed3aebaca --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Telmo Santos diff --git a/pos_partner_alternative_pricelist_load_background/readme/DESCRIPTION.rst b/pos_partner_alternative_pricelist_load_background/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..f4b09bb0e7 --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +When a customer is selected `pos_partner_pricelist_load_background` load pricelist defined in property_pricelist_id in background. +With this module, the price lists linked to the customer's price list are also loaded in the background. + diff --git a/pos_partner_alternative_pricelist_load_background/static/description/index.html b/pos_partner_alternative_pricelist_load_background/static/description/index.html new file mode 100644 index 0000000000..eb3395c002 --- /dev/null +++ b/pos_partner_alternative_pricelist_load_background/static/description/index.html @@ -0,0 +1,415 @@ + + + + + + +POS Partner Alternative Pricelist Load Background + + + +
+

POS Partner Alternative Pricelist Load Background

+ + +

Beta License: AGPL-3 camptocamp/pos

+

When a customer is selected pos_partner_pricelist_load_background load pricelist defined in property_pricelist_id in background. +With this module, the price lists linked to the customer’s price list are also loaded in the background.

+

Table of contents

+ +
+

Bug Tracker

+

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 smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

Maintainers

+

This module is part of the camptocamp/pos project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/setup/pos_partner_alternative_pricelist_load_background/odoo/addons/pos_partner_alternative_pricelist_load_background b/setup/pos_partner_alternative_pricelist_load_background/odoo/addons/pos_partner_alternative_pricelist_load_background new file mode 120000 index 0000000000..3b0190d2c7 --- /dev/null +++ b/setup/pos_partner_alternative_pricelist_load_background/odoo/addons/pos_partner_alternative_pricelist_load_background @@ -0,0 +1 @@ +../../../../pos_partner_alternative_pricelist_load_background \ No newline at end of file diff --git a/setup/pos_partner_alternative_pricelist_load_background/setup.py b/setup/pos_partner_alternative_pricelist_load_background/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_partner_alternative_pricelist_load_background/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000000..5fb9935bf5 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +odoo-addon-pos_product_pricelist_alternative@ git+https://github.com/OCA/pos.git@refs/pull/1235/head#subdirectory=setup/pos_product_pricelist_alternative +odoo-addon-pos_partner_pricelist_load_background@ git+https://github.com/OCA/pos.git@refs/pull/1243/head#subdirectory=setup/pos_partner_pricelist_load_background