diff --git a/account_mass_reconcile/README.rst b/account_mass_reconcile/README.rst index 9b18fdab..654d6653 100644 --- a/account_mass_reconcile/README.rst +++ b/account_mass_reconcile/README.rst @@ -2,9 +2,9 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -============== -Mass Reconcile -============== +====================== +Account Mass Reconcile +====================== This is a shared work between Akretion and Camptocamp in order to provide: diff --git a/account_mass_reconcile/__openerp__.py b/account_mass_reconcile/__openerp__.py index 598548bf..e4d6e6fe 100644 --- a/account_mass_reconcile/__openerp__.py +++ b/account_mass_reconcile/__openerp__.py @@ -4,7 +4,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Mass Reconcile", + "name": "Account Mass Reconcile", "version": "9.0.1.0.0", "depends": ["account", "account_full_reconcile"], "author": "Akretion,Camptocamp,Odoo Community Association (OCA)", diff --git a/account_mass_reconcile/models/base_reconciliation.py b/account_mass_reconcile/models/base_reconciliation.py index 66a367b4..7e07e328 100644 --- a/account_mass_reconcile/models/base_reconciliation.py +++ b/account_mass_reconcile/models/base_reconciliation.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) # © 2010 Sébastien Beau +# © 2017 Eficent Business and IT Consulting Services S.L. (www.eficent.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, api, fields @@ -44,6 +45,7 @@ class MassReconcileBase(models.AbstractModel): """ raise NotImplementedError + @api.model def _base_columns(self): """ Mandatory columns for move lines queries An extra column aliased as ``key`` should be defined @@ -63,7 +65,8 @@ class MassReconcileBase(models.AbstractModel): @api.multi def _select(self, *args, **kwargs): - return "SELECT %s" % ', '.join(self._base_columns()) + return "SELECT %s" % ', '.join( + self.env["mass.reconcile.base"]._base_columns()) @api.multi def _from(self, *args, **kwargs): diff --git a/account_mass_reconcile/static/description/icon.png b/account_mass_reconcile/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_mass_reconcile/static/description/icon.png differ diff --git a/account_mass_reconcile/views/mass_reconcile.xml b/account_mass_reconcile/views/mass_reconcile.xml index e299b4b2..6867feda 100644 --- a/account_mass_reconcile/views/mass_reconcile.xml +++ b/account_mass_reconcile/views/mass_reconcile.xml @@ -60,9 +60,8 @@ The lines should have the same amount (with the write-off) and the same referenc - diff --git a/account_mass_reconcile_by_purchase_line/README.rst b/account_mass_reconcile_by_purchase_line/README.rst new file mode 100644 index 00000000..ad78d7a3 --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/README.rst @@ -0,0 +1,65 @@ +.. image:: https://img.shields.io/badge/license-AGPLv3-blue.svg + :target: https://www.gnu.org/licenses/agpl.html + :alt: License: AGPL-3 + +======================================= +Account Mass Reconcile by Purchase Line +======================================= + +This module extends the functionality of acccount_mass_reconcile and +allow an user to reconcile debits and credits of an Account +using the PO Line and Product as key fields. This type of +reconciliation is to be used in the context of the Perpetual Inventory +accounting system, with the accrual account '*Goods Received Not Invoiced*'. + +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. Product, purchase order line.'. + +.. 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/9.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 +------------ + +* Jordi Ballester Alomar +* Miquel Raïch +* Lois Rilo + +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_purchase_line/__init__.py b/account_mass_reconcile_by_purchase_line/__init__.py new file mode 100644 index 00000000..09cfd859 --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models +from . import wizards diff --git a/account_mass_reconcile_by_purchase_line/__openerp__.py b/account_mass_reconcile_by_purchase_line/__openerp__.py new file mode 100644 index 00000000..9bf7a07f --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/__openerp__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Account Mass Reconcile by Purchase Line", + "summary": "Allows to reconcile based on the PO line", + "version": "9.0.1.0.0", + "author": "Eficent, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/bank-statement-reconcile", + "category": "Finance", + "depends": ["account_mass_reconcile", + "account_move_line_purchase_info" + ], + "license": "AGPL-3", + "data": [ + "views/mass_reconcile.xml", + ], + "installable": True, + "auto_install": False, +} diff --git a/account_mass_reconcile_by_purchase_line/models/__init__.py b/account_mass_reconcile_by_purchase_line/models/__init__.py new file mode 100644 index 00000000..f4d36637 --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import mass_reconcile +from . import base_reconciliation diff --git a/account_mass_reconcile_by_purchase_line/models/base_reconciliation.py b/account_mass_reconcile_by_purchase_line/models/base_reconciliation.py new file mode 100644 index 00000000..09861e45 --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/models/base_reconciliation.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from openerp import api, models + + +class MassReconcileBase(models.AbstractModel): + _inherit = 'mass.reconcile.base' + + @api.model + def _base_columns(self): + """ Mandatory columns for move lines queries + An extra column aliased as ``key`` should be defined + in each query.""" + aml_cols = super(MassReconcileBase, self)._base_columns() + aml_cols.append('account_move_line.purchase_line_id') + aml_cols.append('account_move_line.product_id') + return aml_cols diff --git a/account_mass_reconcile_by_purchase_line/models/mass_reconcile.py b/account_mass_reconcile_by_purchase_line/models/mass_reconcile.py new file mode 100644 index 00000000..21dbdcc0 --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/models/mass_reconcile.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from openerp import api, models + + +class AccountMassReconcileMethod(models.Model): + _inherit = 'account.mass.reconcile.method' + + @api.model + def _get_all_rec_method(self): + methods = super(AccountMassReconcileMethod, self)._get_all_rec_method() + methods += [ + ('mass.reconcile.advanced.by.purchase.line', + 'Advanced. Product, purchase order line.'), + ] + return methods diff --git a/account_mass_reconcile_by_purchase_line/static/description/icon.png b/account_mass_reconcile_by_purchase_line/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_mass_reconcile_by_purchase_line/static/description/icon.png differ diff --git a/account_mass_reconcile_by_purchase_line/views/mass_reconcile.xml b/account_mass_reconcile_by_purchase_line/views/mass_reconcile.xml new file mode 100644 index 00000000..374a692a --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/views/mass_reconcile.xml @@ -0,0 +1,18 @@ + + + + account.mass.reconcile.form + 20 + account.mass.reconcile + + + + + + + + + + diff --git a/account_mass_reconcile_by_purchase_line/wizards/__init__.py b/account_mass_reconcile_by_purchase_line/wizards/__init__.py new file mode 100644 index 00000000..141fb706 --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/wizards/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import advanced_reconciliation diff --git a/account_mass_reconcile_by_purchase_line/wizards/advanced_reconciliation.py b/account_mass_reconcile_by_purchase_line/wizards/advanced_reconciliation.py new file mode 100644 index 00000000..1a602849 --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/wizards/advanced_reconciliation.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from openerp import api, models + + +class MassReconcileAdvancedByPurchaseLine(models.TransientModel): + _name = 'mass.reconcile.advanced.by.purchase.line' + _inherit = 'mass.reconcile.advanced' + + @api.multi + def _skip_line(self, 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('product_id') and + move_line.get('purchase_line_id')) + + @api.multi + def _matchers(self, move_line): + return (('product_id', move_line['product_id']), + ('purchase_line_id', move_line['purchase_line_id'])) + + @api.multi + def _opposite_matchers(self, move_line): + yield ('product_id', move_line['product_id']) + yield ('purchase_line_id', move_line['purchase_line_id']) diff --git a/oca_dependencies.txt b/oca_dependencies.txt index 34f82ae9..9a273770 100644 --- a/oca_dependencies.txt +++ b/oca_dependencies.txt @@ -1 +1,2 @@ +account-financial-tools bank-payment