From 1a2e2670010e03b24df0f559347c7434cef04f0d Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Thu, 10 Oct 2024 17:46:27 +0200 Subject: [PATCH] [ADD] account_cutoff_accrual_order_stock_base --- .../README.rst | 86 ++++ .../__init__.py | 4 + .../__manifest__.py | 20 + .../i18n/fr.po | 35 ++ .../models/__init__.py | 4 + .../models/account_cutoff.py | 66 +++ .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 3 + .../static/description/index.html | 425 ++++++++++++++++++ .../views/account_cutoff_view.xml | 22 + .../account_cutoff_accrual_order_stock_base | 1 + .../setup.py | 6 + 12 files changed, 673 insertions(+) create mode 100644 account_cutoff_accrual_order_stock_base/README.rst create mode 100644 account_cutoff_accrual_order_stock_base/__init__.py create mode 100644 account_cutoff_accrual_order_stock_base/__manifest__.py create mode 100644 account_cutoff_accrual_order_stock_base/i18n/fr.po create mode 100644 account_cutoff_accrual_order_stock_base/models/__init__.py create mode 100644 account_cutoff_accrual_order_stock_base/models/account_cutoff.py create mode 100644 account_cutoff_accrual_order_stock_base/readme/CONTRIBUTORS.rst create mode 100644 account_cutoff_accrual_order_stock_base/readme/DESCRIPTION.rst create mode 100644 account_cutoff_accrual_order_stock_base/static/description/index.html create mode 100644 account_cutoff_accrual_order_stock_base/views/account_cutoff_view.xml create mode 120000 setup/account_cutoff_accrual_order_stock_base/odoo/addons/account_cutoff_accrual_order_stock_base create mode 100644 setup/account_cutoff_accrual_order_stock_base/setup.py diff --git a/account_cutoff_accrual_order_stock_base/README.rst b/account_cutoff_accrual_order_stock_base/README.rst new file mode 100644 index 00000000000..71deb59f739 --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/README.rst @@ -0,0 +1,86 @@ +======================================== +Account Cut-off Accrual Order Stock Base +======================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:791c43ae54bd1847ebd5e0f75ad43368499c624e2ec8f67b58ac0e33b1a4a60c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Faccount--closing-lightgray.png?logo=github + :target: https://github.com/OCA/account-closing/tree/16.0/account_cutoff_accrual_order_stock_base + :alt: OCA/account-closing +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-closing-16-0/account-closing-16-0-account_cutoff_accrual_order_stock_base + :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/account-closing&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of account_cutoff_base +to define prepaid accounts for prepaid goods in the scope of accrued revenue +and expense. + +**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 +~~~~~~~ + +* BCIM + +Contributors +~~~~~~~~~~~~ + +* Jacques-Etienne Baudoux (BCIM) + +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. + +.. |maintainer-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px + :target: https://github.com/jbaudoux + :alt: jbaudoux + +Current `maintainer `__: + +|maintainer-jbaudoux| + +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_stock_base/__init__.py b/account_cutoff_accrual_order_stock_base/__init__.py new file mode 100644 index 00000000000..86337901b11 --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2018 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/account_cutoff_accrual_order_stock_base/__manifest__.py b/account_cutoff_accrual_order_stock_base/__manifest__.py new file mode 100644 index 00000000000..f85f684afd9 --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2018 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + + +{ + "name": "Account Cut-off Accrual Order Stock Base", + "version": "16.0.1.0.0", + "category": "Accounting & Finance", + "license": "AGPL-3", + "summary": "Accrued Order Stock Base", + "author": "BCIM, Odoo Community Association (OCA)", + "maintainers": ["jbaudoux"], + "website": "https://github.com/OCA/account-closing", + "depends": ["account_cutoff_base", "stock"], + "data": [ + "views/account_cutoff_view.xml", + ], + "installable": True, + "application": False, +} diff --git a/account_cutoff_accrual_order_stock_base/i18n/fr.po b/account_cutoff_accrual_order_stock_base/i18n/fr.po new file mode 100644 index 00000000000..2b94d42b94f --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/i18n/fr.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_cutoff_accrual_order_stock_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-26 12:01+0000\n" +"PO-Revision-Date: 2023-10-26 12:01+0000\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: account_cutoff_accrual_order_stock_base +#: model:ir.model,name:account_cutoff_accrual_order_stock_base.model_account_cutoff +msgid "Account Cut-off" +msgstr "Provision" + +#. module: account_cutoff_accrual_order_stock_base +#: model:ir.model.fields,help:account_cutoff_accrual_order_stock_base.field_account_cutoff__cutoff_account_prepaid_stock_id +msgid "" +"Account for accrual of prepaid stock expenses. For instance, goods invoiced " +"and not yet received." +msgstr "" +"Compte pour les provisions sur charges de type marchandise constatées " +"d'avance. Par exemple, les marchandises facturées et pas encore reçues." + +#. module: account_cutoff_accrual_order_stock_base +#: model:ir.model.fields,field_description:account_cutoff_accrual_order_stock_base.field_account_cutoff__cutoff_account_prepaid_stock_id +msgid "Cut-off Prepaid Stock Account" +msgstr "Compte de provision pour marchandise prépayée" diff --git a/account_cutoff_accrual_order_stock_base/models/__init__.py b/account_cutoff_accrual_order_stock_base/models/__init__.py new file mode 100644 index 00000000000..4ef42780528 --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2018 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import account_cutoff diff --git a/account_cutoff_accrual_order_stock_base/models/account_cutoff.py b/account_cutoff_accrual_order_stock_base/models/account_cutoff.py new file mode 100644 index 00000000000..d0873e5a591 --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/models/account_cutoff.py @@ -0,0 +1,66 @@ +# Copyright 2018 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import Command, api, fields, models +from odoo.tools import float_is_zero + + +class AccountCutoff(models.Model): + _inherit = "account.cutoff" + + cutoff_account_prepaid_stock_id = fields.Many2one( + comodel_name="account.account", + string="Cut-off Prepaid Stock Account", + domain="[('deprecated', '=', False)]", + states={"done": [("readonly", True)]}, + check_company=True, + tracking=True, + default=lambda self: self._default_cutoff_account_prepaid_stock_id(), + help="Account for accrual of prepaid stock expenses. " + "For instance, goods invoiced and not yet received.", + ) + + @api.model + def _default_cutoff_account_prepaid_stock_id(self): + cutoff_type = self.env.context.get("default_cutoff_type") + company = self.env.company + if cutoff_type == "accrued_expense": + account_id = company.default_prepaid_expense_account_id.id or False + elif cutoff_type == "accrued_revenue": + account_id = company.default_prepaid_revenue_account_id.id or False + else: + account_id = False + return account_id + + def _prepare_counterpart_moves( + self, to_provision, amount_total_pos, amount_total_neg + ): + if not self.cutoff_account_prepaid_stock_id: + return super()._prepare_counterpart_moves( + to_provision, amount_total_pos, amount_total_neg + ) + if self.cutoff_type == "accrued_revenue": + prepaid_amount = amount_total_neg + amount = amount_total_pos + elif self.cutoff_type == "accrued_expense": + prepaid_amount = amount_total_pos + amount = amount_total_neg + else: + prepaid_amount = 0 + amount = 0 + company_currency = self.company_id.currency_id + cur_rprec = company_currency.rounding + movelines_to_create = super()._prepare_counterpart_moves( + to_provision, 0, amount + ) + if not float_is_zero(prepaid_amount, precision_rounding=cur_rprec): + movelines_to_create.append( + Command.create( + { + "account_id": self.cutoff_account_prepaid_stock_id.id, + "debit": prepaid_amount, + "credit": 0, + }, + ) + ) + return movelines_to_create diff --git a/account_cutoff_accrual_order_stock_base/readme/CONTRIBUTORS.rst b/account_cutoff_accrual_order_stock_base/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..3c6c5c696a8 --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Jacques-Etienne Baudoux (BCIM) diff --git a/account_cutoff_accrual_order_stock_base/readme/DESCRIPTION.rst b/account_cutoff_accrual_order_stock_base/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..cd74bf5f06c --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module extends the functionality of account_cutoff_base +to define prepaid accounts for prepaid goods in the scope of accrued revenue +and expense. diff --git a/account_cutoff_accrual_order_stock_base/static/description/index.html b/account_cutoff_accrual_order_stock_base/static/description/index.html new file mode 100644 index 00000000000..0f97313e739 --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Account Cut-off Accrual Order Stock Base + + + +
+

Account Cut-off Accrual Order Stock Base

+ + +

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

+

This module extends the functionality of account_cutoff_base +to define prepaid accounts for prepaid goods in the scope of accrued revenue +and expense.

+

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

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

+

Current maintainer:

+

jbaudoux

+

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_stock_base/views/account_cutoff_view.xml b/account_cutoff_accrual_order_stock_base/views/account_cutoff_view.xml new file mode 100644 index 00000000000..871aae3075e --- /dev/null +++ b/account_cutoff_accrual_order_stock_base/views/account_cutoff_view.xml @@ -0,0 +1,22 @@ + + + + + + account.cutoff + + + + + + + + + diff --git a/setup/account_cutoff_accrual_order_stock_base/odoo/addons/account_cutoff_accrual_order_stock_base b/setup/account_cutoff_accrual_order_stock_base/odoo/addons/account_cutoff_accrual_order_stock_base new file mode 120000 index 00000000000..07d7bed1df6 --- /dev/null +++ b/setup/account_cutoff_accrual_order_stock_base/odoo/addons/account_cutoff_accrual_order_stock_base @@ -0,0 +1 @@ +../../../../account_cutoff_accrual_order_stock_base \ No newline at end of file diff --git a/setup/account_cutoff_accrual_order_stock_base/setup.py b/setup/account_cutoff_accrual_order_stock_base/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/account_cutoff_accrual_order_stock_base/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)