diff --git a/pos_default_partner/README.rst b/pos_default_partner/README.rst new file mode 100644 index 00000000..7307b41f --- /dev/null +++ b/pos_default_partner/README.rst @@ -0,0 +1,86 @@ +============================= +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 +============= + +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 +=========== + +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 00000000..0650744f --- /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 00000000..26274209 --- /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/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 new file mode 100644 index 00000000..7723e42a --- /dev/null +++ b/pos_default_partner/models/__init__.py @@ -0,0 +1,2 @@ +from . import pos_order +from . import pos_config diff --git a/pos_default_partner/models/pos_config.py b/pos_default_partner/models/pos_config.py new file mode 100644 index 00000000..96f2df8b --- /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 new file mode 100644 index 00000000..a6300bfa --- /dev/null +++ b/pos_default_partner/models/pos_order.py @@ -0,0 +1,15 @@ +# 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): + 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 new file mode 100644 index 00000000..896aabcf --- /dev/null +++ b/pos_default_partner/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +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/CONTRIBUTORS.rst b/pos_default_partner/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..bb99f510 --- /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 00000000..aea9cc11 --- /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/readme/ROADMAP.rst b/pos_default_partner/readme/ROADMAP.rst new file mode 100644 index 00000000..44ddb1d9 --- /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 new file mode 100644 index 00000000..17522e7a --- /dev/null +++ b/pos_default_partner/static/description/index.html @@ -0,0 +1,436 @@ + + + + + + +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

+

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

+

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/pos_config.xml b/pos_default_partner/views/pos_config.xml new file mode 100644 index 00000000..931ee620 --- /dev/null +++ b/pos_default_partner/views/pos_config.xml @@ -0,0 +1,33 @@ + + + + + + + pos.config.form (in pos_default_partner) + pos.config + + + +

Customers

+
+
+
+
+
+
+
+
+
+ + + +