[ADD] [account_advanced_reconcile_transaction_by_purchase_line]

This commit is contained in:
jbeficent
2016-01-26 22:06:50 +01:00
committed by mreficent
parent 955c9d159e
commit c2671d34b8
6 changed files with 210 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Romain Deheele. Copyright Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import easy_reconcile
from . import base_advanced_reconciliation
from . import advanced_reconciliation

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Romain Deheele. Copyright Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{'name': 'Advanced Reconcile Transaction by Purchase Line',
'description': """
Advanced reconciliation method for the module account_advanced_reconcile
========================================================================
Reconcile rules with transaction_ref
""",
'version': '1.0.1',
'author': "Camptocamp,Odoo Community Association (OCA)",
'category': 'Finance',
'website': 'http://www.camptocamp.com',
'depends': ['account_advanced_reconcile',
'account_move_line_purchase_info'],
'data': ['easy_reconcile_view.xml'],
'demo': [],
'test': [], # To be ported or migrate to unit tests or scenarios
'auto_install': False,
'installable': True,
'images': []
}

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Romain Deheele. Copyright Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, api
class EasyReconcileAdvancedTransactionByPurchaseLine(models.TransientModel):
_name = 'easy.reconcile.advanced.by.purchase.line'
_inherit = 'easy.reconcile.advanced'
@api.model
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('partner_id') and move_line.get(
'product_id') and move_line.get('purchase_line_id')
@api.model
def _matchers(self, move_line):
return (('partner_id', move_line['partner_id']),
('product_id', move_line['product_id']),
('purchase_line_id', move_line['purchase_line_id']))
@api.model
def _opposite_matchers(self, move_line):
yield ('partner_id', (move_line['partner_id']))
yield ('product_id', (move_line['product_id']))
yield ('purchase_line_id', (move_line['purchase_line_id']))

View File

@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Romain Deheele
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, api
class EasyReconcileAdvanced(models.AbstractModel):
_inherit = 'easy.reconcile.advanced'
@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(EasyReconcileAdvanced, self)._base_columns()
aml_cols.append('account_move_line.purchase_line_id')
aml_cols.append('account_move_line.product_id')
return aml_cols

View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Romain Deheele
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, api
class AccountEasyReconcileMethod(models.Model):
_inherit = 'account.easy.reconcile.method'
@api.model
def _get_all_rec_method(self):
methods = super(AccountEasyReconcileMethod, self).\
_get_all_rec_method()
methods += [
('easy.reconcile.advanced.by.purchase.line',
'Advanced. GR/IR Key as partner, product, purchase order line.'),
]
return methods

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record id="view_easy_reconcile_form" model="ir.ui.view">
<field name="name">account.easy.reconcile.form</field>
<field name="model">account.easy.reconcile</field>
<field name="inherit_id" ref="account_easy_reconcile.account_easy_reconcile_form"/>
<field name="arch" type="xml">
<page name="information" position="inside">
<group colspan="2" col="2">
<separator colspan="4"
string="Advanced. Purchase Order Line"/>
<label string="Match multiple debit vs multiple credit entries. Allow partial reconciliation.
The credit entry GR/IR key (partner, product, purchase order line) is matched vs the debit entry GR/IR key." colspan="4"/>
</group>
<group colspan="2" col="2">
<separator colspan="4" string="Advanced. Purchase Order Line"/>
<label string="Match multiple debit vs multiple credit entries. Allow partial reconciliation.
The credit entry GR/IR key (partner, product, purchase order line) is matched vs the debit entry GR/IR key." colspan="4"/>
</group>
</page>
</field>
</record>
</data>
</openerp>