convert the repo to 79 columns

This commit is contained in:
Leonardo Pistone
2014-08-26 13:27:50 +02:00
parent 733ca47a7a
commit 5ad1ee5a04
25 changed files with 125 additions and 107 deletions

View File

@@ -64,8 +64,8 @@ The base class to find the reconciliations is built to be as efficient as
possible.
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
second month, it will partial reconcile the debit move line with 2 first
month, it will partial reconcile the debit move line with the first payment,
the second month, it will partial reconcile the debit move line with 2 first
payments, the third month, it will make the full reconciliation.
This module is perfectly adapted for E-Commerce business where a big volume of

View File

@@ -186,7 +186,8 @@ class easy_reconcile_advanced(orm.AbstractModel):
If all the matchers match for a move line and an opposite move line,
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)
for matcher in matchers:
try:

View File

@@ -259,14 +259,12 @@ class AccountEasyReconcile(orm.Model):
partial_ids = find_reconcile_ids(
new_cr, 'reconcile_partial_id', all_ml_partial_ids)
self.pool.get('easy.reconcile.history').create(
new_cr, uid,
{'easy_reconcile_id': rec.id,
self.pool.get('easy.reconcile.history').create(new_cr, uid, {
'easy_reconcile_id': rec.id,
'date': fields.datetime.now(),
'reconcile_ids': [(4, rid) for rid in reconcile_ids],
'reconcile_partial_ids': [(4, rid) for rid in partial_ids],
},
context=context)
}, context=context)
finally:
if ctx['commit_every']:
new_cr.commit()

View File

@@ -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.
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
origin (number of a sales order, of an external document like a supplier
The reference of the move lines must be the number of the document at their
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
source document from a ledger).
The description of a line should always be... well, a description. Not a number

View File

@@ -31,8 +31,8 @@
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
partner of a bank statement line.
Each bank statement profile can have its own rules to be applied according to a
sequence order.
Each bank statement profile can have its own rules to be applied according to
a sequence order.
Some basic rules are provided in this module:
@@ -41,15 +41,15 @@
2) Match from statement line label (based on partner name)
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
basic rules only fill in the partner, but you can use them to fill in any
value of the line (in the future, we will add a rule to automatically match and
reconcile the line).
You can easily override this module and add your own rules in your own one.
The basic rules only fill in the partner, but you can use them to fill in
any value of the line (in the future, we will add a rule to automatically
match and reconcile the line).
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'.
Using the pre-define rules, you will be able to match various labels for a
partner.
rules can match) and a char field on the partner called 'Bank Statement
Label'. Using the pre-define rules, you will be able to match various
labels for a partner.
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:
@@ -60,9 +60,9 @@
reconciliation process.
TODO: The rules that look for invoices to find out the partner should take back
the payable / receivable account from there directly instead of retrieving it
from partner properties !
TODO: The rules that look for invoices to find out the partner should take
back the payable / receivable account from there directly instead of
retrieving it from partner properties!
""",
'website': 'http://www.camptocamp.com',
'data': [

View File

@@ -32,8 +32,8 @@ class ResPartner(orm.Model):
'bank_statement_label': fields.char(
'Bank Statement Label', size=100,
help="Enter the various label found on your bank statement "
"separated by a ; If one of this label is include in the bank "
"statement line, the partner will be automatically filled (as "
"long as you use this method/rules in your statement "
"profile)."),
"separated by a ; If one of this label is include in the "
"bank statement line, the partner will be automatically "
"filled (as long as you use this method/rules in your "
"statement profile)."),
}

View File

@@ -124,7 +124,9 @@ class AccountStatementCompletionRule(orm.Model):
_order = "sequence asc"
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 [
('get_from_ref_and_invoice',
'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
def get_from_ref_and_invoice(self, cr, uid, line, context=None):
"""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
complete other values. If more than one partner matched, raise the
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 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
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
and the text defined in the 'bank_statement_label' field of the partner.
Remember that we can have values separated with ; Then, call the generic
get_values_for_line method to complete other values.
If more than one partner matched, raise the ErrorTooManyPartner error.
Match the partner based on the label field of the statement line and
the text defined in the 'bank_statement_label' field of the partner.
Remember that we can have values separated with ; Then, call the
generic get_values_for_line method to complete other values. If more
than one partner matched, raise the ErrorTooManyPartner error.
:param dict st_line: read of the concerned account.bank.statement.line
:return:
@@ -303,10 +305,10 @@ class AccountStatementCompletionRule(orm.Model):
return res
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
and 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
the ErrorTooManyPartner error.
"""Match the partner based on the label field of the statement line and
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 the ErrorTooManyPartner error.
:param dict st_line: read of the concerned account.bank.statement.line
:return:
@@ -386,9 +388,9 @@ class AccountStatement(orm.Model):
class AccountStatementLine(orm.Model):
"""
Add sparse field on the statement line to allow to store all the
bank infos that are given by a bank/office. You can then add you own in your
module. The idea here is to store all bank/office infos in the
Add sparse field on the statement line to allow to store all the bank infos
that are given by a bank/office. You can then add you own in your module.
The idea here is to store all bank/office infos in the
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.
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']
model_cols = statement_line_obj._columns
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]
# add sparse fields..
if include_serializable:
@@ -635,7 +638,8 @@ class AccountBankStatement(orm.Model):
st += ''.join(traceback.format_tb(trbk, 30))
_logger.error(st)
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:
stat_line_obj._update_line(
cr, uid, res, context=context)

View File

@@ -65,8 +65,8 @@ class base_completion(common.TransactionCase):
def test_name_completion(self):
"""Test complete partner_id from statement line label
Test the automatic completion of the partner_id based if the name of the
partner appears in the statement line label
Test the automatic completion of the partner_id based if the name of
the partner appears in the statement line label
"""
self.completion_rule_id = self.ref(
'account_statement_base_completion.'
@@ -89,7 +89,8 @@ class base_completion(common.TransactionCase):
for case in NAMES_COMPLETION_CASES:
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(
self.cr, self.uid, {
'amount': 1000.0,
@@ -116,5 +117,6 @@ class base_completion(common.TransactionCase):
else:
self.assertNotEquals(
self.partner_id, statement_line.partner_id['id'],
"Partner id should be empty after completion(partner_name: "
"%s, line_name: %s)" % (case.partner_name, case.line_label))
"Partner id should be empty after completion "
"(partner_name: %s, line_name: %s)"
% (case.partner_name, case.line_label))

View File

@@ -57,8 +57,8 @@
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
to add your own format. Then, if you need to complete data from there, add your
own account_statement_*_completion module and implement the needed rules.
to add your own format. Then, if you need to complete data from there, add
your own account_statement_*_completion module and implement the needed rules.
""",
'website': 'http://www.camptocamp.com',
'data': [

View File

@@ -181,9 +181,9 @@ class FileParser(BankStatementImportParser):
except Exception as err:
raise except_orm(
_("Date format is not valid"),
_("Please modify the cell formatting to date format"
" for column: %s value: %s\n Please check the "
"line with ref: %s\n \n Detail: %s") %
_("Please modify the cell formatting to date "
"format for column: %s value: %s\n Please check "
"the line with ref: %s\n \n Detail: %s") %
(rule, line.get(rule, _('Missing')),
line.get('ref', line), repr(err)))
else:

View File

@@ -24,8 +24,9 @@ from file_parser import FileParser
class GenericFileParser(FileParser):
"""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
parser, but will also be useful as it allow to import a basic flat file.
bank statement. This is mostely an example of how to proceed to create a
new parser, but will also be useful as it allow to import a basic flat
file.
"""
def __init__(self, parse_name, ftype='csv', **kwargs):
@@ -42,9 +43,9 @@ class GenericFileParser(FileParser):
def get_st_line_vals(self, line, *args, **kwargs):
"""
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
of every parser to give this dict of vals, so each one can implement his
own way of recording the lines.
method of statement line in order to record it. It is the
responsibility of every parser to give this dict 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
:return: dict of values to give to the create method of statement

View File

@@ -48,8 +48,8 @@ class BankStatementImportParser(object):
def __init__(self, profile, *args, **kwargs):
# The name of the parser as it will be called
self.parser_name = profile.import_type
# The result as a list of row. One row per line of data in the file, but
# not the commission one !
# The result as a list of row. One row per line of data in the file,
# but not the commission one!
self.result_row_list = None
# The file buffer on which to work on
self.filebuffer = None
@@ -128,9 +128,9 @@ class BankStatementImportParser(object):
def get_st_line_vals(self, line, *args, **kwargs):
"""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
it. It is the responsibility of every parser to give this dict of vals,
so each one can implement his own way of recording the lines.
that can be passed to create method of statement line in order to
record it. It is the responsibility of every parser to give this dict
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
:return: dict of values to give to the create method of statement line,

View File

@@ -80,7 +80,8 @@ class AccountStatementProfil(orm.Model):
context):
"""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
:return: True
"""
@@ -102,7 +103,8 @@ class AccountStatementProfil(orm.Model):
:param dict of vals from parser for account.bank.statement.line
(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
statement line.
"""
@@ -173,8 +175,8 @@ class AccountStatementProfil(orm.Model):
ftype="csv", context=None):
"""Create a bank statement with the given profile and parser. It will
fullfill the bank statement with the values of the file providen, but
will not complete data (like finding the partner, or the right account).
This will be done in a second step with the completion rules.
will not complete data (like finding the partner, or the right
account). This will be done in a second step with the completion rules.
:param prof : The profile used to import the file
:param parser: the parser

View File

@@ -31,9 +31,9 @@
'account_statement_base_import'
],
'description': """
This module brings commission support to bank statement imports. It computes the
sum of a commission field on each transaction and creates a statement entry for
it.
This module brings commission support to bank statement imports. It computes
the sum of a commission field on each transaction and creates a statement
entry for it.
""",
'website': 'http://www.camptocamp.com',
'data': [

View File

@@ -24,7 +24,8 @@ class AccountStatementProfil(orm.Model):
commission_analytic_id = profile.commission_analytic_id.id
comm_values = {
'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,
'partner_id': partner_id,
'type': 'general',
@@ -32,8 +33,8 @@ class AccountStatementProfil(orm.Model):
'account_id': commission_account_id,
'ref': 'commission',
'analytic_account_id': commission_analytic_id,
# !! We set the already_completed so auto-completion will not update
# those values!
# !! We set the already_completed so auto-completion will not
# update those values!
'already_completed': True,
}
st_obj = self.pool['account.bank.statement.line']

View File

@@ -125,8 +125,8 @@ class AccountStatementLabel(orm.Model):
'label': fields.char('Bank Statement Label', size=100),
'account_id': fields.many2one('account.account', 'Account',
required=True,
help='Account corresponding to the label '
'for a given partner'),
help='Account corresponding to the '
'label for a given partner'),
'company_id': fields.related('account_id', 'company_id',
type='many2one',
relation='res.company',

View File

@@ -45,8 +45,8 @@
Features:
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
chosen in the selected profile. You can setup on the profile:
Bank). The bank statement will then generate the entries based on some
criteria chosen in the selected profile. You can setup on the profile:
- the journal to use
- use balance check or not

View File

@@ -52,8 +52,8 @@ class AccountStatementProfile(orm.Model):
'name': fields.char('Name', required=True),
'sequence': fields.integer(
'Sequence',
help="Gives a sequence in lists, the first profile will be used as "
"default"),
help="Gives a sequence in lists, the first profile will be used "
"as default"),
'partner_id': fields.many2one(
'res.partner',
'Bank/Payment Office partner',
@@ -144,7 +144,8 @@ class AccountBankStatement(orm.Model):
profile_obj = self.pool['account.statement.profile']
user = user_obj.browse(cr, uid, uid, context=context)
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
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
:param int/long analytic_id: ID of analytic account to put on the
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
"""
if context is None:
@@ -496,10 +498,10 @@ class AccountBankStatement(orm.Model):
self, cr, uid, amount, account_receivable, account_payable,
partner_id=False):
"""
Give the amount, payable and receivable account (that can be found using
get_default_pay_receiv_accounts method) and receive the one to use. This
method should be use when there is no other way to know which one to
take. The rules are:
Give the amount, payable and receivable account (that can be found
using get_default_pay_receiv_accounts method) and receive the one to
use. This method should be use when there is no other way to know which
one to take. The rules are:
- If the customer checkbox is checked on the found partner, type and
account will be customer and receivable
- If the supplier checkbox is checked on the found partner, type and
@@ -617,7 +619,8 @@ class AccountBankStatementLine(orm.Model):
_columns = {
# Set them as required + 64 char instead of 32
'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 = {
'period_id': _get_period,
@@ -732,8 +735,8 @@ class AccountBankStatementLine(orm.Model):
'voucher_id': False}}
return {'value': {'type': line_type}}
def onchange_type(self, cr, uid, line_id, partner_id, line_type, profile_id,
context=None):
def onchange_type(self, cr, uid, line_id, partner_id, line_type,
profile_id, context=None):
"""Keep the same features as in standard and call super. If an account
is returned, call the method to compute line values.
"""

View File

@@ -82,7 +82,8 @@ if not hasattr(std_pos_session, '_prepare_bank_statement'):
cr, uid, [('type', '=', 'cash')], context=context)
if not cashids:
cashids = journal_proxy.search(
cr, uid, [('journal_user', '=', True)], context=context)
cr, uid, [('journal_user', '=', True)],
context=context)
jobj.write(
cr, uid, [pos_config.id], {'journal_ids': [(6, 0, cashids)]})
pos_config = jobj.browse(cr, uid, config_id, context=context)

View File

@@ -65,7 +65,8 @@ class AccountBankStatement(orm.Model):
})
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):
if context is None:
context = {}

View File

@@ -87,12 +87,14 @@ class test_regex_account_completion(common.TransactionCase):
"""Test the automatic completion on account
"""
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_line1 = self.st_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")
"The account should be the account of the completion"
)
statement_line2 = self.st_line_obj.browse(
self.cr, self.uid, self.statement_line2_id)
self.assertNotEqual(self.account_id, statement_line2.account_id.id,

View File

@@ -151,7 +151,8 @@ class AccountBankStatement(Model):
:param browse_record st_line: account.bank.statement.line record to
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 credit: credit amount of the move line
: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
:param int/long analytic_id: ID of analytic account to put on the
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
"""
res = super(AccountBankStatement, self)._prepare_move_line_vals(

View File

@@ -35,9 +35,9 @@
the importation of different bank and offices that uses transactionID.
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
profile (model provided by the account_statement_ext module) to generate the
entries.
or .xls file (you'll find samples in the 'data' folder). It respects the
chosen profile (model provided by the account_statement_ext module) to
generate the entries.
This module can handle a commission taken by the payment office and has the
following format:
@@ -48,8 +48,8 @@
* amount: amount paid in the currency of the journal used in the importation
profile
* commission_amount: amount of the comission for each line
* label: the comunication given by the payment office, used as communication in
the generated entries.
* label: the comunication given by the payment office, used as communication
in the generated entries.
""",
'website': 'http://www.camptocamp.com',
'installable': True,

View File

@@ -54,9 +54,9 @@ class TransactionIDFileParser(FileParser):
def get_st_line_vals(self, line, *args, **kwargs):
"""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
of every parser to give this dict of vals, so each one can implement his
own way of recording the lines.
method of statement line in order to record it. It is the
responsibility of every parser to give this dict 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
:return: dict of values to give to the create method of statement

View File

@@ -62,8 +62,8 @@ class AccountStatementFromInvoiceLines(orm.TransientModel):
elif (line.invoice and
line.invoice.currency_id.id != statement.currency.id):
amount = currency_obj.compute(
cr, uid, line.invoice.currency_id.id, statement.currency.id,
amount, context=ctx)
cr, uid, line.invoice.currency_id.id,
statement.currency.id, amount, context=ctx)
context.update({'move_line_ids': [line.id],
'invoice_id': line.invoice.id})
s_type = 'general'