From 89be3c257a89fdbc7fcde51bda5926fdd127a495 Mon Sep 17 00:00:00 2001 From: hugues de keyzer Date: Fri, 13 Dec 2024 12:00:54 +0100 Subject: [PATCH] [IMP] set default partner in pos ui --- pos_default_partner/README.rst | 13 +++--- pos_default_partner/__manifest__.py | 5 +++ pos_default_partner/readme/CONTRIBUTORS.rst | 8 +++- pos_default_partner/readme/ROADMAP.rst | 1 - .../static/description/index.html | 44 +++++++------------ .../static/src/js/models.esm.js | 17 +++++++ 6 files changed, 51 insertions(+), 37 deletions(-) delete mode 100644 pos_default_partner/readme/ROADMAP.rst create mode 100644 pos_default_partner/static/src/js/models.esm.js diff --git a/pos_default_partner/README.rst b/pos_default_partner/README.rst index 84fd8ea98e..aa44244d7b 100644 --- a/pos_default_partner/README.rst +++ b/pos_default_partner/README.rst @@ -41,11 +41,6 @@ Configuration Go to Point of Sale's settings page and select a default customer for a specific PoS configuration. -Known issues / Roadmap -====================== - -Set the default customer also on the PoS UI. - Bug Tracker =========== @@ -70,10 +65,14 @@ Contributors * Akretion - * David Beal + * David Beal * Foram Shah * FactorLibre: - * Alvaro Rollan + + * Alvaro Rollan +* `Coop IT Easy SC `_: + + * hugues de keyzer Maintainers ~~~~~~~~~~~ diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index 999f1fc2ec..076fb2c8bb 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -13,4 +13,9 @@ "data": ["views/res_config_settings_view.xml"], "website": "https://github.com/OCA/pos", "installable": True, + "assets": { + "point_of_sale.assets": [ + "pos_default_partner/static/src/js/**/*.js", + ] + }, } diff --git a/pos_default_partner/readme/CONTRIBUTORS.rst b/pos_default_partner/readme/CONTRIBUTORS.rst index e06c81b6f0..e57f794eb3 100644 --- a/pos_default_partner/readme/CONTRIBUTORS.rst +++ b/pos_default_partner/readme/CONTRIBUTORS.rst @@ -1,6 +1,10 @@ * Akretion - * David Beal + * David Beal * Foram Shah * FactorLibre: - * Alvaro Rollan + + * Alvaro Rollan +* `Coop IT Easy SC `_: + + * hugues de keyzer diff --git a/pos_default_partner/readme/ROADMAP.rst b/pos_default_partner/readme/ROADMAP.rst deleted file mode 100644 index 44ddb1d969..0000000000 --- a/pos_default_partner/readme/ROADMAP.rst +++ /dev/null @@ -1 +0,0 @@ -Set the default customer also on the PoS UI. diff --git a/pos_default_partner/static/description/index.html b/pos_default_partner/static/description/index.html index c17ad0a5db..4069e684c5 100644 --- a/pos_default_partner/static/description/index.html +++ b/pos_default_partner/static/description/index.html @@ -1,4 +1,3 @@ - @@ -375,12 +374,11 @@

Point Of Sale Default Partner

-
-

Known issues / Roadmap

-

Set the default customer also on the PoS UI.

-
-

Bug Tracker

+

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 to smash it by providing a detailed and welcomed @@ -403,38 +397,34 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Akretion
  • FactorLibre
-

Contributors

-
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose diff --git a/pos_default_partner/static/src/js/models.esm.js b/pos_default_partner/static/src/js/models.esm.js new file mode 100644 index 0000000000..abe68b5531 --- /dev/null +++ b/pos_default_partner/static/src/js/models.esm.js @@ -0,0 +1,17 @@ +/** @odoo-module **/ + +import {Order} from "point_of_sale.models"; +import Registries from "point_of_sale.Registries"; + +const DefaultPartnerOrder = (OriginalOrder) => + class extends OriginalOrder { + constructor(obj, options) { + super(...arguments); + const default_partner_id = this.pos.config.default_partner_id; + if (!options.json && default_partner_id) { + this.set_partner(this.pos.db.get_partner_by_id(default_partner_id[0])); + } + } + }; + +Registries.Model.extend(Order, DefaultPartnerOrder);