diff --git a/account_mass_reconcile_by_purchase_line/README.rst b/account_mass_reconcile_by_purchase_line/README.rst index 2554bb51..c8aad386 100644 --- a/account_mass_reconcile_by_purchase_line/README.rst +++ b/account_mass_reconcile_by_purchase_line/README.rst @@ -24,7 +24,7 @@ To use this module, you need to: .. 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/10.0 + :target: https://runbot.odoo-community.org/runbot/98/11.0 Bug Tracker =========== diff --git a/account_mass_reconcile_by_purchase_line/__init__.py b/account_mass_reconcile_by_purchase_line/__init__.py index 09cfd859..0650744f 100644 --- a/account_mass_reconcile_by_purchase_line/__init__.py +++ b/account_mass_reconcile_by_purchase_line/__init__.py @@ -1,6 +1 @@ -# -*- 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/__manifest__.py b/account_mass_reconcile_by_purchase_line/__manifest__.py index 99350968..418ae681 100644 --- a/account_mass_reconcile_by_purchase_line/__manifest__.py +++ b/account_mass_reconcile_by_purchase_line/__manifest__.py @@ -1,11 +1,10 @@ -# -*- coding: utf-8 -*- -# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# © 2015-18 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": "10.0.1.0.0", + "version": "11.0.1.0.0", "author": "Eficent, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/bank-statement-reconcile", diff --git a/account_mass_reconcile_by_purchase_line/models/__init__.py b/account_mass_reconcile_by_purchase_line/models/__init__.py index 98605de2..8b08acfb 100644 --- a/account_mass_reconcile_by_purchase_line/models/__init__.py +++ b/account_mass_reconcile_by_purchase_line/models/__init__.py @@ -1,6 +1,3 @@ -# -*- 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_advanced_reconciliation +from . import simple_reconciliation diff --git a/account_mass_reconcile_by_purchase_line/models/base_advanced_reconciliation.py b/account_mass_reconcile_by_purchase_line/models/base_advanced_reconciliation.py index 16c2b189..053358f0 100644 --- a/account_mass_reconcile_by_purchase_line/models/base_advanced_reconciliation.py +++ b/account_mass_reconcile_by_purchase_line/models/base_advanced_reconciliation.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# © 2015-18 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 odoo import models @@ -8,11 +7,21 @@ from odoo import models class MassReconcileAdvanced(models.AbstractModel): _inherit = 'mass.reconcile.advanced' - 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(MassReconcileAdvanced, self)._base_columns() - aml_cols.append('account_move_line.purchase_line_id') - aml_cols.append('account_move_line.product_id') - return aml_cols + 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')) + + @staticmethod + def _matchers(move_line): + return (('product_id', move_line['product_id']), + ('purchase_line_id', move_line['purchase_line_id'])) + + @staticmethod + def _opposite_matchers(move_line): + yield ('product_id', move_line['product_id']) + yield ('purchase_line_id', move_line['purchase_line_id']) diff --git a/account_mass_reconcile_by_purchase_line/models/mass_reconcile.py b/account_mass_reconcile_by_purchase_line/models/mass_reconcile.py index e85c9980..91df430f 100644 --- a/account_mass_reconcile_by_purchase_line/models/mass_reconcile.py +++ b/account_mass_reconcile_by_purchase_line/models/mass_reconcile.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# © 2015-17 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# © 2015-18 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 odoo import api, models @@ -9,8 +8,9 @@ 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() + def _get_reconcilation_methods(self): + methods = super(AccountMassReconcileMethod, + self)._get_reconcilation_methods() methods += [ ('mass.reconcile.advanced.by.purchase.line', 'Advanced. Product, purchase order line.'), diff --git a/account_mass_reconcile_by_purchase_line/models/simple_reconciliation.py b/account_mass_reconcile_by_purchase_line/models/simple_reconciliation.py new file mode 100644 index 00000000..2d5de51c --- /dev/null +++ b/account_mass_reconcile_by_purchase_line/models/simple_reconciliation.py @@ -0,0 +1,12 @@ +# Copyright 2012-2016 Camptocamp SA +# Copyright 2010 Sébastien Beau +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, api + + +class MassReconcileAdvancedByPurchaseLineName(models.TransientModel): + _name = 'mass.reconcile.advanced.by.purchase.line' + _inherit = 'mass.reconcile.simple' + + _key_field = 'purchase_line_id' diff --git a/account_mass_reconcile_by_purchase_line/wizards/__init__.py b/account_mass_reconcile_by_purchase_line/wizards/__init__.py deleted file mode 100644 index 141fb706..00000000 --- a/account_mass_reconcile_by_purchase_line/wizards/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- 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 deleted file mode 100644 index 1db5bc6f..00000000 --- a/account_mass_reconcile_by_purchase_line/wizards/advanced_reconciliation.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- 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 odoo 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'])