[FIX] Finish the migration to v11

pull/264/head
mreficent 2018-07-13 12:37:18 +02:00 committed by Miquel Raïch
parent b4422c4efc
commit 38013a545b
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
:target: https://www.gnu.org/licenses/agpl.html
.. 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 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
using the PO Line and Product as key fields. This type of
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'.
* 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
:alt: Try me on Runbot
@ -40,7 +40,7 @@ Credits
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
------------

View File

@ -1,3 +1,3 @@
from . import mass_reconcile
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):
_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
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'])
def _base_columns():
""" Mandatory columns for move lines queries
An extra column aliased as ``key`` should be defined
in each query."""
aml_cols = super(MassReconcileAdvanced, MassReconcileAdvanced).\
_base_columns()
aml_cols.append('account_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)
# 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):
_inherit = 'account.mass.reconcile.method'
@api.model
def _get_reconcilation_methods(self):
methods = super(AccountMassReconcileMethod,
self)._get_reconcilation_methods()
@staticmethod
def _get_reconcilation_methods():
methods = super(
AccountMassReconcileMethod, AccountMassReconcileMethod).\
_get_reconcilation_methods()
methods += [
('mass.reconcile.advanced.by.purchase.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'