[MIG] account_mass_reconcile_by_purchase_line: Migration to 11.0

This commit is contained in:
Jordi Ballester Alomar
2018-07-12 20:28:05 +02:00
committed by Miquel Raïch
parent 92f87d52ab
commit 063b9bdc98
9 changed files with 39 additions and 62 deletions

View File

@@ -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
===========

View File

@@ -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

View File

@@ -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",

View File

@@ -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

View File

@@ -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'])

View File

@@ -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.'),

View File

@@ -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'

View File

@@ -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

View File

@@ -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'])