mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Set as uninstallable and moved to __unported__ all modules.
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Authors: Laetitia Gangloff
|
||||
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsibility of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs.
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# guarantees and support are strongly advised to contact a Free Software
|
||||
# Service Company.
|
||||
#
|
||||
# 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
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,56 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Authors: Laetitia Gangloff
|
||||
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsibility of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs.
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# guarantees and support are strongly advised to contact a Free Software
|
||||
# Service Company.
|
||||
#
|
||||
# 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": "Account Statement Regex Account Completion addon",
|
||||
"version": "0.1",
|
||||
"author": "ACSONE SA/NV",
|
||||
"category": "Other",
|
||||
"website": "http://www.acsone.eu",
|
||||
"depends": ["account_statement_base_completion",
|
||||
],
|
||||
"description": """
|
||||
|
||||
Account Statement Regex Account Completion addon
|
||||
=========================
|
||||
|
||||
- Add a completion method based on a specified regular expression
|
||||
and update account to use in the bank statement line with the specified account.
|
||||
""",
|
||||
"data": ['statement_view.xml',
|
||||
],
|
||||
"demo": [],
|
||||
"test": [],
|
||||
"active": False,
|
||||
"license": "AGPL-3",
|
||||
"installable": True,
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,32 +0,0 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_statement_regex_account_completion
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-01-22 10:59+0000\n"
|
||||
"PO-Revision-Date: 2014-01-22 10:59+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_regex_account_completion
|
||||
#: field:account.statement.completion.rule,regex:0
|
||||
msgid "Regular Expression"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_statement_regex_account_completion
|
||||
#: field:account.statement.completion.rule,account_id:0
|
||||
msgid "Account to set"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_statement_regex_account_completion
|
||||
#: model:ir.model,name:account_statement_regex_account_completion.model_account_statement_completion_rule
|
||||
msgid "account.statement.completion.rule"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# 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-22 10:59+0000\n"
|
||||
"PO-Revision-Date: 2014-06-05 22:40+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_regex_account_completion
|
||||
#: field:account.statement.completion.rule,regex:0
|
||||
msgid "Regular Expression"
|
||||
msgstr "Expresión regular"
|
||||
|
||||
#. module: account_statement_regex_account_completion
|
||||
#: field:account.statement.completion.rule,account_id:0
|
||||
msgid "Account to set"
|
||||
msgstr "Cuenta a establecer"
|
||||
|
||||
#. module: account_statement_regex_account_completion
|
||||
#: model:ir.model,name:account_statement_regex_account_completion.model_account_statement_completion_rule
|
||||
msgid "account.statement.completion.rule"
|
||||
msgstr "account.statement.completion.rule"
|
||||
@@ -1,32 +0,0 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_statement_regex_account_completion
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-01-22 10:59+0000\n"
|
||||
"PO-Revision-Date: 2014-01-23 17:42+0000\n"
|
||||
"Last-Translator: Laetitia Gangloff (Acsone) <laetitia.gangloff@acsone.eu>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2014-05-22 06:49+0000\n"
|
||||
"X-Generator: Launchpad (build 17017)\n"
|
||||
|
||||
#. module: account_statement_regex_account_completion
|
||||
#: field:account.statement.completion.rule,regex:0
|
||||
msgid "Regular Expression"
|
||||
msgstr "Expression Régulière"
|
||||
|
||||
#. module: account_statement_regex_account_completion
|
||||
#: field:account.statement.completion.rule,account_id:0
|
||||
msgid "Account to set"
|
||||
msgstr "Compte à utiliser"
|
||||
|
||||
#. module: account_statement_regex_account_completion
|
||||
#: model:ir.model,name:account_statement_regex_account_completion.model_account_statement_completion_rule
|
||||
msgid "account.statement.completion.rule"
|
||||
msgstr "account.statement.completion.rule"
|
||||
@@ -1,75 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Authors: Laetitia Gangloff
|
||||
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsibility of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs.
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# guarantees and support are strongly advised to contact a Free Software
|
||||
# Service Company.
|
||||
#
|
||||
# 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.orm import Model
|
||||
from openerp.osv import fields
|
||||
|
||||
import re
|
||||
|
||||
|
||||
class AccountStatementCompletionRule(Model):
|
||||
"""Add a rule to complete account based on a regular expression"""
|
||||
|
||||
_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(('set_account',
|
||||
'Set account for line labels matching a regular expression'))
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'function_to_call': fields.selection(_get_functions, 'Method'),
|
||||
'regex': fields.char('Regular Expression', size=128),
|
||||
'account_id': fields.many2one('account.account', string="Account to set"),
|
||||
}
|
||||
|
||||
def set_account(self, cr, uid, id, st_line, context=None):
|
||||
"""
|
||||
If line name match regex, update account_id
|
||||
Then, call the generic st_line method to complete other values.
|
||||
:param dict 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,
|
||||
...}
|
||||
"""
|
||||
name = st_line['name']
|
||||
res = {}
|
||||
if name:
|
||||
rule = self.browse(cr, uid, id, context=context)
|
||||
if re.match(rule.regex, name):
|
||||
res['account_id'] = rule.account_id.id
|
||||
return res
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="statement_st_completion_rule_view_form" model="ir.ui.view">
|
||||
<field name="name">account.statement.completion.rule.view (account_statement_regex_account_completion)</field>
|
||||
<field name="model">account.statement.completion.rule</field>
|
||||
<field name="inherit_id" ref="account_statement_base_completion.statement_st_completion_rule_view_form" />
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="function_to_call" position="after">
|
||||
<group colspan="2">
|
||||
<field name="regex" attrs="{'invisible':[('function_to_call','!=','set_account')],'required':[('function_to_call','=','set_account')]}"/>
|
||||
<field name="account_id" attrs="{'invisible':[('function_to_call','!=','set_account')],'required':[('function_to_call','=','set_account')]}"/>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,36 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Authors: Laetitia Gangloff
|
||||
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsibility of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs.
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# guarantees and support are strongly advised to contact a Free Software
|
||||
# Service Company.
|
||||
#
|
||||
# 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 test_regex_account_completion
|
||||
|
||||
checks = [
|
||||
test_regex_account_completion
|
||||
]
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,91 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Authors: Laetitia Gangloff
|
||||
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsibility of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs.
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# guarantees and support are strongly advised to contact a Free Software
|
||||
# Service Company.
|
||||
#
|
||||
# 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.tests import common
|
||||
import time
|
||||
|
||||
ACC_NUMBER = "BE38733040385372"
|
||||
|
||||
|
||||
class test_regex_account_completion(common.TransactionCase):
|
||||
|
||||
def prepare(self):
|
||||
self.account_bank_statement_obj = self.registry("account.bank.statement")
|
||||
self.account_bank_statement_line_obj = self.registry("account.bank.statement.line")
|
||||
self.account_id = self.ref('account.a_expense')
|
||||
# create the completion rule
|
||||
rule_vals = {'function_to_call': 'set_account',
|
||||
'regex': '^My statement',
|
||||
'account_id': self.account_id}
|
||||
completion_rule_id = self.registry("account.statement.completion.rule").create(self.cr, self.uid, rule_vals)
|
||||
|
||||
# Create the profile
|
||||
journal_id = self.ref("account.bank_journal")
|
||||
profile_id = self.registry("account.statement.profile").create(self.cr, self.uid, {
|
||||
"name": "TEST",
|
||||
"commission_account_id": self.ref("account.a_recv"),
|
||||
"journal_id": journal_id,
|
||||
"rule_ids": [(6, 0, [completion_rule_id])]})
|
||||
|
||||
# Create a bank statement
|
||||
self.statement_id = self.account_bank_statement_obj.create(self.cr, self.uid, {
|
||||
"balance_end_real": 0.0,
|
||||
"balance_start": 0.0,
|
||||
"date": time.strftime('%Y-%m-%d'),
|
||||
"journal_id": journal_id,
|
||||
"profile_id": profile_id
|
||||
})
|
||||
|
||||
# Create two bank statement lines
|
||||
self.statement_line1_id = self.account_bank_statement_line_obj.create(self.cr, self.uid, {
|
||||
'amount': 1000.0,
|
||||
'name': 'My statement',
|
||||
'ref': 'My ref',
|
||||
'statement_id': self.statement_id,
|
||||
'partner_acc_number': ACC_NUMBER
|
||||
})
|
||||
|
||||
self.statement_line2_id = self.account_bank_statement_line_obj.create(self.cr, self.uid, {
|
||||
'amount': 2000.0,
|
||||
'name': 'My second statement',
|
||||
'ref': 'My second ref',
|
||||
'statement_id': self.statement_id,
|
||||
'partner_acc_number': ACC_NUMBER
|
||||
})
|
||||
|
||||
def test_00(self):
|
||||
"""Test the automatic completion on account
|
||||
"""
|
||||
self.prepare()
|
||||
statement_obj = self.account_bank_statement_obj.browse(self.cr, self.uid, self.statement_id)
|
||||
statement_obj.button_auto_completion()
|
||||
statement_line1 = self.account_bank_statement_line_obj.browse(self.cr, self.uid, self.statement_line1_id)
|
||||
self.assertEquals(self.account_id, statement_line1.account_id.id, "The account should be the account of the completion")
|
||||
statement_line2 = self.account_bank_statement_line_obj.browse(self.cr, self.uid, self.statement_line2_id)
|
||||
self.assertNotEqual(self.account_id, statement_line2.account_id.id, "The account should be not the account of the completion")
|
||||
Reference in New Issue
Block a user