[FIX] Finish the migration to v11

This commit is contained in:
mreficent
2018-07-13 12:37:18 +02:00
committed by Don Kendall
parent 5706ec5055
commit 56381c70a9
6 changed files with 50 additions and 40 deletions

View File

@@ -1,12 +1,12 @@
.. image:: https://img.shields.io/badge/license-AGPLv3-blue.svg .. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl.html :target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3 :alt: License: AGPL-3
======================================= =======================================
Account Mass Reconcile by Purchase Line Account Mass Reconcile by Purchase Line
======================================= =======================================
This module extends the functionality of acccount_mass_reconcile and This module extends the functionality of account_mass_reconcile and
allow an user to reconcile debits and credits of an Account allow an user to reconcile debits and credits of an Account
using the PO Line and Product as key fields. This type of using the PO Line and Product as key fields. This type of
reconciliation is to be used in the context of the Perpetual Inventory reconciliation is to be used in the context of the Perpetual Inventory
@@ -20,7 +20,7 @@ To use this module, you need to:
* Go to 'Accounting / Adviser / Mass Automatic Reconcile'. * Go to 'Accounting / Adviser / Mass Automatic Reconcile'.
* Create a new reconciliation profile, and select a new configuration entry * Create a new reconciliation profile, and select a new configuration entry
with type 'Advanced. Product, purchase order line.'. with type 'Advanced. Product, purchase order line'.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
@@ -40,7 +40,7 @@ Credits
Images Images
------ ------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. * Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
Contributors Contributors
------------ ------------

View File

@@ -1,3 +1,3 @@
from . import mass_reconcile from . import mass_reconcile
from . import base_advanced_reconciliation from . import base_advanced_reconciliation
from . import simple_reconciliation from . import advanced_reconciliation

View File

@@ -0,0 +1,29 @@
# © 2015-18 Eficent Business and IT Consulting Services S.L. (www.eficent.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class MassReconcileAdvancedByPurchaseLine(models.TransientModel):
_name = 'mass.reconcile.advanced.by.purchase.line'
_inherit = 'mass.reconcile.advanced'
@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('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

@@ -7,21 +7,13 @@ from odoo import models
class MassReconcileAdvanced(models.AbstractModel): class MassReconcileAdvanced(models.AbstractModel):
_inherit = 'mass.reconcile.advanced' _inherit = 'mass.reconcile.advanced'
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 @staticmethod
def _matchers(move_line): def _base_columns():
return (('product_id', move_line['product_id']), """ Mandatory columns for move lines queries
('purchase_line_id', move_line['purchase_line_id'])) An extra column aliased as ``key`` should be defined
in each query."""
@staticmethod aml_cols = super(MassReconcileAdvanced, MassReconcileAdvanced).\
def _opposite_matchers(move_line): _base_columns()
yield ('product_id', move_line['product_id']) aml_cols.append('account_move_line.purchase_line_id')
yield ('purchase_line_id', move_line['purchase_line_id']) aml_cols.append('account_move_line.product_id')
return aml_cols

View File

@@ -1,16 +1,17 @@
# © 2015-18 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). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models from odoo import models
class AccountMassReconcileMethod(models.Model): class AccountMassReconcileMethod(models.Model):
_inherit = 'account.mass.reconcile.method' _inherit = 'account.mass.reconcile.method'
@api.model @staticmethod
def _get_reconcilation_methods(self): def _get_reconcilation_methods():
methods = super(AccountMassReconcileMethod, methods = super(
self)._get_reconcilation_methods() AccountMassReconcileMethod, AccountMassReconcileMethod).\
_get_reconcilation_methods()
methods += [ methods += [
('mass.reconcile.advanced.by.purchase.line', ('mass.reconcile.advanced.by.purchase.line',
'Advanced. Product, purchase order line.'), 'Advanced. Product, purchase order line.'),

View File

@@ -1,12 +0,0 @@
# 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'