diff --git a/README.md b/README.md index ee05c5306b..50520400f9 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,12 @@ addon | version | maintainers | summary --- | --- | --- | --- [account_operating_unit](account_operating_unit/) | 16.0.1.0.0 | | Introduces Operating Unit (OU) in invoices and Accounting Entries with clearing account [analytic_operating_unit](analytic_operating_unit/) | 16.0.1.0.0 | | Analytic Operating Unit +[contract_operating_unit](contract_operating_unit/) | 16.0.1.0.0 | | Contract Operating Unit [hr_operating_unit](hr_operating_unit/) | 16.0.1.0.0 | | HR Operating Unit [operating_unit](operating_unit/) | 16.0.1.0.2 | | An operating unit (OU) is an organizational entity part of a company [product_operating_unit](product_operating_unit/) | 16.0.1.0.1 | | Adds the concept of operating unit (OU) in products [project_operating_unit](project_operating_unit/) | 16.0.1.0.0 | [![max3903](https://github.com/max3903.png?size=30px)](https://github.com/max3903) | This module adds operating unit information to projects and tasks. +[report_qweb_operating_unit](report_qweb_operating_unit/) | 16.0.1.0.0 | | Qweb Report With Operating Unit [sales_team_operating_unit](sales_team_operating_unit/) | 16.0.1.0.0 | | Sales Team Operating Unit [stock_operating_unit](stock_operating_unit/) | 16.0.1.2.1 | | Adds the concept of operating unit (OU) in stock management diff --git a/account_operating_unit/i18n/de.po b/account_operating_unit/i18n/de.po new file mode 100644 index 0000000000..bc76b573cf --- /dev/null +++ b/account_operating_unit/i18n/de.po @@ -0,0 +1,180 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-20 17:06+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.6.2\n" + +#. module: account_operating_unit +#: model:ir.model.fields,help:account_operating_unit.field_res_company__ou_is_self_balanced +msgid "" +"Activate if your company is required to generate a balanced balance sheet " +"for each operating unit." +msgstr "" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_account_bank_statement_line +msgid "Bank Statement Line" +msgstr "Kontoauszugszeile" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_res_company +msgid "Companies" +msgstr "Unternehmen" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_journal.py:0 +#, python-format +msgid "" +"Configuration error. If defined as self-balanced at company level, the " +"operating unit is mandatory in bank journal." +msgstr "" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/res_company.py:0 +#, python-format +msgid "" +"Configuration error. Please provide an Inter-operating unit clearing " +"account." +msgstr "" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_move_line.py:0 +#, python-format +msgid "" +"Configuration error. The Company in the Move Line and in the Operating Unit " +"must be the same." +msgstr "" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_move_line.py:0 +#, python-format +msgid "" +"Configuration error. The Operating Unit in the Move Line and in the Move " +"must be the same." +msgstr "" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_move.py:0 +#, python-format +msgid "" +"Configuration error. The operating unit is mandatory for each line as the " +"operating unit has been defined as self-balanced at company level." +msgstr "" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_move.py:0 +#, python-format +msgid "" +"Configuration error. You need to define aninter-operating unit clearing " +"account in the company settings" +msgstr "" + +#. module: account_operating_unit +#: model:ir.model.fields,field_description:account_operating_unit.field_res_company__inter_ou_clearing_account_id +msgid "Inter-operating unit clearing account" +msgstr "" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_account_invoice_report +msgid "Invoices Statistics" +msgstr "Rechnungsstatistik" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_account_journal +msgid "Journal" +msgstr "Journal" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_account_move +msgid "Journal Entry" +msgstr "Journalbuchung" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_account_move_line +msgid "Journal Item" +msgstr "Buchungszeile" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_move.py:0 +#, python-format +msgid "OU-Balancing" +msgstr "Ausgleich Filiale" + +#. module: account_operating_unit +#: model:ir.model.fields,field_description:account_operating_unit.field_account_bank_statement_line__operating_unit_id +#: model:ir.model.fields,field_description:account_operating_unit.field_account_invoice_report__operating_unit_id +#: model:ir.model.fields,field_description:account_operating_unit.field_account_journal__operating_unit_id +#: model:ir.model.fields,field_description:account_operating_unit.field_account_move__operating_unit_id +#: model:ir.model.fields,field_description:account_operating_unit.field_account_move_line__operating_unit_id +#: model:ir.model.fields,field_description:account_operating_unit.field_account_payment__operating_unit_id +#: model_terms:ir.ui.view,arch_db:account_operating_unit.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:account_operating_unit.view_account_invoice_report_search +#: model_terms:ir.ui.view,arch_db:account_operating_unit.view_account_move_line_filter +#: model_terms:ir.ui.view,arch_db:account_operating_unit.view_account_payment_search +msgid "Operating Unit" +msgstr "Filiale" + +#. module: account_operating_unit +#: model:ir.model.fields,help:account_operating_unit.field_account_journal__operating_unit_id +msgid "" +"Operating Unit that will be used in payments, when this journal is used." +msgstr "" + +#. module: account_operating_unit +#: model_terms:ir.ui.view,arch_db:account_operating_unit.view_company_form +msgid "Operating Units" +msgstr "Filialen" + +#. module: account_operating_unit +#: model:ir.model.fields,field_description:account_operating_unit.field_res_company__ou_is_self_balanced +msgid "Operating Units are self-balanced" +msgstr "Filialen sind selbstausgleichend" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_account_partial_reconcile +msgid "Partial Reconcile" +msgstr "Teilweise abgestimmt" + +#. module: account_operating_unit +#: model:ir.model,name:account_operating_unit.model_account_payment +msgid "Payments" +msgstr "Zahlungen" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_move.py:0 +#, python-format +msgid "The Company in the Move and in Operating Unit must be the same." +msgstr "" + +#. module: account_operating_unit +#. odoo-python +#: code:addons/account_operating_unit/models/account_move.py:0 +#, python-format +msgid "The OU in the Move and in Journal must be the same." +msgstr "" + +#. module: account_operating_unit +#: model:ir.model.fields,help:account_operating_unit.field_account_bank_statement_line__operating_unit_id +#: model:ir.model.fields,help:account_operating_unit.field_account_move__operating_unit_id +msgid "This operating unit will be defaulted in the move lines." +msgstr "" diff --git a/analytic_operating_unit/i18n/de.po b/analytic_operating_unit/i18n/de.po new file mode 100644 index 0000000000..dbf3a1fe54 --- /dev/null +++ b/analytic_operating_unit/i18n/de.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * analytic_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-18 12:06+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.6.2\n" + +#. module: analytic_operating_unit +#: model:ir.model,name:analytic_operating_unit.model_account_analytic_account +msgid "Analytic Account" +msgstr "Kostenstelle" + +#. module: analytic_operating_unit +#: model:ir.model.fields,field_description:analytic_operating_unit.field_account_analytic_account__operating_unit_ids +msgid "Operating Units" +msgstr "Filialen" diff --git a/contract_operating_unit/README.rst b/contract_operating_unit/README.rst new file mode 100644 index 0000000000..062095fd34 --- /dev/null +++ b/contract_operating_unit/README.rst @@ -0,0 +1,87 @@ +======================= +Contract Operating Unit +======================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1c11f793a7657cbdeb268f3485de5c22909c7df4bbd56759e423e293a8c2c7a3 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Foperating--unit-lightgray.png?logo=github + :target: https://github.com/OCA/operating-unit/tree/16.0/contract_operating_unit + :alt: OCA/operating-unit +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-contract_operating_unit + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module introduces the following features: + +* Adds the Operating Unit (OU) to Contracts. + +* Security rules are defined to ensure that users can only see the Contracts of that Operating Units in which they are allowed access to. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Assign contracts to specific operating units within the company + +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow S.L. + +Contributors +~~~~~~~~~~~~ + +* Aaron Henriquez +* Kitti U. +* Pimolnat Suntian + +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/operating-unit `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_operating_unit/__init__.py b/contract_operating_unit/__init__.py new file mode 100644 index 0000000000..4b76c7b2d5 --- /dev/null +++ b/contract_operating_unit/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/contract_operating_unit/__manifest__.py b/contract_operating_unit/__manifest__.py new file mode 100644 index 0000000000..69a75d1808 --- /dev/null +++ b/contract_operating_unit/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2020 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Contract Operating Unit", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ForgeFlow S.L., Odoo Community Association (OCA)", + "website": "https://github.com/OCA/operating-unit", + "category": "Invoicing", + "depends": ["contract", "account_operating_unit"], + "data": ["views/contract_view.xml", "security/contract_security.xml"], + "installable": True, +} diff --git a/contract_operating_unit/i18n/contract_operating_unit.pot b/contract_operating_unit/i18n/contract_operating_unit.pot new file mode 100644 index 0000000000..960adf7e91 --- /dev/null +++ b/contract_operating_unit/i18n/contract_operating_unit.pot @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: contract_operating_unit +#: model:ir.model,name:contract_operating_unit.model_contract_contract +msgid "Contract" +msgstr "" + +#. module: contract_operating_unit +#: model:ir.model.fields,field_description:contract_operating_unit.field_contract_contract__operating_unit_id +#: model_terms:ir.ui.view,arch_db:contract_operating_unit.contract_contract_search_view +msgid "Operating Unit" +msgstr "" diff --git a/contract_operating_unit/i18n/de.po b/contract_operating_unit/i18n/de.po new file mode 100644 index 0000000000..c0c70c8a77 --- /dev/null +++ b/contract_operating_unit/i18n/de.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-18 12:06+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.6.2\n" + +#. module: contract_operating_unit +#: model:ir.model,name:contract_operating_unit.model_contract_contract +msgid "Contract" +msgstr "Vertrag" + +#. module: contract_operating_unit +#: model:ir.model.fields,field_description:contract_operating_unit.field_contract_contract__operating_unit_id +#: model_terms:ir.ui.view,arch_db:contract_operating_unit.contract_contract_search_view +msgid "Operating Unit" +msgstr "Filiale" diff --git a/contract_operating_unit/i18n/it.po b/contract_operating_unit/i18n/it.po new file mode 100644 index 0000000000..2aefac1b43 --- /dev/null +++ b/contract_operating_unit/i18n/it.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-08-29 10:43+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\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 5.6.2\n" + +#. module: contract_operating_unit +#: model:ir.model,name:contract_operating_unit.model_contract_contract +msgid "Contract" +msgstr "Contatto" + +#. module: contract_operating_unit +#: model:ir.model.fields,field_description:contract_operating_unit.field_contract_contract__operating_unit_id +#: model_terms:ir.ui.view,arch_db:contract_operating_unit.contract_contract_search_view +msgid "Operating Unit" +msgstr "Unità operativa" diff --git a/contract_operating_unit/models/__init__.py b/contract_operating_unit/models/__init__.py new file mode 100644 index 0000000000..99a5468ac8 --- /dev/null +++ b/contract_operating_unit/models/__init__.py @@ -0,0 +1 @@ +from . import contract diff --git a/contract_operating_unit/models/contract.py b/contract_operating_unit/models/contract.py new file mode 100644 index 0000000000..4626a3d9ab --- /dev/null +++ b/contract_operating_unit/models/contract.py @@ -0,0 +1,21 @@ +# Copyright 2020 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ContractContract(models.Model): + + _inherit = "contract.contract" + + operating_unit_id = fields.Many2one( + "operating.unit", + "Operating Unit", + default=lambda self: self.env["res.users"].operating_unit_default_get(), + ) + + def _prepare_invoice(self, date_invoice, journal=None): + invoice_vals = super()._prepare_invoice(date_invoice, journal=journal) + if self.operating_unit_id: + invoice_vals["operating_unit_id"] = self.operating_unit_id.id + return invoice_vals diff --git a/contract_operating_unit/readme/CONTRIBUTORS.rst b/contract_operating_unit/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..59af30aacf --- /dev/null +++ b/contract_operating_unit/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Aaron Henriquez +* Kitti U. +* Pimolnat Suntian diff --git a/contract_operating_unit/readme/DESCRIPTION.rst b/contract_operating_unit/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..79e7fde55f --- /dev/null +++ b/contract_operating_unit/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module introduces the following features: + +* Adds the Operating Unit (OU) to Contracts. + +* Security rules are defined to ensure that users can only see the Contracts of that Operating Units in which they are allowed access to. diff --git a/contract_operating_unit/readme/USAGE.rst b/contract_operating_unit/readme/USAGE.rst new file mode 100644 index 0000000000..f4c95c254e --- /dev/null +++ b/contract_operating_unit/readme/USAGE.rst @@ -0,0 +1 @@ +Assign contracts to specific operating units within the company diff --git a/contract_operating_unit/security/contract_security.xml b/contract_operating_unit/security/contract_security.xml new file mode 100644 index 0000000000..69858dcec6 --- /dev/null +++ b/contract_operating_unit/security/contract_security.xml @@ -0,0 +1,17 @@ + + + + + + ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])] + Contracts from allowed operating units + + + + + + + + diff --git a/contract_operating_unit/static/description/icon.png b/contract_operating_unit/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/contract_operating_unit/static/description/icon.png differ diff --git a/contract_operating_unit/static/description/index.html b/contract_operating_unit/static/description/index.html new file mode 100644 index 0000000000..37af476e02 --- /dev/null +++ b/contract_operating_unit/static/description/index.html @@ -0,0 +1,434 @@ + + + + + +Contract Operating Unit + + + +
+

Contract Operating Unit

+ + +

Beta License: AGPL-3 OCA/operating-unit Translate me on Weblate Try me on Runboat

+

This module introduces the following features:

+
    +
  • Adds the Operating Unit (OU) to Contracts.
  • +
  • Security rules are defined to ensure that users can only see the Contracts of that Operating Units in which they are allowed access to.
  • +
+

Table of contents

+ +
+

Usage

+

Assign contracts to specific operating units within the company

+
+
+

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 +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow S.L.
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/contract_operating_unit/tests/__init__.py b/contract_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..fdd2b1a354 --- /dev/null +++ b/contract_operating_unit/tests/__init__.py @@ -0,0 +1 @@ +from . import test_contract_operating_unit diff --git a/contract_operating_unit/tests/test_contract_operating_unit.py b/contract_operating_unit/tests/test_contract_operating_unit.py new file mode 100644 index 0000000000..918455afa6 --- /dev/null +++ b/contract_operating_unit/tests/test_contract_operating_unit.py @@ -0,0 +1,92 @@ +# Copyright 2020 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.addons.contract.tests.test_contract import TestContractBase + + +class TestContractOperatingUnit(TestContractBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + + cls.res_users_model = cls.env["res.users"] + + cls.company = cls.env.ref("base.main_company") + cls.grp_contract_manager = cls.env.ref("account.group_account_manager") + cls.contract_model = cls.env["contract.contract"] + cls.group_user = cls.env.ref("base.group_user") + + # Main Operating Unit + cls.ou1 = cls.env.ref("operating_unit.main_operating_unit") + # B2C Operating Unit + cls.b2c = cls.env.ref("operating_unit.b2c_operating_unit") + + # Create Users + cls.user1 = cls._create_user( + "User_1", + [cls.grp_contract_manager, cls.group_user], + cls.company, + [cls.ou1, cls.b2c], + ) + cls.user2 = cls._create_user( + "User_2", + [cls.grp_contract_manager, cls.group_user], + cls.company, + [cls.b2c], + ) + cls.contract.operating_unit_id = cls.ou1 + cls.contract2.operating_unit_id = cls.b2c + + @classmethod + def _create_user(cls, login, groups, company, operating_units, context=None): + """Creates a user.""" + group_ids = [group.id for group in groups] + user = cls.res_users_model.create( + { + "name": "Test Contract User", + "login": login, + "password": "demo", + "email": "example@yourcompany.com", + "company_id": company.id, + "company_ids": [(4, company.id)], + "operating_unit_ids": [(4, ou.id) for ou in operating_units], + "groups_id": [(6, 0, group_ids)], + } + ) + return user + + def test_contract_ou(self): + """Test Contract Operating Unit""" + # User 2 is only assigned to Operating Unit B2C, and cannot + # Access Contract records of Main Operating Unit. + record = self.contract_model.with_user(self.user2.id).search( + [ + ("id", "=", self.contract.id), + ("operating_unit_id", "=", self.ou1.id), + ] + ) + self.assertFalse( + record, + "User 2 should not have access to OU %s" % self.ou1.name, + ) + + def test_default(self): + """Test that the user's OU is used when creating a contract""" + contract = ( + self.env["contract.contract"] + .with_user(self.user1) + .create( + { + "name": "A contract", + "partner_id": self.env["res.partner"] + .search([], order="customer_rank desc", limit=1) + .id, + } + ) + ) + self.assertEqual(contract.operating_unit_id, self.ou1) + + def test_contract_invoice(self): + """Test that invoices from contracts get the contract's OU assigned""" + invoice = self.contract2._recurring_create_invoice() + self.assertEqual(invoice.operating_unit_id, self.b2c) diff --git a/contract_operating_unit/views/contract_view.xml b/contract_operating_unit/views/contract_view.xml new file mode 100644 index 0000000000..13a4715059 --- /dev/null +++ b/contract_operating_unit/views/contract_view.xml @@ -0,0 +1,81 @@ + + + + + + contract.contract form view (in contract_payment_mode) + contract.contract + + + + + + + + + + + contract.contract tree view (in contract_payment_mode) + contract.contract + + + + + + + + + + + contract.contract search view (in contract_payment_mode) + contract.contract + + + + + + + + + + + + + + + contract.contract supplier form view (in contract_payment_mode) + contract.contract + 18 + + + + + + + + + diff --git a/hr_operating_unit/i18n/de.po b/hr_operating_unit/i18n/de.po new file mode 100644 index 0000000000..79b8c4802a --- /dev/null +++ b/hr_operating_unit/i18n/de.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-18 12:06+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.6.2\n" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_hr_employee_base +msgid "Basic Employee" +msgstr "Basismitarbeiter" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__default_operating_unit_id +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__default_operating_unit_id +#: model_terms:ir.ui.view,arch_db:hr_operating_unit.view_employee_filter +msgid "Default Operating Unit" +msgstr "Standard-Filiale" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_operating_unit__employee_ids +msgid "Employees Allowed" +msgstr "Zulässige Mitarbeiter" + +#. module: hr_operating_unit +#: model:ir.model,name:hr_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "Filiale" + +#. module: hr_operating_unit +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_base__operating_unit_ids +#: model:ir.model.fields,field_description:hr_operating_unit.field_hr_employee_public__operating_unit_ids +msgid "Operating Units" +msgstr "Filialen" diff --git a/operating_unit/i18n/de.po b/operating_unit/i18n/de.po new file mode 100644 index 0000000000..6fb2634a81 --- /dev/null +++ b/operating_unit/i18n/de.po @@ -0,0 +1,148 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-18 12:06+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.6.2\n" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__active +msgid "Active" +msgstr "Aktiv" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_res_users__operating_unit_ids +msgid "Allowed Operating Units" +msgstr "Zulässige Filialen" + +#. module: operating_unit +#: model_terms:ir.actions.act_window,help:operating_unit.action_operating_unit_tree +msgid "Click to start a new Operating Unit." +msgstr "Klicken, um eine neue Filiale anzulegen." + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__code +#: model_terms:ir.ui.view,arch_db:operating_unit.view_operating_unit_search +msgid "Code" +msgstr "Filialnummer" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__company_id +msgid "Company" +msgstr "Unternehmen" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__create_uid +msgid "Created by" +msgstr "Erstellt von" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__create_date +msgid "Created on" +msgstr "Erstellt am" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_res_users__default_operating_unit_id +msgid "Default Operating Unit" +msgstr "Standard-Filiale" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__display_name +msgid "Display Name" +msgstr "Anzeigename" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__id +msgid "ID" +msgstr "ID" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit____last_update +msgid "Last Modified on" +msgstr "Zuletzt geändert am" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__write_uid +msgid "Last Updated by" +msgstr "Zuletzt aktualisiert von" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__write_date +msgid "Last Updated on" +msgstr "Zuletzt aktualisiert am" + +#. module: operating_unit +#: model:res.groups,name:operating_unit.group_manager_operating_unit +msgid "Manager of Operating Units" +msgstr "Manager von Filialen" + +#. module: operating_unit +#: model:res.groups,name:operating_unit.group_multi_operating_unit +msgid "Multiple Operating Unit" +msgstr "Mehrere Filialen" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__name +msgid "Name" +msgstr "Name" + +#. module: operating_unit +#: model:ir.model,name:operating_unit.model_operating_unit +#: model_terms:ir.ui.view,arch_db:operating_unit.view_operating_unit_form +#: model_terms:ir.ui.view,arch_db:operating_unit.view_operating_unit_search +msgid "Operating Unit" +msgstr "Filiale" + +#. module: operating_unit +#: model:ir.actions.act_window,name:operating_unit.action_operating_unit_tree +#: model:ir.model.fields,field_description:operating_unit.field_res_users__assigned_operating_unit_ids +#: model:ir.ui.menu,name:operating_unit.menu_action_operating_unit_tree +#: model_terms:ir.ui.view,arch_db:operating_unit.view_users_form +msgid "Operating Units" +msgstr "Filialen" + +#. module: operating_unit +#: model:ir.module.category,name:operating_unit.module_operating_units +msgid "Operating Units Group" +msgstr "Filialen" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__partner_id +msgid "Partner" +msgstr "Kontakt" + +#. module: operating_unit +#: model_terms:ir.ui.view,arch_db:operating_unit.view_operating_unit_search +msgid "Search Operating Unit" +msgstr "Suche Filialen" + +#. module: operating_unit +#: model:ir.model.constraint,message:operating_unit.constraint_operating_unit_code_company_uniq +msgid "The code of the operating unit must be unique per company!" +msgstr "Die Filialnummer einer Filiale muss pro Unternehmen eindeutig sein!" + +#. module: operating_unit +#: model:ir.model.constraint,message:operating_unit.constraint_operating_unit_name_company_uniq +msgid "The name of the operating unit must be unique per company!" +msgstr "Der Name einer Filiale muss pro Unternehmen eindeutig sein!" + +#. module: operating_unit +#: model:ir.model,name:operating_unit.model_res_users +msgid "User" +msgstr "Benutzer" + +#. module: operating_unit +#: model:ir.model.fields,field_description:operating_unit.field_operating_unit__user_ids +msgid "Users Allowed" +msgstr "Zulässige Benutzer" diff --git a/project_operating_unit/i18n/de.po b/project_operating_unit/i18n/de.po new file mode 100644 index 0000000000..8169077405 --- /dev/null +++ b/project_operating_unit/i18n/de.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * project_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: de\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: project_operating_unit +#: model:ir.model.fields,field_description:project_operating_unit.field_project_project__operating_unit_id +#: model:ir.model.fields,field_description:project_operating_unit.field_project_task__operating_unit_id +#: model_terms:ir.ui.view,arch_db:project_operating_unit.project_group_by_ou +msgid "Operating Unit" +msgstr "" + +#. module: project_operating_unit +#: model:ir.model,name:project_operating_unit.model_project_project +msgid "Project" +msgstr "" + +#. module: project_operating_unit +#: model:ir.model,name:project_operating_unit.model_project_task +msgid "Task" +msgstr "" diff --git a/purchase_operating_unit/README.rst b/purchase_operating_unit/README.rst new file mode 100644 index 0000000000..c579c23cd9 --- /dev/null +++ b/purchase_operating_unit/README.rst @@ -0,0 +1,97 @@ +================================= +Operating Unit in Purchase Orders +================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:21e7d9b3681736a1b5892f6dbda51bc620acedda3590df11bf4ed3e7cb3174be + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github + :target: https://github.com/OCA/operating-unit/tree/16.0/purchase_operating_unit + :alt: OCA/operating-unit +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-purchase_operating_unit + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module introduces the following features: + +- It introduces the operating unit to the purchase order. +- The operating unit is copied to the invoice. +- It implements user's security rules. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +#. Create a PO: the Default Operating Unit is assigned to the PO. If you want, + you can change to another Operating Unit. +#. Validate the PO: the Operating Unit is propagated to the Invoices. +#. From the invoice, it is not possible to change the Operating Unit, it has to + be the same as the one of the PO. + +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow +* Serpent Consulting Services Pvt. Ltd. + +Contributors +~~~~~~~~~~~~ + +* Jordi Ballester Alomar +* Aaron Henriquez +* Sudhir Arya +* Nicola Studer +* Nikul Chaudhary +* Kitti U. +* Alan Ramos +* Nopparit S. + +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/operating-unit `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_operating_unit/__init__.py b/purchase_operating_unit/__init__.py new file mode 100644 index 0000000000..8668eed3d1 --- /dev/null +++ b/purchase_operating_unit/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import models +from . import report diff --git a/purchase_operating_unit/__manifest__.py b/purchase_operating_unit/__manifest__.py new file mode 100644 index 0000000000..8163d281e7 --- /dev/null +++ b/purchase_operating_unit/__manifest__.py @@ -0,0 +1,27 @@ +# © 2015-17 ForgeFlow S.L. +# - Jordi Ballester Alomar +# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Operating Unit in Purchase Orders", + "summary": "Adds the concecpt of operating unit (OU) in purchase order " + "management", + "version": "16.0.1.0.0", + "author": "ForgeFlow, " + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/operating-unit", + "category": "Purchase Management", + "depends": ["purchase", "account_operating_unit"], + "license": "LGPL-3", + "data": [ + "security/purchase_security.xml", + "report/purchase_report_view.xml", + "views/purchase_order_view.xml", + "views/purchase_order_line_view.xml", + "views/account_move_view.xml", + ], + "demo": ["demo/purchase_order_demo.xml"], + "installable": True, +} diff --git a/purchase_operating_unit/demo/purchase_order_demo.xml b/purchase_operating_unit/demo/purchase_order_demo.xml new file mode 100644 index 0000000000..af80cc9aac --- /dev/null +++ b/purchase_operating_unit/demo/purchase_order_demo.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purchase_operating_unit/i18n/purchase_operating_unit.pot b/purchase_operating_unit/i18n/purchase_operating_unit.pot new file mode 100644 index 0000000000..93b9ca291c --- /dev/null +++ b/purchase_operating_unit/i18n/purchase_operating_unit.pot @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: purchase_operating_unit +#: code:addons/purchase_operating_unit/models/purchase_order.py:0 +#, python-format +msgid "" +"Configuration error. The Company in the Purchase Order and in the Operating " +"Unit must be the same." +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model,name:purchase_operating_unit.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model,name:purchase_operating_unit.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model.fields,field_description:purchase_operating_unit.field_purchase_order__operating_unit_id +#: model:ir.model.fields,field_description:purchase_operating_unit.field_purchase_order_line__operating_unit_id +#: model:ir.model.fields,field_description:purchase_operating_unit.field_purchase_report__operating_unit_id +#: model_terms:ir.ui.view,arch_db:purchase_operating_unit.purchase_order_line_search +#: model_terms:ir.ui.view,arch_db:purchase_operating_unit.view_purchase_order_filter +#: model_terms:ir.ui.view,arch_db:purchase_operating_unit.view_purchase_order_search +msgid "Operating Unit" +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model,name:purchase_operating_unit.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model,name:purchase_operating_unit.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model.fields,field_description:purchase_operating_unit.field_account_bank_statement_line__purchase_ou_domain +#: model:ir.model.fields,field_description:purchase_operating_unit.field_account_move__purchase_ou_domain +#: model:ir.model.fields,field_description:purchase_operating_unit.field_account_payment__purchase_ou_domain +msgid "Purchase Ou Domain" +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model,name:purchase_operating_unit.model_purchase_report +msgid "Purchase Report" +msgstr "" + +#. module: purchase_operating_unit +#: model:ir.model.fields,field_description:purchase_operating_unit.field_purchase_order__requesting_operating_unit_id +msgid "Requesting Operating Unit" +msgstr "" + +#. module: purchase_operating_unit +#: code:addons/purchase_operating_unit/models/account_move.py:0 +#, python-format +msgid "" +"The operating unit of the purchase order must be the same as in the " +"associated invoices." +msgstr "" diff --git a/purchase_operating_unit/models/__init__.py b/purchase_operating_unit/models/__init__.py new file mode 100644 index 0000000000..105a10e6f7 --- /dev/null +++ b/purchase_operating_unit/models/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import purchase_order +from . import account_move diff --git a/purchase_operating_unit/models/account_move.py b/purchase_operating_unit/models/account_move.py new file mode 100644 index 0000000000..17e4933d6e --- /dev/null +++ b/purchase_operating_unit/models/account_move.py @@ -0,0 +1,55 @@ +# Copyright 2015-17 ForgeFlow S.L. +# - Jordi Ballester Alomar +# Copyright 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + + +class AccountMove(models.Model): + _inherit = "account.move" + + purchase_ou_domain = fields.Many2many( + comodel_name="purchase.order", compute="_compute_purchase_ou_domain" + ) + + # Load all unsold PO lines + @api.onchange("purchase_vendor_bill_id", "purchase_id") + def _onchange_purchase_auto_complete(self): + """ + Override to add Operating Unit from Purchase Order to Invoice. + """ + purchase_id = self.purchase_id + if self.purchase_vendor_bill_id.purchase_order_id: + purchase_id = self.purchase_vendor_bill_id.purchase_order_id + if purchase_id and purchase_id.operating_unit_id: + # Assign OU from PO to Invoice + self.operating_unit_id = purchase_id.operating_unit_id.id + return super()._onchange_purchase_auto_complete() + + @api.depends("operating_unit_id") + def _compute_purchase_ou_domain(self): + for rec in self: + rec.purchase_ou_domain = ( + self.env["purchase.order"] + .sudo() + .search([("operating_unit_id", "=", rec.operating_unit_id.id)]) + ) + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + @api.constrains("operating_unit_id", "purchase_line_id") + def _check_invoice_ou(self): + for line in self: + if ( + line.purchase_line_id + and line.operating_unit_id != line.purchase_line_id.operating_unit_id + ): + raise ValidationError( + _( + "The operating unit of the purchase order must " + "be the same as in the associated invoices." + ) + ) diff --git a/purchase_operating_unit/models/purchase_order.py b/purchase_operating_unit/models/purchase_order.py new file mode 100644 index 0000000000..07810dfe0a --- /dev/null +++ b/purchase_operating_unit/models/purchase_order.py @@ -0,0 +1,62 @@ +# Copyright 2015-17 ForgeFlow S.L. +# - Jordi Ballester Alomar +# Copyright 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + READONLY_STATES = { + "purchase": [("readonly", True)], + "done": [("readonly", True)], + "cancel": [("readonly", True)], + } + + operating_unit_id = fields.Many2one( + comodel_name="operating.unit", + string="Operating Unit", + states=READONLY_STATES, + default=lambda self: ( + self.env["res.users"].operating_unit_default_get(self.env.uid) + ), + ) + + requesting_operating_unit_id = fields.Many2one( + comodel_name="operating.unit", + string="Requesting Operating Unit", + states=READONLY_STATES, + default=lambda self: ( + self.env["res.users"].operating_unit_default_get(self.env.uid) + ), + ) + + @api.constrains("operating_unit_id", "company_id") + def _check_company_operating_unit(self): + for record in self: + if ( + record.company_id + and record.operating_unit_id + and record.company_id != record.operating_unit_id.company_id + ): + raise ValidationError( + _( + "Configuration error. The Company in the Purchase Order " + "and in the Operating Unit must be the same." + ) + ) + + def _prepare_invoice(self): + invoice_vals = super()._prepare_invoice() + invoice_vals["operating_unit_id"] = self.operating_unit_id.id + return invoice_vals + + +class PurchaseOrderLine(models.Model): + _inherit = "purchase.order.line" + + operating_unit_id = fields.Many2one( + related="order_id.operating_unit_id", string="Operating Unit" + ) diff --git a/purchase_operating_unit/readme/CONTRIBUTORS.rst b/purchase_operating_unit/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..4363b1d574 --- /dev/null +++ b/purchase_operating_unit/readme/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ +* Jordi Ballester Alomar +* Aaron Henriquez +* Sudhir Arya +* Nicola Studer +* Nikul Chaudhary +* Kitti U. +* Alan Ramos +* Nopparit S. diff --git a/purchase_operating_unit/readme/DESCRIPTION.rst b/purchase_operating_unit/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..10d7911fa2 --- /dev/null +++ b/purchase_operating_unit/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module introduces the following features: + +- It introduces the operating unit to the purchase order. +- The operating unit is copied to the invoice. +- It implements user's security rules. diff --git a/purchase_operating_unit/readme/USAGE.rst b/purchase_operating_unit/readme/USAGE.rst new file mode 100644 index 0000000000..fb2deacb52 --- /dev/null +++ b/purchase_operating_unit/readme/USAGE.rst @@ -0,0 +1,5 @@ +#. Create a PO: the Default Operating Unit is assigned to the PO. If you want, + you can change to another Operating Unit. +#. Validate the PO: the Operating Unit is propagated to the Invoices. +#. From the invoice, it is not possible to change the Operating Unit, it has to + be the same as the one of the PO. diff --git a/purchase_operating_unit/report/__init__.py b/purchase_operating_unit/report/__init__.py new file mode 100644 index 0000000000..0be1a37c09 --- /dev/null +++ b/purchase_operating_unit/report/__init__.py @@ -0,0 +1,2 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import purchase_report diff --git a/purchase_operating_unit/report/purchase_report.py b/purchase_operating_unit/report/purchase_report.py new file mode 100644 index 0000000000..9193741115 --- /dev/null +++ b/purchase_operating_unit/report/purchase_report.py @@ -0,0 +1,24 @@ +# Copyright 2023 Ecosoft Co., Ltd (http://ecosoft.co.th/) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import fields, models + + +class PurchaseReport(models.Model): + _inherit = "purchase.report" + + operating_unit_id = fields.Many2one( + comodel_name="operating.unit", + string="Operating Unit", + readonly=True, + ) + + def _select(self): + select_str = super()._select() + select_str += """, po.operating_unit_id""" + return select_str + + def _group_by(self): + group_by_str = super()._group_by() + group_by_str += """, po.operating_unit_id""" + return group_by_str diff --git a/purchase_operating_unit/report/purchase_report_view.xml b/purchase_operating_unit/report/purchase_report_view.xml new file mode 100644 index 0000000000..db99c04d73 --- /dev/null +++ b/purchase_operating_unit/report/purchase_report_view.xml @@ -0,0 +1,24 @@ + + + + report.purchase.order.search + purchase.report + + + + + + + + + + + diff --git a/purchase_operating_unit/security/purchase_security.xml b/purchase_operating_unit/security/purchase_security.xml new file mode 100644 index 0000000000..970d195ac3 --- /dev/null +++ b/purchase_operating_unit/security/purchase_security.xml @@ -0,0 +1,31 @@ + + + + + + + + + ['|',('operating_unit_id','=',False),('operating_unit_id','in', user.operating_unit_ids.ids)] + PO's from allowed operating units + + + + + + + + + ['|',('operating_unit_id','=',False),('operating_unit_id','in', user.operating_unit_ids.ids)] + PO lines from allowed operating units + + + + + + + diff --git a/purchase_operating_unit/static/description/icon.png b/purchase_operating_unit/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/purchase_operating_unit/static/description/icon.png differ diff --git a/purchase_operating_unit/static/description/index.html b/purchase_operating_unit/static/description/index.html new file mode 100644 index 0000000000..a8a8fd6029 --- /dev/null +++ b/purchase_operating_unit/static/description/index.html @@ -0,0 +1,447 @@ + + + + + +Operating Unit in Purchase Orders + + + +
+

Operating Unit in Purchase Orders

+ + +

Beta License: LGPL-3 OCA/operating-unit Translate me on Weblate Try me on Runboat

+

This module introduces the following features:

+
    +
  • It introduces the operating unit to the purchase order.
  • +
  • The operating unit is copied to the invoice.
  • +
  • It implements user’s security rules.
  • +
+

Table of contents

+ +
+

Usage

+
    +
  1. Create a PO: the Default Operating Unit is assigned to the PO. If you want, +you can change to another Operating Unit.
  2. +
  3. Validate the PO: the Operating Unit is propagated to the Invoices.
  4. +
  5. From the invoice, it is not possible to change the Operating Unit, it has to +be the same as the one of the PO.
  6. +
+
+
+

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 +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
  • Serpent Consulting Services Pvt. Ltd.
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/purchase_operating_unit/tests/__init__.py b/purchase_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..9c86acd517 --- /dev/null +++ b/purchase_operating_unit/tests/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import test_purchase_operating_unit +from . import test_po_security diff --git a/purchase_operating_unit/tests/test_po_security.py b/purchase_operating_unit/tests/test_po_security.py new file mode 100644 index 0000000000..ae0a82f5e8 --- /dev/null +++ b/purchase_operating_unit/tests/test_po_security.py @@ -0,0 +1,40 @@ +# Copyright 2015-17 ForgeFlow S.L. +# - Jordi Ballester Alomar +# Copyright 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import test_purchase_operating_unit as test_po_ou # noqa + + +class TestPoSecurity(test_po_ou.TestPurchaseOperatingUnit): + def test_po_ou_security(self): + """Test Security of Purchase Operating Unit""" + # User 2 is only assigned to Operating Unit 2, and cannot list + # purchase orders from Operating Unit 1. + po_ids = ( + self.PurchaseOrder.with_user(self.user2_id) + .search([("operating_unit_id", "=", self.ou1.id)]) + .ids + ) + self.assertEqual(po_ids, []) + # User 2 cannot list the invoice that was created from PO 1 + invoice_ids = ( + self.AccountInvoice.with_user(self.user2_id) + .search([("id", "=", self.invoice.id)]) + .ids + ) + self.assertEqual(invoice_ids, []) + # User 1 is assigned to Operating Unit 1, and can list + # the purchase order 1 from Operating Unit 1. + po_ids = ( + self.PurchaseOrder.with_user(self.user1_id) + .search([("operating_unit_id", "=", self.ou1.id)]) + .ids + ) + self.assertNotEqual(po_ids, []) + # User 1 can list the invoice that was created from PO 2 + invoice_ids = ( + self.AccountInvoice.with_user(self.user1_id) + .search([("id", "=", self.invoice.id)]) + .ids + ) + self.assertNotEqual(invoice_ids, []) diff --git a/purchase_operating_unit/tests/test_purchase_operating_unit.py b/purchase_operating_unit/tests/test_purchase_operating_unit.py new file mode 100644 index 0000000000..3cb596fd8e --- /dev/null +++ b/purchase_operating_unit/tests/test_purchase_operating_unit.py @@ -0,0 +1,143 @@ +# Copyright 2015-17 ForgeFlow S.L. +# - Jordi Ballester Alomar +# Copyright 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +import time + +from odoo.exceptions import ValidationError +from odoo.tests import Form, common +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT + + +class TestPurchaseOperatingUnit(common.TransactionCase): + def setUp(self): + super().setUp() + self.ResUsers = self.env["res.users"] + self.PurchaseOrder = self.env["purchase.order"] + self.AccountInvoice = self.env["account.move"] + self.AccountAccount = self.env["account.account"] + # company + self.company = self.env.ref("base.main_company") + # groups + self.group_purchase_user = self.env.ref("purchase.group_purchase_user") + # Main Operating Unit + self.ou1 = self.env.ref("operating_unit.main_operating_unit") + # B2B Operating Unit + self.b2b = self.env.ref("operating_unit.b2b_operating_unit") + # Partner + self.partner1 = self.env.ref("base.res_partner_1") + # Products + self.product1 = self.env.ref("product.product_product_7") + self.product2 = self.env.ref("product.product_product_9") + self.product3 = self.env.ref("product.product_product_11") + # Account + payable_acc_type = self.env.ref("account.data_account_type_payable").id + self.account = self.AccountAccount.search( + [("user_type_id", "=", payable_acc_type)], limit=1 + ) + # Create users + self.user1_id = self._create_user( + "user_1", + [self.group_purchase_user], + self.company, + [self.ou1], + ) + self.user2_id = self._create_user( + "user_2", + [self.group_purchase_user], + self.company, + [self.b2b], + ) + self.purchase1 = self._create_purchase( + self.user1_id, + [(self.product1, 1000), (self.product2, 500), (self.product3, 800)], + ) + self.purchase1.with_user(self.user1_id).button_confirm() + self.invoice = self._create_invoice(self.purchase1, self.partner1, self.account) + + def _create_user(self, login, groups, company, operating_units): + """Create a user.""" + group_ids = [group.id for group in groups] + user = self.ResUsers.with_context(**{"no_reset_password": True}).create( + { + "name": "Chicago Purchase User", + "login": login, + "password": "demo", + "email": "chicago@yourcompany.com", + "company_id": company.id, + "company_ids": [(4, company.id)], + "operating_unit_ids": [(4, ou.id) for ou in operating_units], + "groups_id": [(6, 0, group_ids)], + } + ) + return user.id + + def _create_purchase(self, user_id, line_products): + """Create a purchase order. + ``line_products`` is a list of tuple [(product, qty)] + """ + lines = [] + for product, qty in line_products: + line_values = { + "name": product.name, + "product_id": product.id, + "product_qty": qty, + "product_uom": product.uom_id.id, + "price_unit": 50, + "date_planned": time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), + } + lines.append((0, 0, line_values)) + purchase = self.PurchaseOrder.with_user(user_id).create( + { + "operating_unit_id": self.ou1.id, + "requesting_operating_unit_id": self.ou1.id, + "partner_id": self.partner1.id, + "order_line": lines, + "company_id": self.company.id, + } + ) + return purchase + + def _create_invoice(self, purchase, partner, account): + """Create a vendor invoice for the purchase order.""" + invoice_vals = { + "purchase_id": purchase.id, + "partner_id": partner.id, + "move_type": "in_invoice", + } + purchase_context = { + "active_id": purchase.id, + "active_ids": purchase.ids, + "active_model": "purchase.order", + } + res = ( + self.env["account.move"] + .with_context(**purchase_context) + .create(invoice_vals) + ) + return res + + def test_01_purchase_operating_unit(self): + self.purchase1.button_cancel() + self.purchase1.button_draft() + # Check change operating unit in purchase + with self.assertRaises(ValidationError): + self.b2b.company_id = False + with Form(self.purchase1) as po: + po.operating_unit_id = self.b2b + self.purchase1.with_user(self.user1_id).button_confirm() + # Create Vendor Bill + f = Form(self.env["account.move"].with_context(default_move_type="in_invoice")) + f.partner_id = self.purchase1.partner_id + f.purchase_id = self.purchase1 + invoice = f.save() + self.assertEqual(invoice.operating_unit_id, self.purchase1.operating_unit_id) + self.assertEqual( + invoice.invoice_line_ids[0].operating_unit_id, + invoice.invoice_line_ids[0].purchase_line_id.operating_unit_id, + ) + # Check change operating unit in invoice line != purchase line, + # it should error. + with self.assertRaises(ValidationError): + with Form(invoice.invoice_line_ids[0]) as line: + line.operating_unit_id = self.b2b diff --git a/purchase_operating_unit/views/account_move_view.xml b/purchase_operating_unit/views/account_move_view.xml new file mode 100644 index 0000000000..028c677b79 --- /dev/null +++ b/purchase_operating_unit/views/account_move_view.xml @@ -0,0 +1,17 @@ + + + + + account.move.form.inherit + account.move + + + + [('id', 'in', purchase_ou_domain)] + + + + + + + diff --git a/purchase_operating_unit/views/purchase_order_line_view.xml b/purchase_operating_unit/views/purchase_order_line_view.xml new file mode 100644 index 0000000000..32c4b0b2d3 --- /dev/null +++ b/purchase_operating_unit/views/purchase_order_line_view.xml @@ -0,0 +1,50 @@ + + + + purchase_order_line_tree + purchase.order.line + + + + + + + + + purchase_order_line_form + purchase.order.line + + + + + + + + + purchase_order_line_search + purchase.order.line + + + + + + + + + + + diff --git a/purchase_operating_unit/views/purchase_order_view.xml b/purchase_operating_unit/views/purchase_order_view.xml new file mode 100644 index 0000000000..97ceea8898 --- /dev/null +++ b/purchase_operating_unit/views/purchase_order_view.xml @@ -0,0 +1,62 @@ + + + + purchase_order_tree + purchase.order + + + + + + + + + purchase_order_form + purchase.order + + + + + + + + operating_unit.group_multi_operating_unit + {'default_state': 'draft', 'operating_unit_id': operating_unit_id} + + + + + view_purchase_order_filter + purchase.order + + + + + + + + + + + diff --git a/report_qweb_operating_unit/README.rst b/report_qweb_operating_unit/README.rst new file mode 100644 index 0000000000..27b2a887cb --- /dev/null +++ b/report_qweb_operating_unit/README.rst @@ -0,0 +1,81 @@ +=============================== +Qweb Report With Operating Unit +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d2833f869026e1d9d22049e1610f1f91ec5a63ca0cb52b5934c6c66c29fe326d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github + :target: https://github.com/OCA/operating-unit/tree/16.0/report_qweb_operating_unit + :alt: OCA/operating-unit +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-report_qweb_operating_unit + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to use custom operating unit headers for any report +in Odoo + +**Table of contents** + +.. contents:: + :local: + +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ForgeFlow S.L. +* Serpent Consulting Services Pvt. Ltd. + +Contributors +------------ + +- ForgeFlow S.L. +- Serpent Consulting Services Pvt. Ltd. +- Jarsa Sistemas +- Juany Davila + +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/operating-unit `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_qweb_operating_unit/__init__.py b/report_qweb_operating_unit/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/report_qweb_operating_unit/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/report_qweb_operating_unit/__manifest__.py b/report_qweb_operating_unit/__manifest__.py new file mode 100644 index 0000000000..dba1972fed --- /dev/null +++ b/report_qweb_operating_unit/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2017 ForgeFlow S.L. +# Copyright 2017 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Qweb Report With Operating Unit", + "version": "16.0.1.0.0", + "category": "Reports/Qweb", + "license": "LGPL-3", + "author": "ForgeFlow S.L., " + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/operating-unit", + "depends": ["operating_unit"], + "data": ["views/operating_unit_view.xml", "views/report_qweb_operating_unit.xml"], + "installable": True, +} diff --git a/report_qweb_operating_unit/i18n/es_MX.po b/report_qweb_operating_unit/i18n/es_MX.po new file mode 100644 index 0000000000..a79792c2d3 --- /dev/null +++ b/report_qweb_operating_unit/i18n/es_MX.po @@ -0,0 +1,181 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-02-19 16:13+0000\n" +"Last-Translator: Jesús Alan Ramos Rodríguez \n" +"Language-Team: none\n" +"Language: es_MX\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: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Operating Unit address block" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Operating unit details block" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Company tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Contains the operating unit address." +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Contains the operating unit details." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__report_footer +msgid "Footer text displayed at the bottom of all reports." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__operating_unit_details +msgid "Header text displayed at the top of all reports." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__is_operating_unit_details_empty +msgid "Is Operating Unit Details Empty" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Logo" +msgstr "Logo" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "" +"Operating\n" +" Unit tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model,name:report_qweb_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__operating_unit_details +msgid "Operating Unit Details" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__report_header +msgid "Operating Unit Tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +msgid "Operating Unit tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__report_header +msgid "" +"Operating Unit tagline, which is included in a printed document's header or " +"footer (depending on the selected layout)." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__report_footer +msgid "Report Footer" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.view_operating_unit_form +msgid "Report Layout" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Tax ID" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "US12345671" +msgstr "" + +#~ msgid "" +#~ "" +#~ msgstr "" +#~ "" + +#~ msgid "" +#~ "" +#~ msgstr "" + +#~ msgid "" +#~ "" +#~ msgstr "" +#~ "" + +#~ msgid "" +#~ "" +#~ msgstr "" +#~ "" + +#~ msgid "Email:" +#~ msgstr "Correo electrónico:" + +#~ msgid "Mail:" +#~ msgstr "Correo electrónico:" + +#~ msgid "Phone:" +#~ msgstr "Teléfono:" + +#~ msgid "Tel:" +#~ msgstr "Tel:" + +#~ msgid "Web:" +#~ msgstr "Web:" diff --git a/report_qweb_operating_unit/i18n/it.po b/report_qweb_operating_unit/i18n/it.po new file mode 100644 index 0000000000..40314ee626 --- /dev/null +++ b/report_qweb_operating_unit/i18n/it.po @@ -0,0 +1,146 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-08-31 12:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\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 5.6.2\n" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Operating Unit address block" +msgstr "Blocco indirizzo unità operativa" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Operating unit details block" +msgstr "Blocco dettagli unità operativa" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Company tagline" +msgstr "Slogan azienda" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Contains the operating unit address." +msgstr "Contiene l'indirizzo dell'unità operativa." + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Contains the operating unit details." +msgstr "Contiene i dettagli dell'unità operativa." + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__report_footer +msgid "Footer text displayed at the bottom of all reports." +msgstr "Testo in calce visualizzato in fondo al resoconto." + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__operating_unit_details +msgid "Header text displayed at the top of all reports." +msgstr "Testo testata visualizzato sulla sommità di ogni resoconto." + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__is_operating_unit_details_empty +msgid "Is Operating Unit Details Empty" +msgstr "I dettagli dell'unità operativa sono vuoti" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Logo" +msgstr "Logo" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "" +"Operating\n" +" Unit tagline" +msgstr "" +"Slogan\n" +" unità operativa" + +#. module: report_qweb_operating_unit +#: model:ir.model,name:report_qweb_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "Unità operativa" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__operating_unit_details +msgid "Operating Unit Details" +msgstr "Dettagli unità operativa" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__report_header +msgid "Operating Unit Tagline" +msgstr "Slogan unità operativa" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +msgid "Operating Unit tagline" +msgstr "Slogan unità operativa" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__report_header +msgid "" +"Operating Unit tagline, which is included in a printed document's header or " +"footer (depending on the selected layout)." +msgstr "" +"Slogan unità operativa, che è inclusa nella testata o a piè pagina del " +"documento stampato (in funzione del layout selezionato)." + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__report_footer +msgid "Report Footer" +msgstr "Piè pagina resoconto" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.view_operating_unit_form +msgid "Report Layout" +msgstr "Layout resoconto" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Tax ID" +msgstr "Partita IVA" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "US12345671" +msgstr "US12345671" diff --git a/report_qweb_operating_unit/i18n/report_qweb_operating_unit.pot b/report_qweb_operating_unit/i18n/report_qweb_operating_unit.pot new file mode 100644 index 0000000000..4cecfa05ef --- /dev/null +++ b/report_qweb_operating_unit/i18n/report_qweb_operating_unit.pot @@ -0,0 +1,139 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Operating Unit address block" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Operating unit details block" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Company tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Contains the operating unit address." +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Contains the operating unit details." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__report_footer +msgid "Footer text displayed at the bottom of all reports." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__operating_unit_details +msgid "Header text displayed at the top of all reports." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__is_operating_unit_details_empty +msgid "Is Operating Unit Details Empty" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Logo" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "" +"Operating\n" +" Unit tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model,name:report_qweb_operating_unit.model_operating_unit +msgid "Operating Unit" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__operating_unit_details +msgid "Operating Unit Details" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__report_header +msgid "Operating Unit Tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +msgid "Operating Unit tagline" +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,help:report_qweb_operating_unit.field_operating_unit__report_header +msgid "" +"Operating Unit tagline, which is included in a printed document's header or " +"footer (depending on the selected layout)." +msgstr "" + +#. module: report_qweb_operating_unit +#: model:ir.model.fields,field_description:report_qweb_operating_unit.field_operating_unit__report_footer +msgid "Report Footer" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.view_operating_unit_form +msgid "Report Layout" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "Tax ID" +msgstr "" + +#. module: report_qweb_operating_unit +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_bold_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_boxed_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_standard_ou +#: model_terms:ir.ui.view,arch_db:report_qweb_operating_unit.external_layout_striped_ou +msgid "US12345671" +msgstr "" diff --git a/report_qweb_operating_unit/models/__init__.py b/report_qweb_operating_unit/models/__init__.py new file mode 100644 index 0000000000..f5f887b83c --- /dev/null +++ b/report_qweb_operating_unit/models/__init__.py @@ -0,0 +1 @@ +from . import operating_unit diff --git a/report_qweb_operating_unit/models/operating_unit.py b/report_qweb_operating_unit/models/operating_unit.py new file mode 100644 index 0000000000..704e84a387 --- /dev/null +++ b/report_qweb_operating_unit/models/operating_unit.py @@ -0,0 +1,67 @@ +# Copyright 2024 NSI-SA +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from odoo import api, fields, models +from odoo.tools import html2plaintext + + +class OperatingUnit(models.Model): + _inherit = "operating.unit" + + report_header = fields.Html( + string="Operating Unit Tagline", + translate=True, + compute="_compute_report_header", + store=True, + readonly=False, + help="Operating Unit tagline, which is included " + "in a printed document's header or footer " + "(depending on the selected layout).", + ) + report_footer = fields.Html( + translate=True, + compute="_compute_report_footer", + store=True, + readonly=False, + help="Footer text displayed at the bottom of all reports.", + ) + operating_unit_details = fields.Html( + translate=True, + compute="_compute_operating_unit_details", + store=True, + readonly=False, + help="Header text displayed at the top of all reports.", + ) + is_operating_unit_details_empty = fields.Boolean( + compute="_compute_empty_operating_unit_details" + ) + + @api.depends("company_id") + def _compute_report_header(self): + for operating_unit in self: + if operating_unit.company_id: + operating_unit.report_header = operating_unit.company_id.report_header + + @api.depends("company_id") + def _compute_report_footer(self): + for operating_unit in self: + if operating_unit.company_id: + operating_unit.report_footer = operating_unit.company_id.report_footer + + @api.depends("company_id") + def _compute_operating_unit_details(self): + for operating_unit in self: + if operating_unit.company_id: + operating_unit.operating_unit_details = ( + operating_unit.company_id.company_details + ) + + @api.depends("operating_unit_details") + def _compute_empty_operating_unit_details(self): + # In recent change when an html field is + # empty a

balise remains with a
in it, + # but when operating unit details is empty + # we want to put the info of the operating unit + for operating_unit in self: + operating_unit.is_operating_unit_details_empty = not html2plaintext( + operating_unit.operating_unit_details or "" + ) diff --git a/report_qweb_operating_unit/pyproject.toml b/report_qweb_operating_unit/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/report_qweb_operating_unit/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/report_qweb_operating_unit/readme/CONTRIBUTORS.md b/report_qweb_operating_unit/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..0e9ebbf5b0 --- /dev/null +++ b/report_qweb_operating_unit/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- ForgeFlow S.L. \<\> +- Serpent Consulting Services Pvt. Ltd. \<\> +- Jarsa Sistemas \<\> +- Juany Davila \<\> diff --git a/report_qweb_operating_unit/readme/DESCRIPTION.md b/report_qweb_operating_unit/readme/DESCRIPTION.md new file mode 100644 index 0000000000..76bb07bdad --- /dev/null +++ b/report_qweb_operating_unit/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows to use custom operating unit headers for any report +in Odoo diff --git a/report_qweb_operating_unit/static/description/icon.png b/report_qweb_operating_unit/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/report_qweb_operating_unit/static/description/icon.png differ diff --git a/report_qweb_operating_unit/static/description/index.html b/report_qweb_operating_unit/static/description/index.html new file mode 100644 index 0000000000..4858f7e954 --- /dev/null +++ b/report_qweb_operating_unit/static/description/index.html @@ -0,0 +1,428 @@ + + + + + +Qweb Report With Operating Unit + + + +

+

Qweb Report With Operating Unit

+ + +

Beta License: LGPL-3 OCA/operating-unit Translate me on Weblate Try me on Runboat

+

This module allows to use custom operating unit headers for any report +in Odoo

+

Table of contents

+ +
+

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 +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow S.L.
  • +
  • Serpent Consulting Services Pvt. Ltd.
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/report_qweb_operating_unit/tests/__init__.py b/report_qweb_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..580eccdc61 --- /dev/null +++ b/report_qweb_operating_unit/tests/__init__.py @@ -0,0 +1 @@ +from . import test_report_qweb_operating_unit diff --git a/report_qweb_operating_unit/tests/test_report_qweb_operating_unit.py b/report_qweb_operating_unit/tests/test_report_qweb_operating_unit.py new file mode 100644 index 0000000000..e70222b32c --- /dev/null +++ b/report_qweb_operating_unit/tests/test_report_qweb_operating_unit.py @@ -0,0 +1,41 @@ +from unittest.mock import MagicMock + +from odoo.tests.common import TransactionCase + + +class TestReportQwebOperatingUnit(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.ou = cls.env.ref("operating_unit.b2b_operating_unit") + cls.env.company.report_header = "Company report header" + cls.ou.report_header = "OU report header" + cls.mock_user = MagicMock(wraps=cls.env.user) + cls.mock_user.__contains__ = lambda self, other: True + cls.mock_user.operating_unit_id = cls.ou + + def test_rendering(self): + for layout in ("standard", "striped", "bold", "boxed"): + xmlid = "web.external_layout_%s" % layout + render_context = dict( + company=self.env.company, + o=self.env.user, + ) + html = ( + self.env["ir.actions.report"] + ._render_template( + xmlid, + render_context, + ) + .decode("utf8") + ) + self.assertIn(self.env.company.report_header, html) + html = ( + self.env["ir.actions.report"] + ._render_template( + xmlid, + dict(render_context, o=self.mock_user), + ) + .decode("utf8") + ) + self.assertIn(self.ou.report_header, html) diff --git a/report_qweb_operating_unit/views/operating_unit_view.xml b/report_qweb_operating_unit/views/operating_unit_view.xml new file mode 100644 index 0000000000..9705a532f3 --- /dev/null +++ b/report_qweb_operating_unit/views/operating_unit_view.xml @@ -0,0 +1,21 @@ + + + + operating.unit.form + operating.unit + + +
+ + + + + + + + + +
+
+
+
diff --git a/report_qweb_operating_unit/views/report_qweb_operating_unit.xml b/report_qweb_operating_unit/views/report_qweb_operating_unit.xml new file mode 100644 index 0000000000..e1e83a0f6d --- /dev/null +++ b/report_qweb_operating_unit/views/report_qweb_operating_unit.xml @@ -0,0 +1,389 @@ + + + + + + + + diff --git a/sales_team_operating_unit/i18n/de.po b/sales_team_operating_unit/i18n/de.po new file mode 100644 index 0000000000..4bb0a7b8df --- /dev/null +++ b/sales_team_operating_unit/i18n/de.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sales_team_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-20 17:06+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.6.2\n" + +#. module: sales_team_operating_unit +#. odoo-python +#: code:addons/sales_team_operating_unit/models/crm_team.py:0 +#, python-format +msgid "" +"Configuration error, The Company in the Sales Team and in the Operating Unit" +" must be the same." +msgstr "" +"Konfigurationsfehler. Das Verkaufsteam und die Filiale müssen demselben " +"Unternehmen zugeordnet sein." + +#. module: sales_team_operating_unit +#: model:ir.model.fields,field_description:sales_team_operating_unit.field_crm_team__operating_unit_id +msgid "Operating Unit" +msgstr "Filiale" + +#. module: sales_team_operating_unit +#: model:ir.model,name:sales_team_operating_unit.model_crm_team +msgid "Sales Team" +msgstr "Verkaufsteam" diff --git a/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt index c5ceb64be8..2f41eec62a 100644 --- a/setup/_metapackage/VERSION.txt +++ b/setup/_metapackage/VERSION.txt @@ -1 +1 @@ -16.0.20240730.0 \ No newline at end of file +16.0.20240829.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py index dfc0403c3c..116e60be5d 100644 --- a/setup/_metapackage/setup.py +++ b/setup/_metapackage/setup.py @@ -10,10 +10,12 @@ install_requires=[ 'odoo-addon-account_operating_unit>=16.0dev,<16.1dev', 'odoo-addon-analytic_operating_unit>=16.0dev,<16.1dev', + 'odoo-addon-contract_operating_unit>=16.0dev,<16.1dev', 'odoo-addon-hr_operating_unit>=16.0dev,<16.1dev', 'odoo-addon-operating_unit>=16.0dev,<16.1dev', 'odoo-addon-product_operating_unit>=16.0dev,<16.1dev', 'odoo-addon-project_operating_unit>=16.0dev,<16.1dev', + 'odoo-addon-report_qweb_operating_unit>=16.0dev,<16.1dev', 'odoo-addon-sales_team_operating_unit>=16.0dev,<16.1dev', 'odoo-addon-stock_operating_unit>=16.0dev,<16.1dev', ], diff --git a/setup/contract_operating_unit/odoo/addons/contract_operating_unit b/setup/contract_operating_unit/odoo/addons/contract_operating_unit new file mode 120000 index 0000000000..3ce69de57a --- /dev/null +++ b/setup/contract_operating_unit/odoo/addons/contract_operating_unit @@ -0,0 +1 @@ +../../../../contract_operating_unit \ No newline at end of file diff --git a/setup/contract_operating_unit/setup.py b/setup/contract_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/contract_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/purchase_operating_unit/odoo/addons/purchase_operating_unit b/setup/purchase_operating_unit/odoo/addons/purchase_operating_unit new file mode 120000 index 0000000000..4695973c4e --- /dev/null +++ b/setup/purchase_operating_unit/odoo/addons/purchase_operating_unit @@ -0,0 +1 @@ +../../../../purchase_operating_unit \ No newline at end of file diff --git a/setup/purchase_operating_unit/setup.py b/setup/purchase_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/purchase_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/report_qweb_operating_unit/odoo/addons/report_qweb_operating_unit b/setup/report_qweb_operating_unit/odoo/addons/report_qweb_operating_unit new file mode 120000 index 0000000000..679f3054ac --- /dev/null +++ b/setup/report_qweb_operating_unit/odoo/addons/report_qweb_operating_unit @@ -0,0 +1 @@ +../../../../report_qweb_operating_unit \ No newline at end of file diff --git a/setup/report_qweb_operating_unit/setup.py b/setup/report_qweb_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/report_qweb_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_operating_unit/i18n/de.po b/stock_operating_unit/i18n/de.po new file mode 100644 index 0000000000..0a88b51def --- /dev/null +++ b/stock_operating_unit/i18n/de.po @@ -0,0 +1,183 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-20 17:06+0000\n" +"Last-Translator: Bastian Günther \n" +"Language-Team: none\n" +"Language: de\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 5.6.2\n" + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_warehouse.py:0 +#, python-format +msgid "" +"Configuration Error. The Operating Unit of the Warehouse and the Location " +"must be the same. " +msgstr "" +"Konfigurationsfehler. Die Filiale des Lagers und des Lagerortes müssen " +"identisch sein. " + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_location.py:0 +#, python-format +msgid "Configuration error. Internal locations should have an operating unit" +msgstr "" +"Konfigurationsfehler. Interne Lagerorte sollten einer Filiale zugeordnet sein" + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_location.py:0 +#, python-format +msgid "" +"Configuration error. The Company in the Stock Location and in the Operating " +"Unit must be the same." +msgstr "" +"Konfigurationsfehler. Der Lagerort und die Filiale müssen demselben " +"Unternehmen zugeordnet sein." + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_picking.py:0 +#, python-format +msgid "" +"Configuration error. The Company in the Stock Picking and in the Operating " +"Unit must be the same." +msgstr "" +"Konfigurationsfehler. Die Lagerentnahme und die Filiale müssen demselben " +"Unternehmen zugeordnet sein." + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_warehouse.py:0 +#, python-format +msgid "" +"Configuration error. The Company in the Stock Warehouse and in the Operating" +" Unit must be the same." +msgstr "" +"Konfigurationsfehler. Das Lager und die Filiale müssen demselben Unternehmen " +"zugeordnet sein." + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_picking.py:0 +#, python-format +msgid "" +"Configuration error. The Operating Unit of the picking must be the same as " +"that of the warehouse of the Picking Type." +msgstr "" +"Konfigurationsfehler. Die Lagerentnahme und das dem Vorgangstyp zugehörige " +"Lager müssen derselben Filiale zugeordnet sein." + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_location.py:0 +#, python-format +msgid "" +"Configuration error. The Parent Stock Location must belong to the same " +"Operating Unit." +msgstr "" +"Konfigurationsfehler. Der übergeordnete Lagerort muss derselben Filiale " +"zugeordnet sein." + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_move.py:0 +#, python-format +msgid "" +"Configuration error. The Stock moves must be related to a location (source " +"or destination) that belongs to the requesting Operating Unit." +msgstr "" +"Konfigurationsfehler. Die Lagerbewegung muss zu einem Lagerort gehören (" +"Quelle oder Ziel), welcher der anfragenden Filiale zugeordnet ist." + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_location.py:0 +#, python-format +msgid "" +"Configuration error. The operating unit should be assigned to internal " +"locations only." +msgstr "" +"Konfigurationsfehler. Nur interne Lagerorte sollten einer Filiale zugeordnet " +"werden." + +#. module: stock_operating_unit +#. odoo-python +#: code:addons/stock_operating_unit/model/stock_location.py:0 +#, python-format +msgid "" +"Configuration error. This location is assigned to a warehouse that belongs " +"to a different operating unit." +msgstr "" +"Konfigurationsfehler. Dieser Lagerort gehört zu einemLager, welches einer " +"anderen Filiale zugeordnet ist." + +#. module: stock_operating_unit +#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_move__operating_unit_dest_id +msgid "Dest. Location Operating Unit" +msgstr "Zielort Filiale" + +#. module: stock_operating_unit +#: model:ir.model,name:stock_operating_unit.model_stock_location +msgid "Inventory Locations" +msgstr "Lagerorte" + +#. module: stock_operating_unit +#: model:ir.model,name:stock_operating_unit.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "Mindestbestandsregel" + +#. module: stock_operating_unit +#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_location__operating_unit_id +#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_quant__operating_unit_id +#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_rule__operating_unit_id +#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_warehouse__operating_unit_id +#: model_terms:ir.ui.view,arch_db:stock_operating_unit.view_picking_internal_search +msgid "Operating Unit" +msgstr "Filiale" + +#. module: stock_operating_unit +#: model:ir.model,name:stock_operating_unit.model_stock_quant +msgid "Quants" +msgstr "Mengen" + +#. module: stock_operating_unit +#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_picking__operating_unit_id +msgid "Requesting Operating Unit" +msgstr "Anfragende Filiale" + +#. module: stock_operating_unit +#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_move__operating_unit_id +msgid "Source Location Operating Unit" +msgstr "Quelllagerort Filiale" + +#. module: stock_operating_unit +#: model:ir.model,name:stock_operating_unit.model_stock_move +msgid "Stock Move" +msgstr "Lagerbuchung" + +#. module: stock_operating_unit +#: model:ir.model,name:stock_operating_unit.model_stock_rule +msgid "Stock Rule" +msgstr "Lagerbestandsregel" + +#. module: stock_operating_unit +#: model:ir.model,name:stock_operating_unit.model_stock_picking +msgid "Transfer" +msgstr "Transfer" + +#. module: stock_operating_unit +#: model:ir.model,name:stock_operating_unit.model_stock_warehouse +msgid "Warehouse" +msgstr "Lager"