mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
convert the repo to 79 columns
This commit is contained in:
@@ -64,8 +64,8 @@ The base class to find the reconciliations is built to be as efficient as
|
|||||||
possible.
|
possible.
|
||||||
|
|
||||||
So basically, if you have an invoice with 3 payments (one per month), the first
|
So basically, if you have an invoice with 3 payments (one per month), the first
|
||||||
month, it will partial reconcile the debit move line with the first payment, the
|
month, it will partial reconcile the debit move line with the first payment,
|
||||||
second month, it will partial reconcile the debit move line with 2 first
|
the second month, it will partial reconcile the debit move line with 2 first
|
||||||
payments, the third month, it will make the full reconciliation.
|
payments, the third month, it will make the full reconciliation.
|
||||||
|
|
||||||
This module is perfectly adapted for E-Commerce business where a big volume of
|
This module is perfectly adapted for E-Commerce business where a big volume of
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ class easy_reconcile_advanced(orm.AbstractModel):
|
|||||||
If all the matchers match for a move line and an opposite move line,
|
If all the matchers match for a move line and an opposite move line,
|
||||||
they are candidate for a reconciliation.
|
they are candidate for a reconciliation.
|
||||||
"""
|
"""
|
||||||
opp_matchers = self._opposite_matchers(cr, uid, rec, opposite_move_line,
|
opp_matchers = self._opposite_matchers(cr, uid, rec,
|
||||||
|
opposite_move_line,
|
||||||
context=context)
|
context=context)
|
||||||
for matcher in matchers:
|
for matcher in matchers:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -259,14 +259,12 @@ class AccountEasyReconcile(orm.Model):
|
|||||||
partial_ids = find_reconcile_ids(
|
partial_ids = find_reconcile_ids(
|
||||||
new_cr, 'reconcile_partial_id', all_ml_partial_ids)
|
new_cr, 'reconcile_partial_id', all_ml_partial_ids)
|
||||||
|
|
||||||
self.pool.get('easy.reconcile.history').create(
|
self.pool.get('easy.reconcile.history').create(new_cr, uid, {
|
||||||
new_cr, uid,
|
'easy_reconcile_id': rec.id,
|
||||||
{'easy_reconcile_id': rec.id,
|
|
||||||
'date': fields.datetime.now(),
|
'date': fields.datetime.now(),
|
||||||
'reconcile_ids': [(4, rid) for rid in reconcile_ids],
|
'reconcile_ids': [(4, rid) for rid in reconcile_ids],
|
||||||
'reconcile_partial_ids': [(4, rid) for rid in partial_ids],
|
'reconcile_partial_ids': [(4, rid) for rid in partial_ids],
|
||||||
},
|
}, context=context)
|
||||||
context=context)
|
|
||||||
finally:
|
finally:
|
||||||
if ctx['commit_every']:
|
if ctx['commit_every']:
|
||||||
new_cr.commit()
|
new_cr.commit()
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ origin, free reference) and above all, to understand which field will be
|
|||||||
copied in the reference field of the move and move lines.
|
copied in the reference field of the move and move lines.
|
||||||
|
|
||||||
The approach here is to state simple rules with one concern: consistency.
|
The approach here is to state simple rules with one concern: consistency.
|
||||||
The reference of the move lines must be the number of the document at their very
|
The reference of the move lines must be the number of the document at their
|
||||||
origin (number of a sales order, of an external document like a supplier
|
very origin (number of a sales order, of an external document like a supplier
|
||||||
invoice, ...). The goal is for the accountant to be able to trace to the
|
invoice, ...). The goal is for the accountant to be able to trace to the
|
||||||
source document from a ledger).
|
source document from a ledger).
|
||||||
The description of a line should always be... well, a description. Not a number
|
The description of a line should always be... well, a description. Not a number
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
The goal of this module is to improve the basic bank statement, help dealing
|
The goal of this module is to improve the basic bank statement, help dealing
|
||||||
with huge volume of reconciliation by providing basic rules to identify the
|
with huge volume of reconciliation by providing basic rules to identify the
|
||||||
partner of a bank statement line.
|
partner of a bank statement line.
|
||||||
Each bank statement profile can have its own rules to be applied according to a
|
Each bank statement profile can have its own rules to be applied according to
|
||||||
sequence order.
|
a sequence order.
|
||||||
|
|
||||||
Some basic rules are provided in this module:
|
Some basic rules are provided in this module:
|
||||||
|
|
||||||
@@ -41,15 +41,15 @@
|
|||||||
2) Match from statement line label (based on partner name)
|
2) Match from statement line label (based on partner name)
|
||||||
3) Match from statement line reference (based on Invoice number)
|
3) Match from statement line reference (based on Invoice number)
|
||||||
|
|
||||||
You can easily override this module and add your own rules in your own one. The
|
You can easily override this module and add your own rules in your own one.
|
||||||
basic rules only fill in the partner, but you can use them to fill in any
|
The basic rules only fill in the partner, but you can use them to fill in
|
||||||
value of the line (in the future, we will add a rule to automatically match and
|
any value of the line (in the future, we will add a rule to automatically
|
||||||
reconcile the line).
|
match and reconcile the line).
|
||||||
|
|
||||||
It adds as well a label on the bank statement line (on which the pre-define
|
It adds as well a label on the bank statement line (on which the pre-define
|
||||||
rules can match) and a char field on the partner called 'Bank Statement Label'.
|
rules can match) and a char field on the partner called 'Bank Statement
|
||||||
Using the pre-define rules, you will be able to match various labels for a
|
Label'. Using the pre-define rules, you will be able to match various
|
||||||
partner.
|
labels for a partner.
|
||||||
|
|
||||||
The reference of the line is always used by the reconciliation process. We're
|
The reference of the line is always used by the reconciliation process. We're
|
||||||
supposed to copy there (or write manually) the matching string. This can be:
|
supposed to copy there (or write manually) the matching string. This can be:
|
||||||
@@ -60,9 +60,9 @@
|
|||||||
reconciliation process.
|
reconciliation process.
|
||||||
|
|
||||||
|
|
||||||
TODO: The rules that look for invoices to find out the partner should take back
|
TODO: The rules that look for invoices to find out the partner should take
|
||||||
the payable / receivable account from there directly instead of retrieving it
|
back the payable / receivable account from there directly instead of
|
||||||
from partner properties !
|
retrieving it from partner properties!
|
||||||
""",
|
""",
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'http://www.camptocamp.com',
|
||||||
'data': [
|
'data': [
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class ResPartner(orm.Model):
|
|||||||
'bank_statement_label': fields.char(
|
'bank_statement_label': fields.char(
|
||||||
'Bank Statement Label', size=100,
|
'Bank Statement Label', size=100,
|
||||||
help="Enter the various label found on your bank statement "
|
help="Enter the various label found on your bank statement "
|
||||||
"separated by a ; If one of this label is include in the bank "
|
"separated by a ; If one of this label is include in the "
|
||||||
"statement line, the partner will be automatically filled (as "
|
"bank statement line, the partner will be automatically "
|
||||||
"long as you use this method/rules in your statement "
|
"filled (as long as you use this method/rules in your "
|
||||||
"profile)."),
|
"statement profile)."),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,9 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
_order = "sequence asc"
|
_order = "sequence asc"
|
||||||
|
|
||||||
def _get_functions(self, cr, uid, context=None):
|
def _get_functions(self, cr, uid, context=None):
|
||||||
"""List of available methods for rules. Override this to add you own."""
|
"""List of available methods for rules.
|
||||||
|
|
||||||
|
Override this to add you own."""
|
||||||
return [
|
return [
|
||||||
('get_from_ref_and_invoice',
|
('get_from_ref_and_invoice',
|
||||||
'From line reference (based on customer invoice number)'),
|
'From line reference (based on customer invoice number)'),
|
||||||
@@ -225,8 +227,8 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
# Should be private but data are initialised with no update XML
|
# Should be private but data are initialised with no update XML
|
||||||
def get_from_ref_and_invoice(self, cr, uid, line, context=None):
|
def get_from_ref_and_invoice(self, cr, uid, line, context=None):
|
||||||
"""Match the partner based on the invoice number and the reference of
|
"""Match the partner based on the invoice number and the reference of
|
||||||
the statement line. Then, call the generic get_values_for_line method to
|
the statement line. Then, call the generic get_values_for_line method
|
||||||
complete other values. If more than one partner matched, raise the
|
to complete other values. If more than one partner matched, raise the
|
||||||
ErrorTooManyPartner error.
|
ErrorTooManyPartner error.
|
||||||
|
|
||||||
:param dict line: read of the concerned account.bank.statement.line
|
:param dict line: read of the concerned account.bank.statement.line
|
||||||
@@ -242,11 +244,11 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
# Should be private but data are initialised with no update XML
|
# Should be private but data are initialised with no update XML
|
||||||
def get_from_label_and_partner_field(self, cr, uid, st_line, context=None):
|
def get_from_label_and_partner_field(self, cr, uid, st_line, context=None):
|
||||||
"""
|
"""
|
||||||
Match the partner based on the label field of the statement line
|
Match the partner based on the label field of the statement line and
|
||||||
and the text defined in the 'bank_statement_label' field of the partner.
|
the text defined in the 'bank_statement_label' field of the partner.
|
||||||
Remember that we can have values separated with ; Then, call the generic
|
Remember that we can have values separated with ; Then, call the
|
||||||
get_values_for_line method to complete other values.
|
generic get_values_for_line method to complete other values. If more
|
||||||
If more than one partner matched, raise the ErrorTooManyPartner error.
|
than one partner matched, raise the ErrorTooManyPartner error.
|
||||||
|
|
||||||
:param dict st_line: read of the concerned account.bank.statement.line
|
:param dict st_line: read of the concerned account.bank.statement.line
|
||||||
:return:
|
:return:
|
||||||
@@ -303,10 +305,10 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def get_from_label_and_partner_name(self, cr, uid, st_line, context=None):
|
def get_from_label_and_partner_name(self, cr, uid, st_line, context=None):
|
||||||
"""Match the partner based on the label field of the statement line
|
"""Match the partner based on the label field of the statement line and
|
||||||
and the name of the partner. Then, call the generic get_values_for_line
|
the name of the partner. Then, call the generic get_values_for_line
|
||||||
method to complete other values. If more than one partner matched, raise
|
method to complete other values. If more than one partner matched,
|
||||||
the ErrorTooManyPartner error.
|
raise the ErrorTooManyPartner error.
|
||||||
|
|
||||||
:param dict st_line: read of the concerned account.bank.statement.line
|
:param dict st_line: read of the concerned account.bank.statement.line
|
||||||
:return:
|
:return:
|
||||||
@@ -386,9 +388,9 @@ class AccountStatement(orm.Model):
|
|||||||
|
|
||||||
class AccountStatementLine(orm.Model):
|
class AccountStatementLine(orm.Model):
|
||||||
"""
|
"""
|
||||||
Add sparse field on the statement line to allow to store all the
|
Add sparse field on the statement line to allow to store all the bank infos
|
||||||
bank infos that are given by a bank/office. You can then add you own in your
|
that are given by a bank/office. You can then add you own in your module.
|
||||||
module. The idea here is to store all bank/office infos in the
|
The idea here is to store all bank/office infos in the
|
||||||
additionnal_bank_fields serialized field when importing the file. If many
|
additionnal_bank_fields serialized field when importing the file. If many
|
||||||
values, add a tab in the bank statement line to store your specific one.
|
values, add a tab in the bank statement line to store your specific one.
|
||||||
Have a look in account_statement_base_import module to see how we've done
|
Have a look in account_statement_base_import module to see how we've done
|
||||||
@@ -449,7 +451,8 @@ class AccountStatementLine(orm.Model):
|
|||||||
statement_line_obj = self.pool['account.bank.statement.line']
|
statement_line_obj = self.pool['account.bank.statement.line']
|
||||||
model_cols = statement_line_obj._columns
|
model_cols = statement_line_obj._columns
|
||||||
avail = [
|
avail = [
|
||||||
k for k, col in model_cols.iteritems() if not hasattr(col, '_fnct')]
|
k for k, col in model_cols.iteritems() if not hasattr(col, '_fnct')
|
||||||
|
]
|
||||||
keys = [k for k in statement_store[0].keys() if k in avail]
|
keys = [k for k in statement_store[0].keys() if k in avail]
|
||||||
# add sparse fields..
|
# add sparse fields..
|
||||||
if include_serializable:
|
if include_serializable:
|
||||||
@@ -635,7 +638,8 @@ class AccountBankStatement(orm.Model):
|
|||||||
st += ''.join(traceback.format_tb(trbk, 30))
|
st += ''.join(traceback.format_tb(trbk, 30))
|
||||||
_logger.error(st)
|
_logger.error(st)
|
||||||
if res:
|
if res:
|
||||||
# stat_line_obj.write(cr, uid, [line.id], vals, context=ctx)
|
# stat_line_obj.write(cr, uid, [line.id], vals,
|
||||||
|
# context=ctx)
|
||||||
try:
|
try:
|
||||||
stat_line_obj._update_line(
|
stat_line_obj._update_line(
|
||||||
cr, uid, res, context=context)
|
cr, uid, res, context=context)
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ class base_completion(common.TransactionCase):
|
|||||||
|
|
||||||
def test_name_completion(self):
|
def test_name_completion(self):
|
||||||
"""Test complete partner_id from statement line label
|
"""Test complete partner_id from statement line label
|
||||||
Test the automatic completion of the partner_id based if the name of the
|
Test the automatic completion of the partner_id based if the name of
|
||||||
partner appears in the statement line label
|
the partner appears in the statement line label
|
||||||
"""
|
"""
|
||||||
self.completion_rule_id = self.ref(
|
self.completion_rule_id = self.ref(
|
||||||
'account_statement_base_completion.'
|
'account_statement_base_completion.'
|
||||||
@@ -89,7 +89,8 @@ class base_completion(common.TransactionCase):
|
|||||||
|
|
||||||
for case in NAMES_COMPLETION_CASES:
|
for case in NAMES_COMPLETION_CASES:
|
||||||
self.partner_obj.write(
|
self.partner_obj.write(
|
||||||
self.cr, self.uid, self.partner_id, {'name': case.partner_name})
|
self.cr, self.uid, self.partner_id, {'name': case.partner_name}
|
||||||
|
)
|
||||||
statement_line_id = self.account_bank_statement_line_obj.create(
|
statement_line_id = self.account_bank_statement_line_obj.create(
|
||||||
self.cr, self.uid, {
|
self.cr, self.uid, {
|
||||||
'amount': 1000.0,
|
'amount': 1000.0,
|
||||||
@@ -116,5 +117,6 @@ class base_completion(common.TransactionCase):
|
|||||||
else:
|
else:
|
||||||
self.assertNotEquals(
|
self.assertNotEquals(
|
||||||
self.partner_id, statement_line.partner_id['id'],
|
self.partner_id, statement_line.partner_id['id'],
|
||||||
"Partner id should be empty after completion(partner_name: "
|
"Partner id should be empty after completion "
|
||||||
"%s, line_name: %s)" % (case.partner_name, case.line_label))
|
"(partner_name: %s, line_name: %s)"
|
||||||
|
% (case.partner_name, case.line_label))
|
||||||
|
|||||||
@@ -57,8 +57,8 @@
|
|||||||
|
|
||||||
The goal is here to populate the statement lines of a bank statement with the
|
The goal is here to populate the statement lines of a bank statement with the
|
||||||
infos that the bank or office give you. Fell free to inherit from this module
|
infos that the bank or office give you. Fell free to inherit from this module
|
||||||
to add your own format. Then, if you need to complete data from there, add your
|
to add your own format. Then, if you need to complete data from there, add
|
||||||
own account_statement_*_completion module and implement the needed rules.
|
your own account_statement_*_completion module and implement the needed rules.
|
||||||
""",
|
""",
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'http://www.camptocamp.com',
|
||||||
'data': [
|
'data': [
|
||||||
|
|||||||
@@ -181,9 +181,9 @@ class FileParser(BankStatementImportParser):
|
|||||||
except Exception as err:
|
except Exception as err:
|
||||||
raise except_orm(
|
raise except_orm(
|
||||||
_("Date format is not valid"),
|
_("Date format is not valid"),
|
||||||
_("Please modify the cell formatting to date format"
|
_("Please modify the cell formatting to date "
|
||||||
" for column: %s value: %s\n Please check the "
|
"format for column: %s value: %s\n Please check "
|
||||||
"line with ref: %s\n \n Detail: %s") %
|
"the line with ref: %s\n \n Detail: %s") %
|
||||||
(rule, line.get(rule, _('Missing')),
|
(rule, line.get(rule, _('Missing')),
|
||||||
line.get('ref', line), repr(err)))
|
line.get('ref', line), repr(err)))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -24,8 +24,9 @@ from file_parser import FileParser
|
|||||||
|
|
||||||
class GenericFileParser(FileParser):
|
class GenericFileParser(FileParser):
|
||||||
"""Standard parser that use a define format in csv or xls to import into a
|
"""Standard parser that use a define format in csv or xls to import into a
|
||||||
bank statement. This is mostely an example of how to proceed to create a new
|
bank statement. This is mostely an example of how to proceed to create a
|
||||||
parser, but will also be useful as it allow to import a basic flat file.
|
new parser, but will also be useful as it allow to import a basic flat
|
||||||
|
file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parse_name, ftype='csv', **kwargs):
|
def __init__(self, parse_name, ftype='csv', **kwargs):
|
||||||
@@ -42,9 +43,9 @@ class GenericFileParser(FileParser):
|
|||||||
def get_st_line_vals(self, line, *args, **kwargs):
|
def get_st_line_vals(self, line, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
This method must return a dict of vals that can be passed to create
|
This method must return a dict of vals that can be passed to create
|
||||||
method of statement line in order to record it. It is the responsibility
|
method of statement line in order to record it. It is the
|
||||||
of every parser to give this dict of vals, so each one can implement his
|
responsibility of every parser to give this dict of vals, so each one
|
||||||
own way of recording the lines.
|
can implement his own way of recording the lines.
|
||||||
:param: line: a dict of vals that represent a line of
|
:param: line: a dict of vals that represent a line of
|
||||||
result_row_list
|
result_row_list
|
||||||
:return: dict of values to give to the create method of statement
|
:return: dict of values to give to the create method of statement
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ class BankStatementImportParser(object):
|
|||||||
def __init__(self, profile, *args, **kwargs):
|
def __init__(self, profile, *args, **kwargs):
|
||||||
# The name of the parser as it will be called
|
# The name of the parser as it will be called
|
||||||
self.parser_name = profile.import_type
|
self.parser_name = profile.import_type
|
||||||
# The result as a list of row. One row per line of data in the file, but
|
# The result as a list of row. One row per line of data in the file,
|
||||||
# not the commission one !
|
# but not the commission one!
|
||||||
self.result_row_list = None
|
self.result_row_list = None
|
||||||
# The file buffer on which to work on
|
# The file buffer on which to work on
|
||||||
self.filebuffer = None
|
self.filebuffer = None
|
||||||
@@ -128,9 +128,9 @@ class BankStatementImportParser(object):
|
|||||||
|
|
||||||
def get_st_line_vals(self, line, *args, **kwargs):
|
def get_st_line_vals(self, line, *args, **kwargs):
|
||||||
"""Implement a method in your parser that must return a dict of vals
|
"""Implement a method in your parser that must return a dict of vals
|
||||||
that can be passed to create method of statement line in order to record
|
that can be passed to create method of statement line in order to
|
||||||
it. It is the responsibility of every parser to give this dict of vals,
|
record it. It is the responsibility of every parser to give this dict
|
||||||
so each one can implement his own way of recording the lines.
|
of vals, so each one can implement his own way of recording the lines.
|
||||||
|
|
||||||
:param: line: a dict of vals that represent a line of result_row_list
|
:param: line: a dict of vals that represent a line of result_row_list
|
||||||
:return: dict of values to give to the create method of statement line,
|
:return: dict of values to give to the create method of statement line,
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ class AccountStatementProfil(orm.Model):
|
|||||||
context):
|
context):
|
||||||
"""Write the log in the logger
|
"""Write the log in the logger
|
||||||
|
|
||||||
:param int/long statement_id: ID of the concerned account.bank.statement
|
:param int/long statement_id: ID of the concerned
|
||||||
|
account.bank.statement
|
||||||
:param int/long num_lines: Number of line that have been parsed
|
:param int/long num_lines: Number of line that have been parsed
|
||||||
:return: True
|
:return: True
|
||||||
"""
|
"""
|
||||||
@@ -102,7 +103,8 @@ class AccountStatementProfil(orm.Model):
|
|||||||
|
|
||||||
:param dict of vals from parser for account.bank.statement.line
|
:param dict of vals from parser for account.bank.statement.line
|
||||||
(called by parser.get_st_line_vals)
|
(called by parser.get_st_line_vals)
|
||||||
:param int/long statement_id: ID of the concerned account.bank.statement
|
:param int/long statement_id: ID of the concerned
|
||||||
|
account.bank.statement
|
||||||
:return: dict of vals that will be passed to create method of
|
:return: dict of vals that will be passed to create method of
|
||||||
statement line.
|
statement line.
|
||||||
"""
|
"""
|
||||||
@@ -173,8 +175,8 @@ class AccountStatementProfil(orm.Model):
|
|||||||
ftype="csv", context=None):
|
ftype="csv", context=None):
|
||||||
"""Create a bank statement with the given profile and parser. It will
|
"""Create a bank statement with the given profile and parser. It will
|
||||||
fullfill the bank statement with the values of the file providen, but
|
fullfill the bank statement with the values of the file providen, but
|
||||||
will not complete data (like finding the partner, or the right account).
|
will not complete data (like finding the partner, or the right
|
||||||
This will be done in a second step with the completion rules.
|
account). This will be done in a second step with the completion rules.
|
||||||
|
|
||||||
:param prof : The profile used to import the file
|
:param prof : The profile used to import the file
|
||||||
:param parser: the parser
|
:param parser: the parser
|
||||||
|
|||||||
@@ -31,9 +31,9 @@
|
|||||||
'account_statement_base_import'
|
'account_statement_base_import'
|
||||||
],
|
],
|
||||||
'description': """
|
'description': """
|
||||||
This module brings commission support to bank statement imports. It computes the
|
This module brings commission support to bank statement imports. It computes
|
||||||
sum of a commission field on each transaction and creates a statement entry for
|
the sum of a commission field on each transaction and creates a statement
|
||||||
it.
|
entry for it.
|
||||||
""",
|
""",
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'http://www.camptocamp.com',
|
||||||
'data': [
|
'data': [
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ class AccountStatementProfil(orm.Model):
|
|||||||
commission_analytic_id = profile.commission_analytic_id.id
|
commission_analytic_id = profile.commission_analytic_id.id
|
||||||
comm_values = {
|
comm_values = {
|
||||||
'name': 'IN ' + _('Commission line'),
|
'name': 'IN ' + _('Commission line'),
|
||||||
'date': parser.get_st_vals().get('date') or datetime.datetime.now(),
|
'date': parser.get_st_vals().get('date') or
|
||||||
|
datetime.datetime.now(),
|
||||||
'amount': global_commission_amount,
|
'amount': global_commission_amount,
|
||||||
'partner_id': partner_id,
|
'partner_id': partner_id,
|
||||||
'type': 'general',
|
'type': 'general',
|
||||||
@@ -32,8 +33,8 @@ class AccountStatementProfil(orm.Model):
|
|||||||
'account_id': commission_account_id,
|
'account_id': commission_account_id,
|
||||||
'ref': 'commission',
|
'ref': 'commission',
|
||||||
'analytic_account_id': commission_analytic_id,
|
'analytic_account_id': commission_analytic_id,
|
||||||
# !! We set the already_completed so auto-completion will not update
|
# !! We set the already_completed so auto-completion will not
|
||||||
# those values!
|
# update those values!
|
||||||
'already_completed': True,
|
'already_completed': True,
|
||||||
}
|
}
|
||||||
st_obj = self.pool['account.bank.statement.line']
|
st_obj = self.pool['account.bank.statement.line']
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ class AccountStatementLabel(orm.Model):
|
|||||||
'label': fields.char('Bank Statement Label', size=100),
|
'label': fields.char('Bank Statement Label', size=100),
|
||||||
'account_id': fields.many2one('account.account', 'Account',
|
'account_id': fields.many2one('account.account', 'Account',
|
||||||
required=True,
|
required=True,
|
||||||
help='Account corresponding to the label '
|
help='Account corresponding to the '
|
||||||
'for a given partner'),
|
'label for a given partner'),
|
||||||
'company_id': fields.related('account_id', 'company_id',
|
'company_id': fields.related('account_id', 'company_id',
|
||||||
type='many2one',
|
type='many2one',
|
||||||
relation='res.company',
|
relation='res.company',
|
||||||
|
|||||||
@@ -45,8 +45,8 @@
|
|||||||
Features:
|
Features:
|
||||||
|
|
||||||
1) Improve the bank statement: allows to define profiles (for each Office or
|
1) Improve the bank statement: allows to define profiles (for each Office or
|
||||||
Bank). The bank statement will then generate the entries based on some criteria
|
Bank). The bank statement will then generate the entries based on some
|
||||||
chosen in the selected profile. You can setup on the profile:
|
criteria chosen in the selected profile. You can setup on the profile:
|
||||||
|
|
||||||
- the journal to use
|
- the journal to use
|
||||||
- use balance check or not
|
- use balance check or not
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ class AccountStatementProfile(orm.Model):
|
|||||||
'name': fields.char('Name', required=True),
|
'name': fields.char('Name', required=True),
|
||||||
'sequence': fields.integer(
|
'sequence': fields.integer(
|
||||||
'Sequence',
|
'Sequence',
|
||||||
help="Gives a sequence in lists, the first profile will be used as "
|
help="Gives a sequence in lists, the first profile will be used "
|
||||||
"default"),
|
"as default"),
|
||||||
'partner_id': fields.many2one(
|
'partner_id': fields.many2one(
|
||||||
'res.partner',
|
'res.partner',
|
||||||
'Bank/Payment Office partner',
|
'Bank/Payment Office partner',
|
||||||
@@ -144,7 +144,8 @@ class AccountBankStatement(orm.Model):
|
|||||||
profile_obj = self.pool['account.statement.profile']
|
profile_obj = self.pool['account.statement.profile']
|
||||||
user = user_obj.browse(cr, uid, uid, context=context)
|
user = user_obj.browse(cr, uid, uid, context=context)
|
||||||
profile_ids = profile_obj.search(
|
profile_ids = profile_obj.search(
|
||||||
cr, uid, [('company_id', '=', user.company_id.id)], context=context)
|
cr, uid, [('company_id', '=', user.company_id.id)], context=context
|
||||||
|
)
|
||||||
return profile_ids[0] if profile_ids else False
|
return profile_ids[0] if profile_ids else False
|
||||||
|
|
||||||
def _get_statement_from_profile(self, cr, uid, profile_ids, context=None):
|
def _get_statement_from_profile(self, cr, uid, profile_ids, context=None):
|
||||||
@@ -304,7 +305,8 @@ class AccountBankStatement(orm.Model):
|
|||||||
line if different from the statement line account ID
|
line if different from the statement line account ID
|
||||||
:param int/long analytic_id: ID of analytic account to put on the
|
:param int/long analytic_id: ID of analytic account to put on the
|
||||||
move line
|
move line
|
||||||
:param int/long partner_id: ID of the partner to put on the move line
|
:param int/long partner_id: ID of the partner to put on the move
|
||||||
|
line
|
||||||
:return: dict of value to create() the account.move.line
|
:return: dict of value to create() the account.move.line
|
||||||
"""
|
"""
|
||||||
if context is None:
|
if context is None:
|
||||||
@@ -496,10 +498,10 @@ class AccountBankStatement(orm.Model):
|
|||||||
self, cr, uid, amount, account_receivable, account_payable,
|
self, cr, uid, amount, account_receivable, account_payable,
|
||||||
partner_id=False):
|
partner_id=False):
|
||||||
"""
|
"""
|
||||||
Give the amount, payable and receivable account (that can be found using
|
Give the amount, payable and receivable account (that can be found
|
||||||
get_default_pay_receiv_accounts method) and receive the one to use. This
|
using get_default_pay_receiv_accounts method) and receive the one to
|
||||||
method should be use when there is no other way to know which one to
|
use. This method should be use when there is no other way to know which
|
||||||
take. The rules are:
|
one to take. The rules are:
|
||||||
- If the customer checkbox is checked on the found partner, type and
|
- If the customer checkbox is checked on the found partner, type and
|
||||||
account will be customer and receivable
|
account will be customer and receivable
|
||||||
- If the supplier checkbox is checked on the found partner, type and
|
- If the supplier checkbox is checked on the found partner, type and
|
||||||
@@ -617,7 +619,8 @@ class AccountBankStatementLine(orm.Model):
|
|||||||
_columns = {
|
_columns = {
|
||||||
# Set them as required + 64 char instead of 32
|
# Set them as required + 64 char instead of 32
|
||||||
'ref': fields.char('Reference', size=64, required=True),
|
'ref': fields.char('Reference', size=64, required=True),
|
||||||
'period_id': fields.many2one('account.period', 'Period', required=True),
|
'period_id': fields.many2one(
|
||||||
|
'account.period', 'Period', required=True),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'period_id': _get_period,
|
'period_id': _get_period,
|
||||||
@@ -732,8 +735,8 @@ class AccountBankStatementLine(orm.Model):
|
|||||||
'voucher_id': False}}
|
'voucher_id': False}}
|
||||||
return {'value': {'type': line_type}}
|
return {'value': {'type': line_type}}
|
||||||
|
|
||||||
def onchange_type(self, cr, uid, line_id, partner_id, line_type, profile_id,
|
def onchange_type(self, cr, uid, line_id, partner_id, line_type,
|
||||||
context=None):
|
profile_id, context=None):
|
||||||
"""Keep the same features as in standard and call super. If an account
|
"""Keep the same features as in standard and call super. If an account
|
||||||
is returned, call the method to compute line values.
|
is returned, call the method to compute line values.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ if not hasattr(std_pos_session, '_prepare_bank_statement'):
|
|||||||
cr, uid, [('type', '=', 'cash')], context=context)
|
cr, uid, [('type', '=', 'cash')], context=context)
|
||||||
if not cashids:
|
if not cashids:
|
||||||
cashids = journal_proxy.search(
|
cashids = journal_proxy.search(
|
||||||
cr, uid, [('journal_user', '=', True)], context=context)
|
cr, uid, [('journal_user', '=', True)],
|
||||||
|
context=context)
|
||||||
jobj.write(
|
jobj.write(
|
||||||
cr, uid, [pos_config.id], {'journal_ids': [(6, 0, cashids)]})
|
cr, uid, [pos_config.id], {'journal_ids': [(6, 0, cashids)]})
|
||||||
pos_config = jobj.browse(cr, uid, config_id, context=context)
|
pos_config = jobj.browse(cr, uid, config_id, context=context)
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ class AccountBankStatement(orm.Model):
|
|||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id,
|
def create_move_from_st_line(self, cr, uid, st_line_id,
|
||||||
|
company_currency_id,
|
||||||
st_line_number, context=None):
|
st_line_number, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
|||||||
@@ -87,12 +87,14 @@ class test_regex_account_completion(common.TransactionCase):
|
|||||||
"""Test the automatic completion on account
|
"""Test the automatic completion on account
|
||||||
"""
|
"""
|
||||||
self.prepare()
|
self.prepare()
|
||||||
statement_obj = self.st_obj.browse(self.cr, self.uid, self.statement_id)
|
statement_obj = self.st_obj.browse(
|
||||||
|
self.cr, self.uid, self.statement_id)
|
||||||
statement_obj.button_auto_completion()
|
statement_obj.button_auto_completion()
|
||||||
statement_line1 = self.st_line_obj.browse(
|
statement_line1 = self.st_line_obj.browse(
|
||||||
self.cr, self.uid, self.statement_line1_id)
|
self.cr, self.uid, self.statement_line1_id)
|
||||||
self.assertEquals(self.account_id, statement_line1.account_id.id,
|
self.assertEquals(self.account_id, statement_line1.account_id.id,
|
||||||
"The account should be the account of the completion")
|
"The account should be the account of the completion"
|
||||||
|
)
|
||||||
statement_line2 = self.st_line_obj.browse(
|
statement_line2 = self.st_line_obj.browse(
|
||||||
self.cr, self.uid, self.statement_line2_id)
|
self.cr, self.uid, self.statement_line2_id)
|
||||||
self.assertNotEqual(self.account_id, statement_line2.account_id.id,
|
self.assertNotEqual(self.account_id, statement_line2.account_id.id,
|
||||||
|
|||||||
@@ -151,7 +151,8 @@ class AccountBankStatement(Model):
|
|||||||
|
|
||||||
:param browse_record st_line: account.bank.statement.line record to
|
:param browse_record st_line: account.bank.statement.line record to
|
||||||
create the move from.
|
create the move from.
|
||||||
:param int/long move_id: ID of the account.move to link the move line
|
:param int/long move_id: ID of the account.move to link the move
|
||||||
|
line
|
||||||
:param float debit: debit amount of the move line
|
:param float debit: debit amount of the move line
|
||||||
:param float credit: credit amount of the move line
|
:param float credit: credit amount of the move line
|
||||||
:param int/long currency_id: ID of currency of the move line to
|
:param int/long currency_id: ID of currency of the move line to
|
||||||
@@ -162,7 +163,8 @@ class AccountBankStatement(Model):
|
|||||||
line if different from the statement line account ID
|
line if different from the statement line account ID
|
||||||
:param int/long analytic_id: ID of analytic account to put on the
|
:param int/long analytic_id: ID of analytic account to put on the
|
||||||
move line
|
move line
|
||||||
:param int/long partner_id: ID of the partner to put on the move line
|
:param int/long partner_id: ID of the partner to put on the move
|
||||||
|
line
|
||||||
:return: dict of value to create() the account.move.line
|
:return: dict of value to create() the account.move.line
|
||||||
"""
|
"""
|
||||||
res = super(AccountBankStatement, self)._prepare_move_line_vals(
|
res = super(AccountBankStatement, self)._prepare_move_line_vals(
|
||||||
|
|||||||
@@ -35,9 +35,9 @@
|
|||||||
the importation of different bank and offices that uses transactionID.
|
the importation of different bank and offices that uses transactionID.
|
||||||
|
|
||||||
This module allows you to import your bank transactions with a standard .csv
|
This module allows you to import your bank transactions with a standard .csv
|
||||||
or .xls file (you'll find samples in the 'data' folder). It respects the chosen
|
or .xls file (you'll find samples in the 'data' folder). It respects the
|
||||||
profile (model provided by the account_statement_ext module) to generate the
|
chosen profile (model provided by the account_statement_ext module) to
|
||||||
entries.
|
generate the entries.
|
||||||
|
|
||||||
This module can handle a commission taken by the payment office and has the
|
This module can handle a commission taken by the payment office and has the
|
||||||
following format:
|
following format:
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
* amount: amount paid in the currency of the journal used in the importation
|
* amount: amount paid in the currency of the journal used in the importation
|
||||||
profile
|
profile
|
||||||
* commission_amount: amount of the comission for each line
|
* commission_amount: amount of the comission for each line
|
||||||
* label: the comunication given by the payment office, used as communication in
|
* label: the comunication given by the payment office, used as communication
|
||||||
the generated entries.
|
in the generated entries.
|
||||||
""",
|
""",
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'http://www.camptocamp.com',
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ class TransactionIDFileParser(FileParser):
|
|||||||
|
|
||||||
def get_st_line_vals(self, line, *args, **kwargs):
|
def get_st_line_vals(self, line, *args, **kwargs):
|
||||||
"""This method must return a dict of vals that can be passed to create
|
"""This method must return a dict of vals that can be passed to create
|
||||||
method of statement line in order to record it. It is the responsibility
|
method of statement line in order to record it. It is the
|
||||||
of every parser to give this dict of vals, so each one can implement his
|
responsibility of every parser to give this dict of vals, so each one
|
||||||
own way of recording the lines.
|
can implement his own way of recording the lines.
|
||||||
:param: line: a dict of vals that represent a line of
|
:param: line: a dict of vals that represent a line of
|
||||||
result_row_list
|
result_row_list
|
||||||
:return: dict of values to give to the create method of statement
|
:return: dict of values to give to the create method of statement
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ class AccountStatementFromInvoiceLines(orm.TransientModel):
|
|||||||
elif (line.invoice and
|
elif (line.invoice and
|
||||||
line.invoice.currency_id.id != statement.currency.id):
|
line.invoice.currency_id.id != statement.currency.id):
|
||||||
amount = currency_obj.compute(
|
amount = currency_obj.compute(
|
||||||
cr, uid, line.invoice.currency_id.id, statement.currency.id,
|
cr, uid, line.invoice.currency_id.id,
|
||||||
amount, context=ctx)
|
statement.currency.id, amount, context=ctx)
|
||||||
context.update({'move_line_ids': [line.id],
|
context.update({'move_line_ids': [line.id],
|
||||||
'invoice_id': line.invoice.id})
|
'invoice_id': line.invoice.id})
|
||||||
s_type = 'general'
|
s_type = 'general'
|
||||||
|
|||||||
Reference in New Issue
Block a user