From 5ec916e015062890079570ef6902f212ea0c6c1c Mon Sep 17 00:00:00 2001 From: David Beal Date: Fri, 10 Jan 2020 09:50:50 +0100 Subject: [PATCH 01/20] ADD module pos_default_partner --- pos_default_partner/README.rst | 80 ++++ pos_default_partner/__init__.py | 1 + pos_default_partner/__manifest__.py | 21 + pos_default_partner/models/__init__.py | 3 + pos_default_partner/models/company.py | 11 + pos_default_partner/models/config.py | 12 + pos_default_partner/models/pos_order.py | 17 + pos_default_partner/readme/CONFIGURE.rst | 1 + pos_default_partner/readme/CONTRIBUTORS.rst | 3 + pos_default_partner/readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 430 ++++++++++++++++++ pos_default_partner/views/config_view.xml | 25 + 12 files changed, 605 insertions(+) create mode 100644 pos_default_partner/README.rst create mode 100644 pos_default_partner/__init__.py create mode 100644 pos_default_partner/__manifest__.py create mode 100644 pos_default_partner/models/__init__.py create mode 100644 pos_default_partner/models/company.py create mode 100644 pos_default_partner/models/config.py create mode 100644 pos_default_partner/models/pos_order.py create mode 100644 pos_default_partner/readme/CONFIGURE.rst create mode 100644 pos_default_partner/readme/CONTRIBUTORS.rst create mode 100644 pos_default_partner/readme/DESCRIPTION.rst create mode 100644 pos_default_partner/static/description/index.html create mode 100644 pos_default_partner/views/config_view.xml diff --git a/pos_default_partner/README.rst b/pos_default_partner/README.rst new file mode 100644 index 0000000000..32e8e05c41 --- /dev/null +++ b/pos_default_partner/README.rst @@ -0,0 +1,80 @@ +============================= +Point Of Sale Default Partner +============================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/12.0/pos_default_partner + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_default_partner + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Define a default partner for Point Of Sale order on each company. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Set default partner on POS settings + +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 +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Akretion + + * David Beal + +Maintainers +~~~~~~~~~~~ + +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/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_default_partner/__init__.py b/pos_default_partner/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_default_partner/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py new file mode 100644 index 0000000000..a6d0e07124 --- /dev/null +++ b/pos_default_partner/__manifest__.py @@ -0,0 +1,21 @@ +# copyright 2020 Akretion David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Point Of Sale Default Partner", + "summary": "Add a default customer in pos order", + "license": "AGPL-3", + "version": "12.0.1.0.0", + "author": "Akretion," + "Odoo Community Association (OCA)", + "maintainer": "Akretion", + "category": "Point of sale", + "depends": [ + "point_of_sale", + ], + "data": [ + "views/config_view.xml" + ], + "website": "https://github.com/OCA/pos", + "installable": True, +} diff --git a/pos_default_partner/models/__init__.py b/pos_default_partner/models/__init__.py new file mode 100644 index 0000000000..f8c83388a9 --- /dev/null +++ b/pos_default_partner/models/__init__.py @@ -0,0 +1,3 @@ +from . import company +from . import config +from . import pos_order diff --git a/pos_default_partner/models/company.py b/pos_default_partner/models/company.py new file mode 100644 index 0000000000..dca35f36c9 --- /dev/null +++ b/pos_default_partner/models/company.py @@ -0,0 +1,11 @@ +# copyright 2020 Akretion David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + pos_default_partner_id = fields.Many2one( + comodel_name="res.partner", string="Default customer") diff --git a/pos_default_partner/models/config.py b/pos_default_partner/models/config.py new file mode 100644 index 0000000000..f3a8481a2c --- /dev/null +++ b/pos_default_partner/models/config.py @@ -0,0 +1,12 @@ +# copyright 2020 Akretion David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_default_partner_id = fields.Many2one( + comodel_name="res.partner", readonly=False, + related="company_id.pos_default_partner_id") diff --git a/pos_default_partner/models/pos_order.py b/pos_default_partner/models/pos_order.py new file mode 100644 index 0000000000..5d2eac2cb9 --- /dev/null +++ b/pos_default_partner/models/pos_order.py @@ -0,0 +1,17 @@ +# copyright 2020 Akretion David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class PosOrder(models.Model): + _inherit = "pos.order" + + @api.model + def create(self, vals): + if not vals.get("partner_id"): + company_id = vals.get("company_id") or self.env.user.company_id.id + partner = self.env["res.company"].browse(company_id).pos_default_partner_id + if partner: + vals["partner_id"] = partner.id + return super().create(vals) diff --git a/pos_default_partner/readme/CONFIGURE.rst b/pos_default_partner/readme/CONFIGURE.rst new file mode 100644 index 0000000000..047aa92a55 --- /dev/null +++ b/pos_default_partner/readme/CONFIGURE.rst @@ -0,0 +1 @@ +Set default partner on POS settings diff --git a/pos_default_partner/readme/CONTRIBUTORS.rst b/pos_default_partner/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..bb99f51052 --- /dev/null +++ b/pos_default_partner/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Akretion + + * David Beal diff --git a/pos_default_partner/readme/DESCRIPTION.rst b/pos_default_partner/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..aea9cc115c --- /dev/null +++ b/pos_default_partner/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Define a default partner for Point Of Sale order on each company. diff --git a/pos_default_partner/static/description/index.html b/pos_default_partner/static/description/index.html new file mode 100644 index 0000000000..7ef3c9e245 --- /dev/null +++ b/pos_default_partner/static/description/index.html @@ -0,0 +1,430 @@ + + + + + + +Point Of Sale Default Partner + + + +
+

Point Of Sale Default Partner

+ + +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

+

Define a default partner for Point Of Sale order on each company.

+

Table of contents

+ +
+

Configuration

+

Set default partner on POS settings

+
+
+

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

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/pos_default_partner/views/config_view.xml b/pos_default_partner/views/config_view.xml new file mode 100644 index 0000000000..2559261360 --- /dev/null +++ b/pos_default_partner/views/config_view.xml @@ -0,0 +1,25 @@ + + + + + + res.config.settings + + + +

POS customer

+
+
+
+
+
+
+
+
+
+ +
From 39040c62f8eda5bd5ceec5ccd645b53abbe30897 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Thu, 2 Jul 2020 16:07:45 +0200 Subject: [PATCH 02/20] [IMP] pos_default_partner add continuation --- pos_default_partner/README.rst | 8 ++++- pos_default_partner/__manifest__.py | 2 +- pos_default_partner/models/__init__.py | 3 +- pos_default_partner/models/company.py | 11 ------- pos_default_partner/models/config.py | 12 ------- pos_default_partner/models/pos_config.py | 14 ++++++++ pos_default_partner/models/pos_order.py | 8 ++--- pos_default_partner/readme/CONFIGURE.rst | 3 +- pos_default_partner/readme/ROADMAP.rst | 1 + .../static/description/index.html | 28 +++++++++------- pos_default_partner/views/config_view.xml | 25 -------------- pos_default_partner/views/pos_config.xml | 33 +++++++++++++++++++ 12 files changed, 79 insertions(+), 69 deletions(-) delete mode 100644 pos_default_partner/models/company.py delete mode 100644 pos_default_partner/models/config.py create mode 100644 pos_default_partner/models/pos_config.py create mode 100644 pos_default_partner/readme/ROADMAP.rst delete mode 100644 pos_default_partner/views/config_view.xml create mode 100644 pos_default_partner/views/pos_config.xml diff --git a/pos_default_partner/README.rst b/pos_default_partner/README.rst index 32e8e05c41..7307b41fb0 100644 --- a/pos_default_partner/README.rst +++ b/pos_default_partner/README.rst @@ -35,7 +35,13 @@ Define a default partner for Point Of Sale order on each company. Configuration ============= -Set default partner on POS settings +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 =========== diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index a6d0e07124..26274209f8 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -14,7 +14,7 @@ "point_of_sale", ], "data": [ - "views/config_view.xml" + 'views/pos_config.xml', ], "website": "https://github.com/OCA/pos", "installable": True, diff --git a/pos_default_partner/models/__init__.py b/pos_default_partner/models/__init__.py index f8c83388a9..7723e42ab6 100644 --- a/pos_default_partner/models/__init__.py +++ b/pos_default_partner/models/__init__.py @@ -1,3 +1,2 @@ -from . import company -from . import config from . import pos_order +from . import pos_config diff --git a/pos_default_partner/models/company.py b/pos_default_partner/models/company.py deleted file mode 100644 index dca35f36c9..0000000000 --- a/pos_default_partner/models/company.py +++ /dev/null @@ -1,11 +0,0 @@ -# copyright 2020 Akretion David BEAL -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import fields, models - - -class ResCompany(models.Model): - _inherit = "res.company" - - pos_default_partner_id = fields.Many2one( - comodel_name="res.partner", string="Default customer") diff --git a/pos_default_partner/models/config.py b/pos_default_partner/models/config.py deleted file mode 100644 index f3a8481a2c..0000000000 --- a/pos_default_partner/models/config.py +++ /dev/null @@ -1,12 +0,0 @@ -# copyright 2020 Akretion David BEAL -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import fields, models - - -class ResConfigSettings(models.TransientModel): - _inherit = "res.config.settings" - - pos_default_partner_id = fields.Many2one( - comodel_name="res.partner", readonly=False, - related="company_id.pos_default_partner_id") diff --git a/pos_default_partner/models/pos_config.py b/pos_default_partner/models/pos_config.py new file mode 100644 index 0000000000..96f2df8b61 --- /dev/null +++ b/pos_default_partner/models/pos_config.py @@ -0,0 +1,14 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class PosConfig(models.Model): + + _inherit = 'pos.config' + + default_partner_id = fields.Many2one( + comodel_name="res.partner", + string="Default Customer", + ) diff --git a/pos_default_partner/models/pos_order.py b/pos_default_partner/models/pos_order.py index 5d2eac2cb9..a6300bfa06 100644 --- a/pos_default_partner/models/pos_order.py +++ b/pos_default_partner/models/pos_order.py @@ -9,9 +9,7 @@ class PosOrder(models.Model): @api.model def create(self, vals): - if not vals.get("partner_id"): - company_id = vals.get("company_id") or self.env.user.company_id.id - partner = self.env["res.company"].browse(company_id).pos_default_partner_id - if partner: - vals["partner_id"] = partner.id + session = self.env["pos.session"].browse(vals.get("session_id")) + if session.config_id.default_partner_id and not vals.get("partner_id"): + vals["partner_id"] = session.config_id.default_partner_id.id return super().create(vals) diff --git a/pos_default_partner/readme/CONFIGURE.rst b/pos_default_partner/readme/CONFIGURE.rst index 047aa92a55..896aabcf06 100644 --- a/pos_default_partner/readme/CONFIGURE.rst +++ b/pos_default_partner/readme/CONFIGURE.rst @@ -1 +1,2 @@ -Set default partner on POS settings +Go to Point of Sale's settings page and select a default customer for a +specific PoS configuration. diff --git a/pos_default_partner/readme/ROADMAP.rst b/pos_default_partner/readme/ROADMAP.rst new file mode 100644 index 0000000000..44ddb1d969 --- /dev/null +++ b/pos_default_partner/readme/ROADMAP.rst @@ -0,0 +1 @@ +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 7ef3c9e245..17522e7a70 100644 --- a/pos_default_partner/static/description/index.html +++ b/pos_default_partner/static/description/index.html @@ -373,21 +373,27 @@

Point Of Sale Default Partner

Configuration

-

Set default partner on POS settings

+

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

+

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 @@ -395,15 +401,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Akretion
-

Contributors

+

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/views/config_view.xml b/pos_default_partner/views/config_view.xml deleted file mode 100644 index 2559261360..0000000000 --- a/pos_default_partner/views/config_view.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - res.config.settings - - - -

POS customer

-
-
-
-
-
-
- - - - - diff --git a/pos_default_partner/views/pos_config.xml b/pos_default_partner/views/pos_config.xml new file mode 100644 index 0000000000..931ee62056 --- /dev/null +++ b/pos_default_partner/views/pos_config.xml @@ -0,0 +1,33 @@ + + + + + + + pos.config.form (in pos_default_partner) + pos.config + + + +

Customers

+
+
+
+
+
+
+
+
+
+ + + +
From 4e0300817e82ae21f8700c548ff22f6f20b9fa32 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Mon, 6 Jul 2020 09:08:09 +0000 Subject: [PATCH 03/20] [UPD] Update pos_default_partner.pot --- .../i18n/pos_default_partner.pot | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 pos_default_partner/i18n/pos_default_partner.pot diff --git a/pos_default_partner/i18n/pos_default_partner.pot b/pos_default_partner/i18n/pos_default_partner.pot new file mode 100644 index 0000000000..e5a1ecda48 --- /dev/null +++ b/pos_default_partner/i18n/pos_default_partner.pot @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_default_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_default_partner +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Customers" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__default_partner_id +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Default Customer" +msgstr "" + +#. module: pos_default_partner +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Default customer to use if none is set" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model,name:pos_default_partner.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model,name:pos_default_partner.model_pos_order +msgid "Point of Sale Orders" +msgstr "" + From 34442a7c33aa7b342be2536dcebb3765f6dfc186 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 6 Jul 2020 09:20:23 +0000 Subject: [PATCH 04/20] [ADD] icon.png --- pos_default_partner/static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 pos_default_partner/static/description/icon.png diff --git a/pos_default_partner/static/description/icon.png b/pos_default_partner/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)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YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From 2ed19e9108a2ae1be2e3c9696eb04cf61cda38e4 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 6 Jul 2020 09:20:24 +0000 Subject: [PATCH 05/20] pos_default_partner 12.0.1.0.1 --- pos_default_partner/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index 26274209f8..b0b514940c 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -5,7 +5,7 @@ "name": "Point Of Sale Default Partner", "summary": "Add a default customer in pos order", "license": "AGPL-3", - "version": "12.0.1.0.0", + "version": "12.0.1.0.1", "author": "Akretion," "Odoo Community Association (OCA)", "maintainer": "Akretion", From 641cf49874fa643ba1d054788af64031d2b0fbd7 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Vila Date: Mon, 27 Jul 2020 09:15:07 +0000 Subject: [PATCH 06/20] Added translation using Weblate (Spanish) --- pos_default_partner/i18n/es.po | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 pos_default_partner/i18n/es.po diff --git a/pos_default_partner/i18n/es.po b/pos_default_partner/i18n/es.po new file mode 100644 index 0000000000..24dbeb46ca --- /dev/null +++ b/pos_default_partner/i18n/es.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_default_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: pos_default_partner +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Customers" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__default_partner_id +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Default Customer" +msgstr "" + +#. module: pos_default_partner +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Default customer to use if none is set" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model,name:pos_default_partner.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model,name:pos_default_partner.model_pos_order +msgid "Point of Sale Orders" +msgstr "" From 321f4c5f39188818f42a51bec412e8f948b1749f Mon Sep 17 00:00:00 2001 From: Daniel Martinez Vila Date: Mon, 27 Jul 2020 09:15:16 +0000 Subject: [PATCH 07/20] Translated using Weblate (Spanish) Currently translated at 100.0% (5 of 5 strings) Translation: pos-12.0/pos-12.0-pos_default_partner Translate-URL: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_default_partner/es/ --- pos_default_partner/i18n/es.po | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pos_default_partner/i18n/es.po b/pos_default_partner/i18n/es.po index 24dbeb46ca..1cfba47860 100644 --- a/pos_default_partner/i18n/es.po +++ b/pos_default_partner/i18n/es.po @@ -6,36 +6,38 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2020-07-27 11:19+0000\n" +"Last-Translator: Daniel Martinez Vila \n" "Language-Team: none\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" #. module: pos_default_partner #: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form msgid "Customers" -msgstr "" +msgstr "Clientes" #. module: pos_default_partner #: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__default_partner_id #: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form msgid "Default Customer" -msgstr "" +msgstr "Cliente predeterminado" #. module: pos_default_partner #: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form msgid "Default customer to use if none is set" -msgstr "" +msgstr "Cliente predeterminado para usar si no se establece ninguno" #. module: pos_default_partner #: model:ir.model,name:pos_default_partner.model_pos_config msgid "Point of Sale Configuration" -msgstr "" +msgstr "Configuración del punto de venta" #. module: pos_default_partner #: model:ir.model,name:pos_default_partner.model_pos_order msgid "Point of Sale Orders" -msgstr "" +msgstr "Pedidos de Punto de Venta" From 26d008f8ddc1fbe53b2191adffb4c227c4a5755e Mon Sep 17 00:00:00 2001 From: Alba Riera Date: Fri, 19 Feb 2021 11:15:59 +0100 Subject: [PATCH 08/20] [IMP] pos_default_partner: black, isort, prettier --- pos_default_partner/__manifest__.py | 11 +++-------- pos_default_partner/models/pos_config.py | 5 ++--- pos_default_partner/views/pos_config.xml | 13 ++++--------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index b0b514940c..0cc37ff88d 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -6,16 +6,11 @@ "summary": "Add a default customer in pos order", "license": "AGPL-3", "version": "12.0.1.0.1", - "author": "Akretion," - "Odoo Community Association (OCA)", + "author": "Akretion," "Odoo Community Association (OCA)", "maintainer": "Akretion", "category": "Point of sale", - "depends": [ - "point_of_sale", - ], - "data": [ - 'views/pos_config.xml', - ], + "depends": ["point_of_sale"], + "data": ["views/pos_config.xml"], "website": "https://github.com/OCA/pos", "installable": True, } diff --git a/pos_default_partner/models/pos_config.py b/pos_default_partner/models/pos_config.py index 96f2df8b61..d957596ed0 100644 --- a/pos_default_partner/models/pos_config.py +++ b/pos_default_partner/models/pos_config.py @@ -6,9 +6,8 @@ class PosConfig(models.Model): - _inherit = 'pos.config' + _inherit = "pos.config" default_partner_id = fields.Many2one( - comodel_name="res.partner", - string="Default Customer", + comodel_name="res.partner", string="Default Customer", ) diff --git a/pos_default_partner/views/pos_config.xml b/pos_default_partner/views/pos_config.xml index 931ee62056..f1c206e11a 100644 --- a/pos_default_partner/views/pos_config.xml +++ b/pos_default_partner/views/pos_config.xml @@ -1,25 +1,23 @@ - + - - pos.config.form (in pos_default_partner) pos.config - +

Customers

-
@@ -27,7 +25,4 @@ - - - From e38f45c3a188402fcf0af1ea18d98a9b2ce607fb Mon Sep 17 00:00:00 2001 From: Alba Riera Date: Fri, 19 Feb 2021 11:25:37 +0100 Subject: [PATCH 09/20] [MIG] pos_default_partner: Migration to 13.0 --- pos_default_partner/__manifest__.py | 2 +- pos_default_partner/models/pos_order.py | 10 +- pos_default_partner/tests/__init__.py | 1 + .../tests/test_pos_default_partner.py | 119 ++++++++++++++++++ 4 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 pos_default_partner/tests/__init__.py create mode 100644 pos_default_partner/tests/test_pos_default_partner.py diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index 0cc37ff88d..71c3857281 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -5,7 +5,7 @@ "name": "Point Of Sale Default Partner", "summary": "Add a default customer in pos order", "license": "AGPL-3", - "version": "12.0.1.0.1", + "version": "13.0.1.0.0", "author": "Akretion," "Odoo Community Association (OCA)", "maintainer": "Akretion", "category": "Point of sale", diff --git a/pos_default_partner/models/pos_order.py b/pos_default_partner/models/pos_order.py index a6300bfa06..a4441f3876 100644 --- a/pos_default_partner/models/pos_order.py +++ b/pos_default_partner/models/pos_order.py @@ -8,8 +8,8 @@ class PosOrder(models.Model): _inherit = "pos.order" @api.model - def create(self, vals): - session = self.env["pos.session"].browse(vals.get("session_id")) - if session.config_id.default_partner_id and not vals.get("partner_id"): - vals["partner_id"] = session.config_id.default_partner_id.id - return super().create(vals) + def _complete_values_from_session(self, session, values): + result = super()._complete_values_from_session(session, values) + if session.config_id.default_partner_id and not result.get("partner_id"): + result["partner_id"] = session.config_id.default_partner_id.id + return result diff --git a/pos_default_partner/tests/__init__.py b/pos_default_partner/tests/__init__.py new file mode 100644 index 0000000000..94abdc77ec --- /dev/null +++ b/pos_default_partner/tests/__init__.py @@ -0,0 +1 @@ +from . import test_pos_default_partner diff --git a/pos_default_partner/tests/test_pos_default_partner.py b/pos_default_partner/tests/test_pos_default_partner.py new file mode 100644 index 0000000000..0988477c76 --- /dev/null +++ b/pos_default_partner/tests/test_pos_default_partner.py @@ -0,0 +1,119 @@ +from odoo import fields +from odoo.tests.common import SavepointCase + + +class TestPosDefaultPartner(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.config = cls.env["pos.config"].create({"name": "DEMO Config"}) + cls.PosOrder = cls.env["pos.order"] + cls.AccountPayment = cls.env["account.payment"] + + # Get Object + cls.pos_product = cls.env["product.product"].create( + {"name": "Test POS Product"} + ) + cls.pricelist = cls.env["product.pricelist"].create( + { + "name": "Test pricelist", + "currency_id": cls.env.user.company_id.currency_id.id, + "item_ids": [ + ( + 0, + 0, + { + "applied_on": "3_global", + "compute_price": "formula", + "base": "list_price", + }, + ) + ], + } + ) + cls.partner_01 = cls.env["res.partner"].create({"name": "Test partner 1"}) + cls.partner_02 = cls.env["res.partner"].create({"name": "Test partner 2"}) + + def _create_order(self, partner_id=False): + self.config.open_session_cb() + session = self.config.current_session_id + account_receivable_id = ( + self.env.user.partner_id.property_account_receivable_id.id + ) + payment_methods = session.payment_method_ids + # Create order + order_data = { + "id": "0006-001-0010", + "to_invoice": True, + "data": { + "pricelist_id": self.pricelist.id, + "user_id": 1, + "name": "Order 0006-001-0010", + "partner_id": partner_id, + "amount_paid": 0.9, + "pos_session_id": session.id, + "lines": [ + [ + 0, + 0, + { + "product_id": self.pos_product.id, + "price_unit": 0.9, + "qty": 1, + "price_subtotal": 0.9, + "price_subtotal_incl": 0.9, + }, + ] + ], + "statement_ids": [ + [ + 0, + 0, + { + "journal_id": session.statement_ids[0].journal_id.id, + "amount": 0.9, + "name": fields.Datetime.now(), + "account_id": account_receivable_id, + "statement_id": session.statement_ids[0].id, + "payment_method_id": payment_methods.filtered( + lambda pm: pm.is_cash_count + and not pm.split_transactions + )[0].id, + }, + ] + ], + "creation_date": u"2018-09-27 15:51:03", + "amount_tax": 0, + "fiscal_position_id": False, + "uid": u"00001-001-0001", + "amount_return": 0, + "sequence_number": 1, + "amount_total": 0.9, + }, + } + + result = self.PosOrder.create_from_ui([order_data]) + order = self.PosOrder.browse(result[0]["id"]) + return order + + def test_no_default_partner(self): + order = self._create_order() + self.assertTrue(order) + self.assertFalse(order.partner_id) + + def test_no_default_partner_assigned_partner(self): + order = self._create_order(self.partner_01.id) + self.assertTrue(order) + self.assertEqual(order.partner_id, self.partner_01) + + def test_default_partner(self): + self.config.default_partner_id = self.partner_02 + order = self._create_order() + self.assertTrue(order) + self.assertEqual(order.partner_id, self.partner_02) + + def test_default_partner_assigned_partner(self): + self.config.default_partner_id = self.partner_02 + order = self._create_order(self.partner_01.id) + self.assertTrue(order) + self.assertEqual(order.partner_id, self.partner_01) From 7f3571befe951e348de2638483b35091226eaaab Mon Sep 17 00:00:00 2001 From: oca-travis Date: Thu, 8 Apr 2021 18:39:34 +0000 Subject: [PATCH 10/20] [UPD] Update pos_default_partner.pot --- pos_default_partner/i18n/pos_default_partner.pot | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pos_default_partner/i18n/pos_default_partner.pot b/pos_default_partner/i18n/pos_default_partner.pot index e5a1ecda48..6d726fdac4 100644 --- a/pos_default_partner/i18n/pos_default_partner.pot +++ b/pos_default_partner/i18n/pos_default_partner.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * pos_default_partner +# * pos_default_partner # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -38,4 +38,3 @@ msgstr "" #: model:ir.model,name:pos_default_partner.model_pos_order msgid "Point of Sale Orders" msgstr "" - From 1364959c32c41499f04efbc5323d2313252fe668 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 8 Apr 2021 18:47:30 +0000 Subject: [PATCH 11/20] [UPD] README.rst --- pos_default_partner/README.rst | 10 +++++----- pos_default_partner/static/description/index.html | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pos_default_partner/README.rst b/pos_default_partner/README.rst index 7307b41fb0..bf0bcf926f 100644 --- a/pos_default_partner/README.rst +++ b/pos_default_partner/README.rst @@ -14,13 +14,13 @@ Point Of Sale Default Partner :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github - :target: https://github.com/OCA/pos/tree/12.0/pos_default_partner + :target: https://github.com/OCA/pos/tree/13.0/pos_default_partner :alt: OCA/pos .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_default_partner + :target: https://translation.odoo-community.org/projects/pos-13-0/pos-13-0-pos_default_partner :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/184/12.0 + :target: https://runbot.odoo-community.org/runbot/184/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -49,7 +49,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -81,6 +81,6 @@ 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/pos `_ project on GitHub. +This module is part of the `OCA/pos `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_default_partner/static/description/index.html b/pos_default_partner/static/description/index.html index 17522e7a70..7d16b73773 100644 --- a/pos_default_partner/static/description/index.html +++ b/pos_default_partner/static/description/index.html @@ -367,7 +367,7 @@

Point Of Sale Default Partner

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

Define a default partner for Point Of Sale order on each company.

Table of contents

@@ -397,7 +397,7 @@

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.

+feedback.

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

@@ -427,7 +427,7 @@

Maintainers

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/pos project on GitHub.

+

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

From 9a89ac7426c858d2249ff2f86d6e44e175937d5b Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 8 Apr 2021 18:47:30 +0000 Subject: [PATCH 12/20] pos_default_partner 13.0.1.0.1 --- pos_default_partner/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index 71c3857281..1078f1ffdb 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -5,7 +5,7 @@ "name": "Point Of Sale Default Partner", "summary": "Add a default customer in pos order", "license": "AGPL-3", - "version": "13.0.1.0.0", + "version": "13.0.1.0.1", "author": "Akretion," "Odoo Community Association (OCA)", "maintainer": "Akretion", "category": "Point of sale", From bc3eceefb7c41edc9cd4947d16ce994d546a4e4a Mon Sep 17 00:00:00 2001 From: fshah Date: Mon, 19 Apr 2021 16:25:11 +0530 Subject: [PATCH 13/20] [IMP] pos_default_partner: isort, black, prettier --- pos_default_partner/models/pos_config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pos_default_partner/models/pos_config.py b/pos_default_partner/models/pos_config.py index d957596ed0..0745a81d35 100644 --- a/pos_default_partner/models/pos_config.py +++ b/pos_default_partner/models/pos_config.py @@ -9,5 +9,6 @@ class PosConfig(models.Model): _inherit = "pos.config" default_partner_id = fields.Many2one( - comodel_name="res.partner", string="Default Customer", + comodel_name="res.partner", + string="Default Customer", ) From bc9d57f754cfdf2392ce677a7b30cc79aae64644 Mon Sep 17 00:00:00 2001 From: fshah Date: Mon, 19 Apr 2021 16:29:13 +0530 Subject: [PATCH 14/20] [MIG] Migrate module pos_default_partner to v14. --- pos_default_partner/README.rst | 2 ++ pos_default_partner/__manifest__.py | 2 +- pos_default_partner/readme/CONTRIBUTORS.rst | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pos_default_partner/README.rst b/pos_default_partner/README.rst index bf0bcf926f..404627d892 100644 --- a/pos_default_partner/README.rst +++ b/pos_default_partner/README.rst @@ -67,6 +67,8 @@ Contributors * Akretion * David Beal +* Foram Shah + Maintainers ~~~~~~~~~~~ diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index 1078f1ffdb..c393e265d0 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -5,7 +5,7 @@ "name": "Point Of Sale Default Partner", "summary": "Add a default customer in pos order", "license": "AGPL-3", - "version": "13.0.1.0.1", + "version": "14.0.1.0.0", "author": "Akretion," "Odoo Community Association (OCA)", "maintainer": "Akretion", "category": "Point of sale", diff --git a/pos_default_partner/readme/CONTRIBUTORS.rst b/pos_default_partner/readme/CONTRIBUTORS.rst index bb99f51052..f4377f281f 100644 --- a/pos_default_partner/readme/CONTRIBUTORS.rst +++ b/pos_default_partner/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Akretion * David Beal +* Foram Shah From 3b43a101cb899e8e0e945ebf5cb11d4d11b4a7e5 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Mon, 7 Jun 2021 15:37:06 +0000 Subject: [PATCH 15/20] [UPD] Update pos_default_partner.pot --- .../i18n/pos_default_partner.pot | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pos_default_partner/i18n/pos_default_partner.pot b/pos_default_partner/i18n/pos_default_partner.pot index 6d726fdac4..07e8cf4a1b 100644 --- a/pos_default_partner/i18n/pos_default_partner.pot +++ b/pos_default_partner/i18n/pos_default_partner.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -29,6 +29,24 @@ msgstr "" msgid "Default customer to use if none is set" msgstr "" +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__display_name +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_order__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__id +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_order__id +msgid "ID" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config____last_update +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_order____last_update +msgid "Last Modified on" +msgstr "" + #. module: pos_default_partner #: model:ir.model,name:pos_default_partner.model_pos_config msgid "Point of Sale Configuration" From 760b1cd5d4d3037bcbc9ff2a35f62a90dcd23ad7 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 7 Jun 2021 15:41:17 +0000 Subject: [PATCH 16/20] [UPD] README.rst --- pos_default_partner/README.rst | 11 +++++------ pos_default_partner/static/description/index.html | 8 +++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pos_default_partner/README.rst b/pos_default_partner/README.rst index 404627d892..cd18b93100 100644 --- a/pos_default_partner/README.rst +++ b/pos_default_partner/README.rst @@ -14,13 +14,13 @@ Point Of Sale Default Partner :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github - :target: https://github.com/OCA/pos/tree/13.0/pos_default_partner + :target: https://github.com/OCA/pos/tree/14.0/pos_default_partner :alt: OCA/pos .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/pos-13-0/pos-13-0-pos_default_partner + :target: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_default_partner :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/184/13.0 + :target: https://runbot.odoo-community.org/runbot/184/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -49,7 +49,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -69,7 +69,6 @@ Contributors * David Beal * Foram Shah - Maintainers ~~~~~~~~~~~ @@ -83,6 +82,6 @@ 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/pos `_ project on GitHub. +This module is part of the `OCA/pos `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_default_partner/static/description/index.html b/pos_default_partner/static/description/index.html index 7d16b73773..8c4a61b14a 100644 --- a/pos_default_partner/static/description/index.html +++ b/pos_default_partner/static/description/index.html @@ -367,7 +367,7 @@

Point Of Sale Default Partner

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

Define a default partner for Point Of Sale order on each company.

Table of contents

@@ -397,7 +397,7 @@

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.

+feedback.

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

@@ -418,6 +418,8 @@

Contributors

+
  • Foram Shah <foram.shah@initos.com>

    +
  • @@ -427,7 +429,7 @@

    Maintainers

    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/pos project on GitHub.

    +

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

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    From 8dba1a895a889c8a08af5020573365e167f7418f Mon Sep 17 00:00:00 2001 From: oca-git-bot Date: Thu, 31 Mar 2022 17:07:53 +0200 Subject: [PATCH 17/20] [IMP] update dotfiles [ci skip] --- pos_default_partner/tests/test_pos_default_partner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pos_default_partner/tests/test_pos_default_partner.py b/pos_default_partner/tests/test_pos_default_partner.py index 0988477c76..658ce28844 100644 --- a/pos_default_partner/tests/test_pos_default_partner.py +++ b/pos_default_partner/tests/test_pos_default_partner.py @@ -82,10 +82,10 @@ def _create_order(self, partner_id=False): }, ] ], - "creation_date": u"2018-09-27 15:51:03", + "creation_date": "2018-09-27 15:51:03", "amount_tax": 0, "fiscal_position_id": False, - "uid": u"00001-001-0001", + "uid": "00001-001-0001", "amount_return": 0, "sequence_number": 1, "amount_total": 0.9, From 6a8467626034f438a1a0c5f602469f93fa11714a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Thu, 29 Sep 2022 09:22:23 +0000 Subject: [PATCH 18/20] Added translation using Weblate (French) --- pos_default_partner/i18n/fr.po | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 pos_default_partner/i18n/fr.po diff --git a/pos_default_partner/i18n/fr.po b/pos_default_partner/i18n/fr.po new file mode 100644 index 0000000000..cefd162885 --- /dev/null +++ b/pos_default_partner/i18n/fr.po @@ -0,0 +1,59 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_default_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" + +#. module: pos_default_partner +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Customers" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__default_partner_id +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Default Customer" +msgstr "" + +#. module: pos_default_partner +#: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form +msgid "Default customer to use if none is set" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__display_name +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_order__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__id +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_order__id +msgid "ID" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_config____last_update +#: model:ir.model.fields,field_description:pos_default_partner.field_pos_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model,name:pos_default_partner.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_default_partner +#: model:ir.model,name:pos_default_partner.model_pos_order +msgid "Point of Sale Orders" +msgstr "" From c4752e33b9b91a02a0e9ac2926d45a16c89e1f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Thu, 29 Sep 2022 09:23:56 +0000 Subject: [PATCH 19/20] Translated using Weblate (French) Currently translated at 100.0% (8 of 8 strings) Translation: pos-14.0/pos-14.0-pos_default_partner Translate-URL: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_default_partner/fr/ --- pos_default_partner/i18n/fr.po | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pos_default_partner/i18n/fr.po b/pos_default_partner/i18n/fr.po index cefd162885..694887a916 100644 --- a/pos_default_partner/i18n/fr.po +++ b/pos_default_partner/i18n/fr.po @@ -6,54 +6,56 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-09-29 09:24+0000\n" +"Last-Translator: Rémi \n" "Language-Team: none\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: pos_default_partner #: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form msgid "Customers" -msgstr "" +msgstr "Clients" #. module: pos_default_partner #: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__default_partner_id #: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form msgid "Default Customer" -msgstr "" +msgstr "Client par défaut" #. module: pos_default_partner #: model_terms:ir.ui.view,arch_db:pos_default_partner.pos_config_view_form msgid "Default customer to use if none is set" -msgstr "" +msgstr "Client par défaut à utiliser si aucun n'est renseigné" #. module: pos_default_partner #: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__display_name #: model:ir.model.fields,field_description:pos_default_partner.field_pos_order__display_name msgid "Display Name" -msgstr "" +msgstr "Nom Affiché" #. module: pos_default_partner #: model:ir.model.fields,field_description:pos_default_partner.field_pos_config__id #: model:ir.model.fields,field_description:pos_default_partner.field_pos_order__id msgid "ID" -msgstr "" +msgstr "ID" #. module: pos_default_partner #: model:ir.model.fields,field_description:pos_default_partner.field_pos_config____last_update #: model:ir.model.fields,field_description:pos_default_partner.field_pos_order____last_update msgid "Last Modified on" -msgstr "" +msgstr "Dernière mise à jour le" #. module: pos_default_partner #: model:ir.model,name:pos_default_partner.model_pos_config msgid "Point of Sale Configuration" -msgstr "" +msgstr "Configuration du Point de Vente" #. module: pos_default_partner #: model:ir.model,name:pos_default_partner.model_pos_order msgid "Point of Sale Orders" -msgstr "" +msgstr "Commandes du Point de Vente" From 0dc70aa8502bedb39d021b20ae6cef74509d2bb1 Mon Sep 17 00:00:00 2001 From: Alvaro Rollan Date: Fri, 23 Sep 2022 13:21:03 +0200 Subject: [PATCH 20/20] [16.0][MIG] pos_default_partner --- pos_default_partner/__manifest__.py | 6 +- pos_default_partner/models/__init__.py | 1 + .../models/res_config_settings.py | 12 ++ pos_default_partner/readme/CONTRIBUTORS.rst | 2 + .../tests/test_pos_default_partner.py | 126 +++++------------- pos_default_partner/views/pos_config.xml | 28 ---- .../views/res_config_settings_view.xml | 34 +++++ .../odoo/addons/pos_default_partner | 1 + setup/pos_default_partner/setup.py | 6 + 9 files changed, 91 insertions(+), 125 deletions(-) create mode 100644 pos_default_partner/models/res_config_settings.py delete mode 100644 pos_default_partner/views/pos_config.xml create mode 100644 pos_default_partner/views/res_config_settings_view.xml create mode 120000 setup/pos_default_partner/odoo/addons/pos_default_partner create mode 100644 setup/pos_default_partner/setup.py diff --git a/pos_default_partner/__manifest__.py b/pos_default_partner/__manifest__.py index c393e265d0..999f1fc2ec 100644 --- a/pos_default_partner/__manifest__.py +++ b/pos_default_partner/__manifest__.py @@ -5,12 +5,12 @@ "name": "Point Of Sale Default Partner", "summary": "Add a default customer in pos order", "license": "AGPL-3", - "version": "14.0.1.0.0", - "author": "Akretion," "Odoo Community Association (OCA)", + "version": "16.0.1.0.0", + "author": "Akretion, FactorLibre, Odoo Community Association (OCA)", "maintainer": "Akretion", "category": "Point of sale", "depends": ["point_of_sale"], - "data": ["views/pos_config.xml"], + "data": ["views/res_config_settings_view.xml"], "website": "https://github.com/OCA/pos", "installable": True, } diff --git a/pos_default_partner/models/__init__.py b/pos_default_partner/models/__init__.py index 7723e42ab6..9743e882e2 100644 --- a/pos_default_partner/models/__init__.py +++ b/pos_default_partner/models/__init__.py @@ -1,2 +1,3 @@ from . import pos_order from . import pos_config +from . import res_config_settings diff --git a/pos_default_partner/models/res_config_settings.py b/pos_default_partner/models/res_config_settings.py new file mode 100644 index 0000000000..bffa5cc817 --- /dev/null +++ b/pos_default_partner/models/res_config_settings.py @@ -0,0 +1,12 @@ +# © 2022 FactorLibre - Alvaro Rollan +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_default_partner_id = fields.Many2one( + related="pos_config_id.default_partner_id", + readonly=False, + ) diff --git a/pos_default_partner/readme/CONTRIBUTORS.rst b/pos_default_partner/readme/CONTRIBUTORS.rst index f4377f281f..e06c81b6f0 100644 --- a/pos_default_partner/readme/CONTRIBUTORS.rst +++ b/pos_default_partner/readme/CONTRIBUTORS.rst @@ -2,3 +2,5 @@ * David Beal * Foram Shah +* FactorLibre: + * Alvaro Rollan diff --git a/pos_default_partner/tests/test_pos_default_partner.py b/pos_default_partner/tests/test_pos_default_partner.py index 658ce28844..087842cdfb 100644 --- a/pos_default_partner/tests/test_pos_default_partner.py +++ b/pos_default_partner/tests/test_pos_default_partner.py @@ -1,98 +1,36 @@ -from odoo import fields -from odoo.tests.common import SavepointCase - - -class TestPosDefaultPartner(SavepointCase): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.config = cls.env["pos.config"].create({"name": "DEMO Config"}) - cls.PosOrder = cls.env["pos.order"] - cls.AccountPayment = cls.env["account.payment"] - - # Get Object - cls.pos_product = cls.env["product.product"].create( - {"name": "Test POS Product"} +# copyright 2022 FactorLibre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import odoo + +from odoo.addons.point_of_sale.tests.common import TestPoSCommon + + +@odoo.tests.tagged("post_install", "-at_install") +class TestPosDefaultPartner(TestPoSCommon): + def setUp(self): + super().setUp() + self.config = self.basic_config + self.PosOrder = self.env["pos.order"] + # ==== Partners ==== + self.partner_01 = self.env["res.partner"].create({"name": "Test partner 1"}) + self.partner_02 = self.env["res.partner"].create({"name": "Test partner 2"}) + # ==== Products ==== + self.product0 = self.create_product( + "Product test 0", self.categ_basic, 5.0, 0.0 ) - cls.pricelist = cls.env["product.pricelist"].create( - { - "name": "Test pricelist", - "currency_id": cls.env.user.company_id.currency_id.id, - "item_ids": [ - ( - 0, - 0, - { - "applied_on": "3_global", - "compute_price": "formula", - "base": "list_price", - }, - ) - ], - } - ) - cls.partner_01 = cls.env["res.partner"].create({"name": "Test partner 1"}) - cls.partner_02 = cls.env["res.partner"].create({"name": "Test partner 2"}) + self.product1 = self.create_product("Product test 1", self.categ_basic, 10.0, 5) def _create_order(self, partner_id=False): - self.config.open_session_cb() - session = self.config.current_session_id - account_receivable_id = ( - self.env.user.partner_id.property_account_receivable_id.id - ) - payment_methods = session.payment_method_ids - # Create order - order_data = { - "id": "0006-001-0010", - "to_invoice": True, - "data": { - "pricelist_id": self.pricelist.id, - "user_id": 1, - "name": "Order 0006-001-0010", - "partner_id": partner_id, - "amount_paid": 0.9, - "pos_session_id": session.id, - "lines": [ - [ - 0, - 0, - { - "product_id": self.pos_product.id, - "price_unit": 0.9, - "qty": 1, - "price_subtotal": 0.9, - "price_subtotal_incl": 0.9, - }, - ] - ], - "statement_ids": [ - [ - 0, - 0, - { - "journal_id": session.statement_ids[0].journal_id.id, - "amount": 0.9, - "name": fields.Datetime.now(), - "account_id": account_receivable_id, - "statement_id": session.statement_ids[0].id, - "payment_method_id": payment_methods.filtered( - lambda pm: pm.is_cash_count - and not pm.split_transactions - )[0].id, - }, - ] - ], - "creation_date": "2018-09-27 15:51:03", - "amount_tax": 0, - "fiscal_position_id": False, - "uid": "00001-001-0001", - "amount_return": 0, - "sequence_number": 1, - "amount_total": 0.9, - }, - } - - result = self.PosOrder.create_from_ui([order_data]) + # ==== open a session ==== + self.open_new_session() + # ==== create order ==== + orders = [ + self.create_ui_order_data( + [(self.product0, 3), (self.product1, 20)], partner_id + ) + ] + result = self.env["pos.order"].create_from_ui(orders) order = self.PosOrder.browse(result[0]["id"]) return order @@ -102,7 +40,7 @@ def test_no_default_partner(self): self.assertFalse(order.partner_id) def test_no_default_partner_assigned_partner(self): - order = self._create_order(self.partner_01.id) + order = self._create_order(self.partner_01) self.assertTrue(order) self.assertEqual(order.partner_id, self.partner_01) @@ -114,6 +52,6 @@ def test_default_partner(self): def test_default_partner_assigned_partner(self): self.config.default_partner_id = self.partner_02 - order = self._create_order(self.partner_01.id) + order = self._create_order(self.partner_01) self.assertTrue(order) self.assertEqual(order.partner_id, self.partner_01) diff --git a/pos_default_partner/views/pos_config.xml b/pos_default_partner/views/pos_config.xml deleted file mode 100644 index f1c206e11a..0000000000 --- a/pos_default_partner/views/pos_config.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - pos.config.form (in pos_default_partner) - pos.config - - - -

    Customers

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    diff --git a/pos_default_partner/views/res_config_settings_view.xml b/pos_default_partner/views/res_config_settings_view.xml new file mode 100644 index 0000000000..58504d5b55 --- /dev/null +++ b/pos_default_partner/views/res_config_settings_view.xml @@ -0,0 +1,34 @@ + + + + + res.config.settings.view.form + res.config.settings + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    diff --git a/setup/pos_default_partner/odoo/addons/pos_default_partner b/setup/pos_default_partner/odoo/addons/pos_default_partner new file mode 120000 index 0000000000..1cf907a179 --- /dev/null +++ b/setup/pos_default_partner/odoo/addons/pos_default_partner @@ -0,0 +1 @@ +../../../../pos_default_partner \ No newline at end of file diff --git a/setup/pos_default_partner/setup.py b/setup/pos_default_partner/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_default_partner/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)