diff --git a/account_cutoff_accrual_order_product_category/README.rst b/account_cutoff_accrual_order_product_category/README.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/account_cutoff_accrual_order_product_category/__init__.py b/account_cutoff_accrual_order_product_category/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/account_cutoff_accrual_order_product_category/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_cutoff_accrual_order_product_category/__manifest__.py b/account_cutoff_accrual_order_product_category/__manifest__.py new file mode 100644 index 00000000000..fda8a0a7425 --- /dev/null +++ b/account_cutoff_accrual_order_product_category/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2021 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Account Cutoff Accrual Order Product Category", + "summary": """ + Allows to get the product category on cutoff lines""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "BCIM,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-closing", + "depends": [ + "account_cutoff_accrual_order_base", + "account_move_line_product_category", + ], + "data": [ + "views/account_cutoff_line.xml", + ], +} diff --git a/account_cutoff_accrual_order_product_category/models/__init__.py b/account_cutoff_accrual_order_product_category/models/__init__.py new file mode 100644 index 00000000000..94618d5022e --- /dev/null +++ b/account_cutoff_accrual_order_product_category/models/__init__.py @@ -0,0 +1 @@ +from . import account_cutoff_line, account_cutoff diff --git a/account_cutoff_accrual_order_product_category/models/account_cutoff.py b/account_cutoff_accrual_order_product_category/models/account_cutoff.py new file mode 100644 index 00000000000..b60bd412000 --- /dev/null +++ b/account_cutoff_accrual_order_product_category/models/account_cutoff.py @@ -0,0 +1,26 @@ +# Copyright 2021 Jacques-Etienne Baudoux (BCIM sprl) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class AccountCutoff(models.Model): + _inherit = "account.cutoff" + + def _get_merge_keys(self): + """Return merge criteria for provision lines + + The returned list must contain valid field names + for account.move.line. Provision lines with the + same values for these fields will be merged. + The list must at least contain account_id. + """ + res = super()._get_merge_keys() + if "categ_id" not in res: + res.append("categ_id") + return res + + def _prepare_provision_line(self, cutoff_line): + res = super()._prepare_provision_line(cutoff_line) + res["categ_id"] = cutoff_line.product_id.categ_id.id + return res diff --git a/account_cutoff_accrual_order_product_category/models/account_cutoff_line.py b/account_cutoff_accrual_order_product_category/models/account_cutoff_line.py new file mode 100644 index 00000000000..db49a807e8d --- /dev/null +++ b/account_cutoff_accrual_order_product_category/models/account_cutoff_line.py @@ -0,0 +1,11 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AccountCutoffLine(models.Model): + + _inherit = "account.cutoff.line" + + categ_id = fields.Many2one(related="product_id.categ_id", readonly=True) diff --git a/account_cutoff_accrual_order_product_category/readme/CONTEXT.md b/account_cutoff_accrual_order_product_category/readme/CONTEXT.md new file mode 100644 index 00000000000..b6d509c6092 --- /dev/null +++ b/account_cutoff_accrual_order_product_category/readme/CONTEXT.md @@ -0,0 +1 @@ +The module is used mainly for reporting purpose (reports per product category). diff --git a/account_cutoff_accrual_order_product_category/readme/CONTRIBUTORS.md b/account_cutoff_accrual_order_product_category/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..00ab0b97fbf --- /dev/null +++ b/account_cutoff_accrual_order_product_category/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Jacques-Étienne Baudoux (BCIM) +- Denis Roussel diff --git a/account_cutoff_accrual_order_product_category/readme/DESCRIPTION.md b/account_cutoff_accrual_order_product_category/readme/DESCRIPTION.md new file mode 100644 index 00000000000..eb6fe6b4329 --- /dev/null +++ b/account_cutoff_accrual_order_product_category/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to have the product category on cutoff lines level. diff --git a/account_cutoff_accrual_order_product_category/static/description/icon.png b/account_cutoff_accrual_order_product_category/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/account_cutoff_accrual_order_product_category/static/description/icon.png differ diff --git a/account_cutoff_accrual_order_product_category/static/description/index.html b/account_cutoff_accrual_order_product_category/static/description/index.html new file mode 100644 index 00000000000..2f27b7220a4 --- /dev/null +++ b/account_cutoff_accrual_order_product_category/static/description/index.html @@ -0,0 +1,429 @@ + + + + + + +Account Cutoff Picking Product Category + + + +
+

Account Cutoff Picking Product Category

+ + +

Beta License: AGPL-3 OCA/account-closing Translate me on Weblate Try me on Runboat

+

This module allows to have the product category on cutoff lines level.

+

Table of contents

+ +
+

Use Cases / Context

+

The module is used mainly for reporting purpose (reports per product +category).

+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
  • BCIM
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/account_cutoff_accrual_order_product_category/views/account_cutoff_line.xml b/account_cutoff_accrual_order_product_category/views/account_cutoff_line.xml new file mode 100644 index 00000000000..926ec6223a7 --- /dev/null +++ b/account_cutoff_accrual_order_product_category/views/account_cutoff_line.xml @@ -0,0 +1,26 @@ + + + + + + account.cutoff.line.form (in account_cutoff_picking_product_category) + account.cutoff.line + + + + + + + + + diff --git a/account_cutoff_accrual_sale_product_category/README.rst b/account_cutoff_accrual_sale_product_category/README.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/account_cutoff_accrual_sale_product_category/__init__.py b/account_cutoff_accrual_sale_product_category/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/account_cutoff_accrual_sale_product_category/__manifest__.py b/account_cutoff_accrual_sale_product_category/__manifest__.py new file mode 100644 index 00000000000..60535bc2ca6 --- /dev/null +++ b/account_cutoff_accrual_sale_product_category/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Account Cutoff Accrual Sale Product Category", + "summary": """ + Test module for account accrual order product category""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "BCIM,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-closing", + "depends": [ + "account_cutoff_accrual_order_product_category", + "account_cutoff_accrual_sale", + ], + "installable": True, + "application": False, + "auto_install": True, +} diff --git a/account_cutoff_accrual_sale_product_category/readme/CONTRIBUTORS.md b/account_cutoff_accrual_sale_product_category/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..12a2249a266 --- /dev/null +++ b/account_cutoff_accrual_sale_product_category/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Jacques-Etienne Baudoux (BCIM) +- Denis Roussel diff --git a/account_cutoff_accrual_sale_product_category/readme/DESCRIPTION.md b/account_cutoff_accrual_sale_product_category/readme/DESCRIPTION.md new file mode 100644 index 00000000000..26324cf7f33 --- /dev/null +++ b/account_cutoff_accrual_sale_product_category/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Test module for account_cutoff_accrual_order_product_category diff --git a/account_cutoff_accrual_sale_product_category/tests/__init__.py b/account_cutoff_accrual_sale_product_category/tests/__init__.py new file mode 100644 index 00000000000..d2b6698dc48 --- /dev/null +++ b/account_cutoff_accrual_sale_product_category/tests/__init__.py @@ -0,0 +1 @@ +from . import test_cutoff_category diff --git a/account_cutoff_accrual_sale_product_category/tests/test_cutoff_category.py b/account_cutoff_accrual_sale_product_category/tests/test_cutoff_category.py new file mode 100644 index 00000000000..a6dd1678df7 --- /dev/null +++ b/account_cutoff_accrual_sale_product_category/tests/test_cutoff_category.py @@ -0,0 +1,24 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.addons.account_cutoff_accrual_sale_stock.tests.common import ( + TestAccountCutoffAccrualSaleCommon, +) + + +class TestAccountCutoffPickingCategory(TestAccountCutoffAccrualSaleCommon): + def test_category(self): + # Create SO and pickings, then create cutoff + # Then create the cutoff move + # Result lines should contains the products category + cutoff = self.revenue_cutoff + self._confirm_so_and_do_picking(2) + cutoff.get_lines() + self.assertEqual(len(cutoff.line_ids), 2, "2 cutoff lines should be found") + for line in cutoff.line_ids: + self.assertEqual( + line.cutoff_amount, 100 * 2, "SO line cutoff amount incorrect" + ) + action = cutoff.create_move() + move = self.env["account.move"].browse(action.get("res_id")) + self.assertEqual(move.line_ids.categ_id, self.products.categ_id) diff --git a/setup/account_cutoff_accrual_order_product_category/odoo/addons/account_cutoff_accrual_order_product_category b/setup/account_cutoff_accrual_order_product_category/odoo/addons/account_cutoff_accrual_order_product_category new file mode 120000 index 00000000000..ca6d2a09618 --- /dev/null +++ b/setup/account_cutoff_accrual_order_product_category/odoo/addons/account_cutoff_accrual_order_product_category @@ -0,0 +1 @@ +../../../../account_cutoff_accrual_order_product_category \ No newline at end of file diff --git a/setup/account_cutoff_accrual_order_product_category/setup.py b/setup/account_cutoff_accrual_order_product_category/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/account_cutoff_accrual_order_product_category/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/account_cutoff_accrual_sale_product_category/odoo/addons/account_cutoff_accrual_sale_product_category b/setup/account_cutoff_accrual_sale_product_category/odoo/addons/account_cutoff_accrual_sale_product_category new file mode 120000 index 00000000000..6195458a3e4 --- /dev/null +++ b/setup/account_cutoff_accrual_sale_product_category/odoo/addons/account_cutoff_accrual_sale_product_category @@ -0,0 +1 @@ +../../../../account_cutoff_accrual_sale_product_category \ No newline at end of file diff --git a/setup/account_cutoff_accrual_sale_product_category/setup.py b/setup/account_cutoff_accrual_sale_product_category/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/account_cutoff_accrual_sale_product_category/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)