diff --git a/operating_unit/static/description/index.html b/operating_unit/static/description/index.html index a6b26f3218..5ae57c196d 100644 --- a/operating_unit/static/description/index.html +++ b/operating_unit/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -441,7 +442,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +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.

diff --git a/pos_operating_unit/README.rst b/pos_operating_unit/README.rst index 7c24db1d93..6596f5fde7 100644 --- a/pos_operating_unit/README.rst +++ b/pos_operating_unit/README.rst @@ -1,6 +1,6 @@ -========================= -POS Operating Unit Access -========================= +======================== +POS with Operating Units +======================== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/pos_operating_unit/__manifest__.py b/pos_operating_unit/__manifest__.py index 17bf915eb4..9a4a89fd63 100644 --- a/pos_operating_unit/__manifest__.py +++ b/pos_operating_unit/__manifest__.py @@ -1,6 +1,6 @@ { - "name": "POS Operating Unit Access", - "version": "14.0.1.0.0", + "name": "POS with Operating Units", + "version": "17.0.1.0.0", "author": "Ilyas, Ooops404, Odoo Community Association (OCA)", "website": "https://github.com/OCA/operating-unit", "category": "Point of sale", @@ -9,5 +9,6 @@ "data": [ "security/pos_security.xml", "views/pos_views.xml", + "views/res_config_settings_views.xml", ], } diff --git a/pos_operating_unit/models/__init__.py b/pos_operating_unit/models/__init__.py index 55d2bb6794..199e05d7ee 100644 --- a/pos_operating_unit/models/__init__.py +++ b/pos_operating_unit/models/__init__.py @@ -2,3 +2,4 @@ from . import pos_order from . import pos_session from . import pos_payment +from . import res_config_settings diff --git a/pos_operating_unit/models/pos_order.py b/pos_operating_unit/models/pos_order.py index 0c19571c9e..1ec9085f02 100644 --- a/pos_operating_unit/models/pos_order.py +++ b/pos_operating_unit/models/pos_order.py @@ -11,14 +11,15 @@ class POSOrder(models.Model): ) config_id = fields.Many2one(related="session_id.config_id", readonly=True) - @api.model - def create(self, vals): - session_id = self.env["pos.session"].sudo().browse(vals.get("session_id")) - if session_id.config_id: - vals["operating_unit_ids"] = [ - (6, 0, session_id.config_id.operating_unit_ids.ids) - ] - return super(POSOrder, self).create(vals) + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + session_id = self.env["pos.session"].sudo().browse(vals.get("session_id")) + if session_id.config_id: + vals["operating_unit_ids"] = [ + (6, 0, session_id.config_id.operating_unit_ids.ids) + ] + return super().create(vals_list) class POSOrderLine(models.Model): @@ -30,11 +31,12 @@ class POSOrderLine(models.Model): string="Operating Units", ) - @api.model - def create(self, vals): - order_id = self.env["pos.order"].sudo().browse(vals.get("order_id")) - if order_id.config_id: - vals["operating_unit_ids"] = [ - (6, 0, order_id.config_id.operating_unit_ids.ids) - ] - return super(POSOrderLine, self).create(vals) + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + order_id = self.env["pos.order"].sudo().browse(vals.get("order_id")) + if order_id.config_id: + vals["operating_unit_ids"] = [ + (6, 0, order_id.config_id.operating_unit_ids.ids) + ] + return super().create(vals_list) diff --git a/pos_operating_unit/models/pos_payment.py b/pos_operating_unit/models/pos_payment.py index 5f7098d4f8..82be4ba6fb 100644 --- a/pos_operating_unit/models/pos_payment.py +++ b/pos_operating_unit/models/pos_payment.py @@ -11,11 +11,12 @@ class POSPayment(models.Model): ) config_id = fields.Many2one(related="session_id.config_id", readonly=True) - @api.model - def create(self, vals): - pos_order_id = self.env["pos.order"].sudo().browse(vals.get("pos_order_id")) - if pos_order_id.config_id: - vals["operating_unit_ids"] = [ - (6, 0, pos_order_id.config_id.operating_unit_ids.ids) - ] - return super(POSPayment, self).create(vals) + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + pos_order_id = self.env["pos.order"].sudo().browse(vals.get("pos_order_id")) + if pos_order_id.config_id: + vals["operating_unit_ids"] = [ + (6, 0, pos_order_id.config_id.operating_unit_ids.ids) + ] + return super().create(vals_list) diff --git a/pos_operating_unit/models/pos_session.py b/pos_operating_unit/models/pos_session.py index 734235265d..3a6b97ec40 100644 --- a/pos_operating_unit/models/pos_session.py +++ b/pos_operating_unit/models/pos_session.py @@ -10,9 +10,10 @@ class POSSession(models.Model): string="Operating Units", ) - @api.model - def create(self, vals): - config_id = self.env["pos.config"].sudo().browse(vals.get("config_id")) - if config_id: - vals["operating_unit_ids"] = [(6, 0, config_id.operating_unit_ids.ids)] - return super(POSSession, self).create(vals) + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + config_id = self.env["pos.config"].sudo().browse(vals.get("config_id")) + if config_id: + vals["operating_unit_ids"] = [(6, 0, config_id.operating_unit_ids.ids)] + return super().create(vals_list) diff --git a/pos_operating_unit/models/res_config_settings.py b/pos_operating_unit/models/res_config_settings.py new file mode 100644 index 0000000000..087acd3d83 --- /dev/null +++ b/pos_operating_unit/models/res_config_settings.py @@ -0,0 +1,10 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_operating_unit_ids = fields.Many2many( + related="pos_config_id.operating_unit_ids", + readonly=False, + ) diff --git a/pos_operating_unit/security/pos_security.xml b/pos_operating_unit/security/pos_security.xml index 36630438bd..e2ce66e1f0 100644 --- a/pos_operating_unit/security/pos_security.xml +++ b/pos_operating_unit/security/pos_security.xml @@ -3,7 +3,7 @@ ['|', ('operating_unit_ids', '=', False), - ('operating_unit_ids', 'in', user.operating_unit_ids.ids)] + ('operating_unit_ids', 'in', operating_unit_ids)] POS Config allowed operating units @@ -15,7 +15,7 @@ ['|', ('operating_unit_ids', '=', False), - ('operating_unit_ids', 'in', user.operating_unit_ids.ids)] + ('operating_unit_ids', 'in', operating_unit_ids)] POS Session allowed operating units @@ -27,7 +27,7 @@ ['|', ('operating_unit_ids', '=', False), - ('operating_unit_ids', 'in', user.operating_unit_ids.ids)] + ('operating_unit_ids', 'in', operating_unit_ids)] POS Order allowed operating units @@ -39,7 +39,7 @@ ['|', ('operating_unit_ids', '=', False), - ('operating_unit_ids', 'in', user.operating_unit_ids.ids)] + ('operating_unit_ids', 'in', operating_unit_ids)] POS Order Line allowed operating units @@ -51,7 +51,7 @@ ['|', ('operating_unit_ids', '=', False), - ('operating_unit_ids', 'in', user.operating_unit_ids.ids)] + ('operating_unit_ids', 'in', operating_unit_ids)] POS Payment allowed operating units @@ -63,7 +63,7 @@ ['|', ('config_id.operating_unit_ids', '=', False), - ('config_id.operating_unit_ids', 'in', user.operating_unit_ids.ids)] + ('config_id.operating_unit_ids', 'in', operating_unit_ids)] POS Order Report allowed operating units diff --git a/pos_operating_unit/static/description/index.html b/pos_operating_unit/static/description/index.html index b954a410bd..7092067cbe 100644 --- a/pos_operating_unit/static/description/index.html +++ b/pos_operating_unit/static/description/index.html @@ -3,7 +3,7 @@ -POS Operating Unit Access +POS with Operating Units -
-

POS Operating Unit Access

+
+

POS with Operating Units