mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[MOV] move addons out of __unported__ (they remain not installable)
This commit is contained in:
25
account_statement_so_completion/__init__.py
Normal file
25
account_statement_so_completion/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
# #
|
||||
# Author: Joel Grand-Guillaume
|
||||
# Copyright 2011-2012 Camptocamp SA
|
||||
# #
|
||||
# Author: Leonardo Pistone <leonardo.pistone@camptocamp.com> #
|
||||
# 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 . import statement
|
||||
52
account_statement_so_completion/__openerp__.py
Normal file
52
account_statement_so_completion/__openerp__.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
# #
|
||||
# Author: Joel Grand-Guillaume
|
||||
# Copyright 2011-2012 Camptocamp SA
|
||||
# #
|
||||
# Author: Leonardo Pistone <leonardo.pistone@camptocamp.com> #
|
||||
# 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/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
{'name': "Bank statement Sale Order completion",
|
||||
'version': '0.1',
|
||||
'author': "Camptocamp,Odoo Community Association (OCA)",
|
||||
'maintainer': 'Camptocamp',
|
||||
'category': 'Finance',
|
||||
'complexity': 'easy',
|
||||
'depends': ['account_statement_base_completion', 'sale'],
|
||||
'description': """
|
||||
This module improve the module account_statement_base_completion to add
|
||||
support for completion rules based on Sale Orders. This was initially part of
|
||||
the module account_statement_base_completion, but is now separate to keep
|
||||
dependencies separate.
|
||||
|
||||
This module provides the following rule:
|
||||
|
||||
1) Match from statement line reference (based on SO number)
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'data': [
|
||||
'data.xml',
|
||||
],
|
||||
'test': [
|
||||
'test/completion_so_test.yml'],
|
||||
'installable': False,
|
||||
'images': [],
|
||||
'auto_install': True,
|
||||
'license': 'AGPL-3',
|
||||
}
|
||||
12
account_statement_so_completion/data.xml
Normal file
12
account_statement_so_completion/data.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="bank_statement_completion_rule_1" model="account.statement.completion.rule">
|
||||
<field name="name">Match from line reference (based on SO number)</field>
|
||||
<field name="sequence">50</field>
|
||||
<field name="function_to_call">get_from_ref_and_so</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,28 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_statement_so_completion
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-01-21 12:04+0000\n"
|
||||
"PO-Revision-Date: 2014-01-21 12:04+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_statement_so_completion
|
||||
#: code:addons/account_statement_so_completion/statement.py:77
|
||||
#, python-format
|
||||
msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on SO by ref."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_statement_so_completion
|
||||
#: model:ir.model,name:account_statement_so_completion.model_account_statement_completion_rule
|
||||
msgid "account.statement.completion.rule"
|
||||
msgstr ""
|
||||
|
||||
33
account_statement_so_completion/i18n/es.po
Normal file
33
account_statement_so_completion/i18n/es.po
Normal file
@@ -0,0 +1,33 @@
|
||||
# Spanish translation for banking-addons
|
||||
# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
|
||||
# This file is distributed under the same license as the banking-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: banking-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2014-01-21 12:04+0000\n"
|
||||
"PO-Revision-Date: 2014-06-05 22:41+0000\n"
|
||||
"Last-Translator: Pedro Manuel Baeza <pedro.baeza@gmail.com>\n"
|
||||
"Language-Team: Spanish <es@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2014-06-06 06:36+0000\n"
|
||||
"X-Generator: Launchpad (build 17031)\n"
|
||||
|
||||
#. module: account_statement_so_completion
|
||||
#: code:addons/account_statement_so_completion/statement.py:77
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Line named \"%s\" (Ref:%s) was matched by more than one partner while "
|
||||
"looking on SO by ref."
|
||||
msgstr ""
|
||||
"La línea llamada \"%s\" (Ref: %s) se casó con más de una empresa al buscar "
|
||||
"por referencia de pedido."
|
||||
|
||||
#. module: account_statement_so_completion
|
||||
#: model:ir.model,name:account_statement_so_completion.model_account_statement_completion_rule
|
||||
msgid "account.statement.completion.rule"
|
||||
msgstr "account.statement.completion.rule"
|
||||
86
account_statement_so_completion/statement.py
Normal file
86
account_statement_so_completion/statement.py
Normal file
@@ -0,0 +1,86 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
# #
|
||||
# Author: Joel Grand-Guillaume #
|
||||
# Copyright 2011-2012 Camptocamp SA #
|
||||
# #
|
||||
# Author: Leonardo Pistone <leonardo.pistone@camptocamp.com> #
|
||||
# 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.osv import orm
|
||||
from tools.translate import _
|
||||
from openerp.addons.account_statement_base_completion.statement import \
|
||||
ErrorTooManyPartner
|
||||
|
||||
|
||||
class AccountStatementCompletionRule(orm.Model):
|
||||
|
||||
_name = "account.statement.completion.rule"
|
||||
_inherit = "account.statement.completion.rule"
|
||||
|
||||
def _get_functions(self, cr, uid, context=None):
|
||||
res = super(AccountStatementCompletionRule, self)._get_functions(
|
||||
cr, uid, context=context)
|
||||
res.append(
|
||||
('get_from_ref_and_so', 'From line reference (based on SO number)')
|
||||
)
|
||||
return res
|
||||
|
||||
# Should be private but data are initialised with no update XML
|
||||
def get_from_ref_and_so(self, cr, uid, st_line, context=None):
|
||||
"""
|
||||
Match the partner based on the SO number and the reference of the
|
||||
statement line. Then, call the generic get_values_for_line method to
|
||||
complete other values. If more than one partner matched, raise the
|
||||
ErrorTooManyPartner error.
|
||||
|
||||
:param int/long st_line: read of the concerned
|
||||
account.bank.statement.line
|
||||
|
||||
:return:
|
||||
A dict of value that can be passed directly to the write method of
|
||||
the statement line or {}
|
||||
{'partner_id': value,
|
||||
'account_id': value,
|
||||
|
||||
...}
|
||||
"""
|
||||
st_obj = self.pool['account.bank.statement.line']
|
||||
res = {}
|
||||
if st_line:
|
||||
so_obj = self.pool.get('sale.order')
|
||||
so_id = so_obj.search(
|
||||
cr, uid, [('name', '=', st_line['ref'])], context=context)
|
||||
if so_id:
|
||||
if so_id and len(so_id) == 1:
|
||||
so = so_obj.browse(cr, uid, so_id[0], context=context)
|
||||
res['partner_id'] = so.partner_id.id
|
||||
elif so_id and len(so_id) > 1:
|
||||
raise ErrorTooManyPartner(
|
||||
_('Line named "%s" (Ref:%s) was matched by more '
|
||||
'than one partner while looking on SO by ref.') %
|
||||
(st_line['name'], st_line['ref']))
|
||||
st_vals = st_obj.get_values_for_line(
|
||||
cr, uid, profile_id=st_line['profile_id'],
|
||||
master_account_id=st_line['master_account_id'],
|
||||
partner_id=res.get('partner_id', False),
|
||||
line_type='customer',
|
||||
amount=st_line['amount'] if st_line['amount'] else 0.0,
|
||||
context=context)
|
||||
res.update(st_vals)
|
||||
return res
|
||||
44
account_statement_so_completion/test/completion_so_test.yml
Normal file
44
account_statement_so_completion/test/completion_so_test.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
-
|
||||
In order to test the banking framework for Sale Orders, I first need to
|
||||
create a profile
|
||||
-
|
||||
!record {model: account.statement.profile, id: profile_test_so}:
|
||||
name: Bank EUR Profile for SO
|
||||
journal_id: account.bank_journal
|
||||
commission_account_id: account.a_expense
|
||||
company_id: base.main_company
|
||||
balance_check: True
|
||||
rule_ids:
|
||||
- account_statement_base_completion.bank_statement_completion_rule_4
|
||||
- account_statement_base_completion.bank_statement_completion_rule_5
|
||||
- account_statement_base_completion.bank_statement_completion_rule_2
|
||||
- account_statement_base_completion.bank_statement_completion_rule_3
|
||||
- bank_statement_completion_rule_1
|
||||
-
|
||||
Now I create a statement. I create statment lines separately because I need
|
||||
to find each one by XML id
|
||||
-
|
||||
!record {model: account.bank.statement, id: statement_test_sale1}:
|
||||
name: Statement for SO
|
||||
profile_id: profile_test_so
|
||||
company_id: base.main_company
|
||||
-
|
||||
I create a statement line for a SO
|
||||
-
|
||||
!record {model: account.bank.statement.line, id: statement_line_so}:
|
||||
name: Test autocompletion based on Sale Order Number
|
||||
statement_id: statement_test_sale1
|
||||
ref: SO007
|
||||
date: '2013-12-20'
|
||||
amount: 14981.0
|
||||
-
|
||||
I run the auto complete
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
result = self.button_auto_completion(cr, uid, [ref("statement_test_sale1")])
|
||||
-
|
||||
Now I can check that all is nice and shiny, line 1. I expect the Sale Order
|
||||
Number to be recognised.
|
||||
-
|
||||
!assert {model: account.bank.statement.line, id: statement_line_so, string: Check completion by SO number}:
|
||||
- partner_id.name == u'Luminous Technologies'
|
||||
Reference in New Issue
Block a user