From 2e8d8649f5e1286095fa2b0eb8bcbc0eb5b70d26 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Thu, 25 Mar 2021 22:09:30 +0100 Subject: [PATCH] [12.0][ADD] pos_multi_store --- pos_multi_store/README.rst | 72 +++++++++++++++++++ pos_multi_store/__init__.py | 5 ++ pos_multi_store/__manifest__.py | 42 +++++++++++ pos_multi_store/i18n/es.po | 34 +++++++++ pos_multi_store/i18n/it.po | 34 +++++++++ pos_multi_store/i18n/pos_multi_store.pot | 35 +++++++++ pos_multi_store/i18n/ru.po | 34 +++++++++ pos_multi_store/models/__init__.py | 6 ++ pos_multi_store/models/pos_config.py | 23 ++++++ pos_multi_store/models/pos_order.py | 23 ++++++ .../security/multi_store_security.xml | 20 ++++++ pos_multi_store/views/pos_order_view.xml | 41 +++++++++++ 12 files changed, 369 insertions(+) create mode 100644 pos_multi_store/README.rst create mode 100644 pos_multi_store/__init__.py create mode 100644 pos_multi_store/__manifest__.py create mode 100644 pos_multi_store/i18n/es.po create mode 100644 pos_multi_store/i18n/it.po create mode 100644 pos_multi_store/i18n/pos_multi_store.pot create mode 100644 pos_multi_store/i18n/ru.po create mode 100644 pos_multi_store/models/__init__.py create mode 100644 pos_multi_store/models/pos_config.py create mode 100644 pos_multi_store/models/pos_order.py create mode 100644 pos_multi_store/security/multi_store_security.xml create mode 100644 pos_multi_store/views/pos_order_view.xml diff --git a/pos_multi_store/README.rst b/pos_multi_store/README.rst new file mode 100644 index 0000000..3359a5d --- /dev/null +++ b/pos_multi_store/README.rst @@ -0,0 +1,72 @@ +.. |company| replace:: ADHOC SA + +.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png + :alt: ADHOC SA + :target: https://www.adhoc.com.ar + +.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png + +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +============================= +Multi Store for Point of Sale +============================= + + +Related Linked Models: + +* Point of Sale Configuration +* Point of Sale Order + +Installation +============ + +This module should be auto-installed + +Configuration +============= + +No need for configuration + +Usage +===== + +To use this module, you need to: + +#. Just use it. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: http://runbot.adhoc.com.ar/ + +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. + +Credits +======= + +Images +------ + +* |company| |icon| + +Contributors +------------ + +Giovanni Serra + +Maintainer +---------- + +|company_logo| + +This module is maintained by the |company|. + +To contribute to this module, please visit https://www.adhoc.com.ar. diff --git a/pos_multi_store/__init__.py b/pos_multi_store/__init__.py new file mode 100644 index 0000000..1a4fa5c --- /dev/null +++ b/pos_multi_store/__init__.py @@ -0,0 +1,5 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from . import models # noqa diff --git a/pos_multi_store/__manifest__.py b/pos_multi_store/__manifest__.py new file mode 100644 index 0000000..1472727 --- /dev/null +++ b/pos_multi_store/__manifest__.py @@ -0,0 +1,42 @@ +############################################################################## +# +# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) +# All Rights Reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + 'name': 'Multi Store for Point of Sale', + 'version': '12.0.1.0.0', + 'category': 'Point Of Sale', + 'sequence': 14, + 'summary': '', + 'author': 'ADHOC SA, Giovanni Serra - GSLab.it', + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'images': [], + 'depends': [ + 'point_of_sale', + 'base_multi_store', + ], + 'data': [ + 'security/multi_store_security.xml', + 'views/pos_order_view.xml', + ], + 'demo': [], + 'installable': True, + 'auto_install': True, + 'application': False, +} diff --git a/pos_multi_store/i18n/es.po b/pos_multi_store/i18n/es.po new file mode 100644 index 0000000..4f9eda6 --- /dev/null +++ b/pos_multi_store/i18n/es.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_multi_store +# +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_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_order +msgid "Point of Sale Orders" +msgstr "Ordini punto vendita" + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_pos_order_filter +msgid "Store" +msgstr "Negozio" + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_id +msgid "Store related to the location" +msgstr "Negozio correlato all'ubicazione" diff --git a/pos_multi_store/i18n/it.po b/pos_multi_store/i18n/it.po new file mode 100644 index 0000000..8d7e9e1 --- /dev/null +++ b/pos_multi_store/i18n/it.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_multi_store +# +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_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configurazione punto vendita" + +#. module: pos_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_order +msgid "Point of Sale Orders" +msgstr "Ordini " + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_pos_order_filter +msgid "Store" +msgstr "" + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_id +msgid "Store related to the location" +msgstr "" diff --git a/pos_multi_store/i18n/pos_multi_store.pot b/pos_multi_store/i18n/pos_multi_store.pot new file mode 100644 index 0000000..d137345 --- /dev/null +++ b/pos_multi_store/i18n/pos_multi_store.pot @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_multi_store +# +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_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_order +msgid "Point of Sale Orders" +msgstr "" + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_pos_order_filter +msgid "Store" +msgstr "" + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_id +msgid "Store related to the location" +msgstr "" + diff --git a/pos_multi_store/i18n/ru.po b/pos_multi_store/i18n/ru.po new file mode 100644 index 0000000..2de6001 --- /dev/null +++ b/pos_multi_store/i18n/ru.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_multi_store +# +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_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_multi_store +#: model:ir.model,name:pos_multi_store.model_pos_order +msgid "Point of Sale Orders" +msgstr "" + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_pos_order_filter +msgid "Store" +msgstr "" + +#. module: pos_multi_store +#: model_terms:ir.ui.view,arch_db:pos_multi_store.view_id +msgid "Store related to the location" +msgstr "" diff --git a/pos_multi_store/models/__init__.py b/pos_multi_store/models/__init__.py new file mode 100644 index 0000000..1b0c1cf --- /dev/null +++ b/pos_multi_store/models/__init__.py @@ -0,0 +1,6 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from . import pos_config # noqa +from . import pos_order # noqa diff --git a/pos_multi_store/models/pos_config.py b/pos_multi_store/models/pos_config.py new file mode 100644 index 0000000..1dcc41a --- /dev/null +++ b/pos_multi_store/models/pos_config.py @@ -0,0 +1,23 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from odoo import api, models, fields + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + store_id = fields.Many2one( + string="Store", + comodel_name='res.store', + compute='_compute_store_id', + store=True, + ) + + @api.depends('stock_location_id') + def _compute_store_id(self): + for record in self: + warehouse_id = record.stock_location_id.get_warehouse() + if warehouse_id: + record.store_id = warehouse_id.store_id diff --git a/pos_multi_store/models/pos_order.py b/pos_multi_store/models/pos_order.py new file mode 100644 index 0000000..46fb463 --- /dev/null +++ b/pos_multi_store/models/pos_order.py @@ -0,0 +1,23 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from odoo import api, models, fields + + +class PosOrder(models.Model): + _inherit = 'pos.order' + + store_id = fields.Many2one( + string="Store", + comodel_name='res.store', + compute='_compute_store_id', + store=True, + ) + + @api.depends('location_id') + def _compute_store_id(self): + for record in self: + warehouse_id = record.location_id.get_warehouse() + if warehouse_id: + record.store_id = warehouse_id.store_id diff --git a/pos_multi_store/security/multi_store_security.xml b/pos_multi_store/security/multi_store_security.xml new file mode 100644 index 0000000..299ae02 --- /dev/null +++ b/pos_multi_store/security/multi_store_security.xml @@ -0,0 +1,20 @@ + + + + + Pos Config multi-store + + + + ['|',('store_id','=',False),('store_id','child_of',[user.store_id.id])] + + + Pos Order multi-store + + + + ['|',('store_id','=',False),('store_id','child_of',[user.store_id.id])] + + + + diff --git a/pos_multi_store/views/pos_order_view.xml b/pos_multi_store/views/pos_order_view.xml new file mode 100644 index 0000000..f20d5c2 --- /dev/null +++ b/pos_multi_store/views/pos_order_view.xml @@ -0,0 +1,41 @@ + + + + + + pos.order.filter + pos.order + + + + + + + + + + + + + + pos.config.view.form + pos.config + + + +
+
+
+
+
+
+
+
+