diff --git a/account_mass_reconcile_by_mrp_production/README.rst b/account_mass_reconcile_by_mrp_production/README.rst new file mode 100644 index 00000000..066be665 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/README.rst @@ -0,0 +1,61 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +============================================== +Account Mass Reconcile by Manufacturing Order +============================================== + +This module extends the functionality of account_mass_reconcile and +allow an user to reconcile debits and credits of an Account +using the MO line. + +Usage +===== + +To use this module, you need to: + +* Go to 'Accounting / Adviser / Mass Automatic Reconcile'. + +* Create a new reconciliation profile, and select a new configuration entry + with type 'Advanced. Mrp production.'. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/98/11.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Nuria Xifre + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/account_mass_reconcile_by_mrp_production/__init__.py b/account_mass_reconcile_by_mrp_production/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_mass_reconcile_by_mrp_production/__manifest__.py b/account_mass_reconcile_by_mrp_production/__manifest__.py new file mode 100644 index 00000000..6443b8a0 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2020 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Account Mass Reconcile by Manufacturing Order", + "summary": "Allows to reconcile based on the MO line", + "version": "14.0.1.0.0", + "author": "ForgeFlow S.L., " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-reconcile", + "category": "Finance", + "depends": ["account_mass_reconcile", "account_move_line_mrp_info"], + "license": "AGPL-3", + "data": ["security/ir.model.access.csv", "views/mass_reconcile.xml"], + "installable": True, + "auto_install": False, +} diff --git a/account_mass_reconcile_by_mrp_production/models/__init__.py b/account_mass_reconcile_by_mrp_production/models/__init__.py new file mode 100644 index 00000000..fbcdbc24 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/models/__init__.py @@ -0,0 +1,3 @@ +from . import mass_reconcile +from . import base_advanced_reconciliation +from . import advanced_reconciliation diff --git a/account_mass_reconcile_by_mrp_production/models/advanced_reconciliation.py b/account_mass_reconcile_by_mrp_production/models/advanced_reconciliation.py new file mode 100644 index 00000000..fed5c824 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/models/advanced_reconciliation.py @@ -0,0 +1,50 @@ +# Copyright 2020 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class MassReconcileAdvancedByMrpProduction(models.TransientModel): + _name = "mass.reconcile.advanced.by.mrp.production" + _inherit = "mass.reconcile.advanced" + _description = "Mass Reconcile By Mrp Production" + + @staticmethod + def _skip_line(move_line): + """ + When True is returned on some conditions, the credit move line + will be skipped for reconciliation. Can be inherited to + skip on some conditions. ie: ref or partner_id is empty. + """ + return not (move_line.get("mrp_production_id")) + + @staticmethod + def _matchers(move_line): + return (("mrp_production_id", move_line["mrp_production_id"]),) + + @staticmethod + def _opposite_matchers(move_line): + yield ("mrp_production_id", move_line["mrp_production_id"]) + + +class MassReconcileAdvancedByUnbuild(models.TransientModel): + _name = "mass.reconcile.advanced.by.unbuild" + _inherit = "mass.reconcile.advanced" + _description = "Mass Reconcile By Unbuild Order" + + @staticmethod + def _skip_line(move_line): + """ + When True is returned on some conditions, the credit move line + will be skipped for reconciliation. Can be inherited to + skip on some conditions. ie: ref or partner_id is empty. + """ + return not (move_line.get("unbuild_id")) + + @staticmethod + def _matchers(move_line): + return (("unbuild_id", move_line["unbuild_id"]),) + + @staticmethod + def _opposite_matchers(move_line): + yield ("unbuild_id", move_line["unbuild_id"]) diff --git a/account_mass_reconcile_by_mrp_production/models/base_advanced_reconciliation.py b/account_mass_reconcile_by_mrp_production/models/base_advanced_reconciliation.py new file mode 100644 index 00000000..c26cbed2 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/models/base_advanced_reconciliation.py @@ -0,0 +1,15 @@ +# Copyright 2020 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + + +from odoo import models + + +class MassReconcileAdvanced(models.AbstractModel): + _inherit = "mass.reconcile.advanced" + + def _selection_columns(self): + aml_cols = super(MassReconcileAdvanced, self)._selection_columns() + aml_cols.append("account_move_line.mrp_production_id") + aml_cols.append("account_move_line.unbuild_id") + return aml_cols diff --git a/account_mass_reconcile_by_mrp_production/models/mass_reconcile.py b/account_mass_reconcile_by_mrp_production/models/mass_reconcile.py new file mode 100644 index 00000000..f040c228 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/models/mass_reconcile.py @@ -0,0 +1,23 @@ +# Copyright 2020 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + + +from odoo import models + + +class AccountMassReconcileMethod(models.Model): + _inherit = "account.mass.reconcile.method" + + def _selection_name(self): + methods = super(AccountMassReconcileMethod, self)._selection_name() + methods += [ + ( + "mass.reconcile.advanced.by.mrp.production", + "Advanced. Mrp production.", + ), + ( + "mass.reconcile.advanced.by.unbuild", + "Advanced. Unbuild Order.", + ), + ] + return methods diff --git a/account_mass_reconcile_by_mrp_production/readme/CONTRIBUTORS.rst b/account_mass_reconcile_by_mrp_production/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..3eeb31a7 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Nuria Xifre Martin diff --git a/account_mass_reconcile_by_mrp_production/readme/DESCRIPTION.rst b/account_mass_reconcile_by_mrp_production/readme/DESCRIPTION.rst new file mode 100644 index 00000000..d26f6d5a --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module extends the functionality of account_mass_reconcile and +allow an user to reconcile debits and credits of an Account +using the MO line. diff --git a/account_mass_reconcile_by_mrp_production/readme/USAGE.rst b/account_mass_reconcile_by_mrp_production/readme/USAGE.rst new file mode 100644 index 00000000..477ebc4e --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/readme/USAGE.rst @@ -0,0 +1,6 @@ +To use this module, you need to: + +* Go to 'Accounting / Adviser / Mass Automatic Reconcile'. + +* Create a new reconciliation profile, and select a new configuration entry + with type 'Advanced. Mrp production.'. diff --git a/account_mass_reconcile_by_mrp_production/security/ir.model.access.csv b/account_mass_reconcile_by_mrp_production/security/ir.model.access.csv new file mode 100644 index 00000000..cc8ef314 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mass_reconcile_advanced_by_mrp_production,access_mass_reconcile_advanced_by_mrp_production,model_mass_reconcile_advanced_by_mrp_production,base.group_user,1,1,1,1 +access_mass_reconcile_advanced_by_unbuild,access_mass_reconcile_advanced_by_unbuild,model_mass_reconcile_advanced_by_unbuild,base.group_user,1,1,1,1 diff --git a/account_mass_reconcile_by_mrp_production/static/description/icon.png b/account_mass_reconcile_by_mrp_production/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_mass_reconcile_by_mrp_production/static/description/icon.png differ diff --git a/account_mass_reconcile_by_mrp_production/views/mass_reconcile.xml b/account_mass_reconcile_by_mrp_production/views/mass_reconcile.xml new file mode 100644 index 00000000..b53139a0 --- /dev/null +++ b/account_mass_reconcile_by_mrp_production/views/mass_reconcile.xml @@ -0,0 +1,34 @@ + + + + account.mass.reconcile.form + 30 + account.mass.reconcile + + + + + + + + + + + + + diff --git a/setup/account_mass_reconcile_by_mrp_production/odoo/addons/account_mass_reconcile_by_mrp_production b/setup/account_mass_reconcile_by_mrp_production/odoo/addons/account_mass_reconcile_by_mrp_production new file mode 120000 index 00000000..7180bcc4 --- /dev/null +++ b/setup/account_mass_reconcile_by_mrp_production/odoo/addons/account_mass_reconcile_by_mrp_production @@ -0,0 +1 @@ +../../../../account_mass_reconcile_by_mrp_production \ No newline at end of file diff --git a/setup/account_mass_reconcile_by_mrp_production/setup.py b/setup/account_mass_reconcile_by_mrp_production/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_mass_reconcile_by_mrp_production/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)