mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[TYPO]
This commit is contained in:
@@ -55,11 +55,11 @@ class AccountStatementProfil(orm.Model):
|
|||||||
_inherit = "account.statement.profile"
|
_inherit = "account.statement.profile"
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
# @Akretion : For now, we don't implement this features, but this would probably be there:
|
# @Akretion: For now, we don't implement this features, but this would probably be there:
|
||||||
# 'auto_completion': fields.text('Auto Completion'),
|
# 'auto_completion': fields.text('Auto Completion'),
|
||||||
# 'transferts_account_id':fields.many2one('account.account', 'Transferts Account'),
|
# 'transferts_account_id':fields.many2one('account.account', 'Transferts Account'),
|
||||||
# => You can implement it in a module easily, we design it with your needs in mind
|
# => You can implement it in a module easily, we design it with your needs in mind
|
||||||
# as well !
|
# as well!
|
||||||
|
|
||||||
'rule_ids': fields.many2many(
|
'rule_ids': fields.many2many(
|
||||||
'account.statement.completion.rule',
|
'account.statement.completion.rule',
|
||||||
@@ -86,7 +86,7 @@ class AccountStatementProfil(orm.Model):
|
|||||||
A dict of value that can be passed directly to the write method of
|
A dict of value that can be passed directly to the write method of
|
||||||
the statement line or {}
|
the statement line or {}
|
||||||
{'partner_id': value,
|
{'partner_id': value,
|
||||||
'account_id' : value,
|
'account_id: value,
|
||||||
|
|
||||||
...}
|
...}
|
||||||
"""
|
"""
|
||||||
@@ -195,7 +195,7 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
A dict of value that can be passed directly to the write method of
|
A dict of value that can be passed directly to the write method of
|
||||||
the statement line or {}
|
the statement line or {}
|
||||||
{'partner_id': value,
|
{'partner_id': value,
|
||||||
'account_id' : value,
|
'account_id': value,
|
||||||
|
|
||||||
...}
|
...}
|
||||||
"""
|
"""
|
||||||
@@ -213,7 +213,7 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
A dict of value that can be passed directly to the write method of
|
A dict of value that can be passed directly to the write method of
|
||||||
the statement line or {}
|
the statement line or {}
|
||||||
{'partner_id': value,
|
{'partner_id': value,
|
||||||
'account_id' : value,
|
'account_id': value,
|
||||||
...}
|
...}
|
||||||
"""
|
"""
|
||||||
return self._from_invoice(cr, uid, line, 'customer', context=context)
|
return self._from_invoice(cr, uid, line, 'customer', context=context)
|
||||||
@@ -230,7 +230,7 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
A dict of value that can be passed directly to the write method of
|
A dict of value that can be passed directly to the write method of
|
||||||
the statement line or {}
|
the statement line or {}
|
||||||
{'partner_id': value,
|
{'partner_id': value,
|
||||||
'account_id' : value,
|
'account_id': value,
|
||||||
|
|
||||||
...}
|
...}
|
||||||
"""
|
"""
|
||||||
@@ -275,7 +275,7 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
A dict of value that can be passed directly to the write method of
|
A dict of value that can be passed directly to the write method of
|
||||||
the statement line or {}
|
the statement line or {}
|
||||||
{'partner_id': value,
|
{'partner_id': value,
|
||||||
'account_id' : value,
|
'account_id': value,
|
||||||
|
|
||||||
...}
|
...}
|
||||||
"""
|
"""
|
||||||
@@ -333,7 +333,7 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
A dict of value that can be passed directly to the write method of
|
A dict of value that can be passed directly to the write method of
|
||||||
the statement line or {}
|
the statement line or {}
|
||||||
{'partner_id': value,
|
{'partner_id': value,
|
||||||
'account_id' : value,
|
'account_id': value,
|
||||||
|
|
||||||
...}
|
...}
|
||||||
"""
|
"""
|
||||||
@@ -441,7 +441,7 @@ class AccountBankSatement(orm.Model):
|
|||||||
:param int/long stat_id: ID of the account.bank.statement
|
:param int/long stat_id: ID of the account.bank.statement
|
||||||
:param char error_msg: Message to add
|
:param char error_msg: Message to add
|
||||||
:number_imported int/long: Number of lines that have been completed
|
:number_imported int/long: Number of lines that have been completed
|
||||||
:return : True
|
:return True
|
||||||
"""
|
"""
|
||||||
error_log = ""
|
error_log = ""
|
||||||
user_name = self.pool.get('res.users').read(cr, uid, uid,
|
user_name = self.pool.get('res.users').read(cr, uid, uid,
|
||||||
@@ -469,7 +469,7 @@ class AccountBankSatement(orm.Model):
|
|||||||
def button_auto_completion(self, cr, uid, ids, context=None):
|
def button_auto_completion(self, cr, uid, ids, context=None):
|
||||||
"""
|
"""
|
||||||
Complete line with values given by rules and tic the already_completed
|
Complete line with values given by rules and tic the already_completed
|
||||||
checkbox so we won't compute them again unless the user untick them !
|
checkbox so we won't compute them again unless the user untick them!
|
||||||
"""
|
"""
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class AccountStatementProfil(Model):
|
|||||||
:param: browse_record of the current parser
|
:param: browse_record of the current parser
|
||||||
:param: result_row_list: [{'key':value}]
|
:param: result_row_list: [{'key':value}]
|
||||||
:param: profile: browserecord of account.statement.profile
|
:param: profile: browserecord of account.statement.profile
|
||||||
:param: statement_id : int/long of the current importing statement ID
|
:param: statement_id: int/long of the current importing statement ID
|
||||||
:param: context: global context
|
:param: context: global context
|
||||||
return: dict of vals that will be passed to create method of statement line.
|
return: dict of vals that will be passed to create method of statement line.
|
||||||
"""
|
"""
|
||||||
@@ -102,7 +102,7 @@ class AccountStatementProfil(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 those values !
|
# !! We set the already_completed so auto-completion will not update those values!
|
||||||
'already_completed': True,
|
'already_completed': True,
|
||||||
}
|
}
|
||||||
return comm_values
|
return comm_values
|
||||||
@@ -120,7 +120,7 @@ class AccountStatementProfil(Model):
|
|||||||
:param int/long account_payable: ID of the receivable account to use
|
:param int/long account_payable: ID of the receivable account to use
|
||||||
:param int/long account_receivable: ID of the payable account to use
|
:param int/long account_receivable: ID of the payable account to use
|
||||||
: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.
|
:return: dict of vals that will be passed to create method of statement line.
|
||||||
"""
|
"""
|
||||||
statement_obj = self.pool.get('account.bank.statement')
|
statement_obj = self.pool.get('account.bank.statement')
|
||||||
values = parser_vals
|
values = parser_vals
|
||||||
@@ -166,22 +166,22 @@ class AccountStatementProfil(Model):
|
|||||||
attachment_obj = self.pool.get('ir.attachment')
|
attachment_obj = self.pool.get('ir.attachment')
|
||||||
prof_obj = self.pool.get("account.statement.profile")
|
prof_obj = self.pool.get("account.statement.profile")
|
||||||
if not profile_id:
|
if not profile_id:
|
||||||
raise osv.except_osv(_("No Profile !"),
|
raise osv.except_osv(_("No Profile!"),
|
||||||
_("You must provide a valid profile to import a bank statement !"))
|
_("You must provide a valid profile to import a bank statement!"))
|
||||||
prof = prof_obj.browse(cr, uid, profile_id, context=context)
|
prof = prof_obj.browse(cr, uid, profile_id, context=context)
|
||||||
|
|
||||||
parser = new_bank_statement_parser(prof.import_type, ftype=ftype)
|
parser = new_bank_statement_parser(prof.import_type, ftype=ftype)
|
||||||
result_row_list = parser.parse(file_stream)
|
result_row_list = parser.parse(file_stream)
|
||||||
# Check all key are present in account.bank.statement.line !!
|
# Check all key are present in account.bank.statement.line!!
|
||||||
if not result_row_list:
|
if not result_row_list:
|
||||||
raise osv.except_osv(_("Nothing to import"),
|
raise osv.except_osv(_("Nothing to import"),
|
||||||
_("The file is empty"))
|
_("The file is empty"))
|
||||||
parsed_cols = parser.get_st_line_vals(result_row_list[0]).keys()
|
parsed_cols = parser.get_st_line_vals(result_row_list[0]).keys()
|
||||||
for col in parsed_cols:
|
for col in parsed_cols:
|
||||||
if col not in statement_line_obj._columns:
|
if col not in statement_line_obj._columns:
|
||||||
raise osv.except_osv(_("Missing column !"),
|
raise osv.except_osv(_("Missing column!"),
|
||||||
_("Column %s you try to import is not "
|
_("Column %s you try to import is not "
|
||||||
"present in the bank statement line !") % col)
|
"present in the bank statement line!") % col)
|
||||||
|
|
||||||
statement_id = statement_obj.create(cr, uid,
|
statement_id = statement_obj.create(cr, uid,
|
||||||
{'profile_id': prof.id},
|
{'profile_id': prof.id},
|
||||||
@@ -228,7 +228,7 @@ class AccountStatementProfil(Model):
|
|||||||
'res_id': statement_id},
|
'res_id': statement_id},
|
||||||
context=context)
|
context=context)
|
||||||
|
|
||||||
# If user ask to launch completion at end of import, do it !
|
# If user ask to launch completion at end of import, do it!
|
||||||
if prof.launch_import_completion:
|
if prof.launch_import_completion:
|
||||||
statement_obj.button_auto_completion(cr, uid, [statement_id], context)
|
statement_obj.button_auto_completion(cr, uid, [statement_id], context)
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ class AccountStatementProfil(Model):
|
|||||||
st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
|
st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
|
||||||
st += ''.join(traceback.format_tb(trbk, 30))
|
st += ''.join(traceback.format_tb(trbk, 30))
|
||||||
raise osv.except_osv(_("Statement import error"),
|
raise osv.except_osv(_("Statement import error"),
|
||||||
_("The statement cannot be created : %s") % st)
|
_("The statement cannot be created: %s") % st)
|
||||||
return statement_id
|
return statement_id
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class AccountStatementProfil(Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
_constraints = [
|
_constraints = [
|
||||||
(_check_partner, "You need to put a partner if you tic the 'Force partner on bank move' !", []),
|
(_check_partner, "You need to put a partner if you tic the 'Force partner on bank move'!", []),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ class AccountBankSatement(Model):
|
|||||||
We have to copy paste a big block of code, changing the error
|
We have to copy paste a big block of code, changing the error
|
||||||
stack + managing period from date.
|
stack + managing period from date.
|
||||||
|
|
||||||
TODO: Log the error in a bank statement field instead of using a popup !
|
TODO: Log the error in a bank statement field instead of using a popup!
|
||||||
"""
|
"""
|
||||||
for st in self.browse(cr, uid, ids, context=context):
|
for st in self.browse(cr, uid, ids, context=context):
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ class AccountBankSatement(Model):
|
|||||||
self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
|
self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
|
||||||
if (not st.journal_id.default_credit_account_id) \
|
if (not st.journal_id.default_credit_account_id) \
|
||||||
or (not st.journal_id.default_debit_account_id):
|
or (not st.journal_id.default_debit_account_id):
|
||||||
raise osv.except_osv(_('Configuration Error !'),
|
raise osv.except_osv(_('Configuration Error!'),
|
||||||
_('Please verify that an account is defined in the journal.'))
|
_('Please verify that an account is defined in the journal.'))
|
||||||
|
|
||||||
if not st.name == '/':
|
if not st.name == '/':
|
||||||
@@ -331,7 +331,7 @@ class AccountBankSatement(Model):
|
|||||||
# End Changes
|
# End Changes
|
||||||
for line in st.move_line_ids:
|
for line in st.move_line_ids:
|
||||||
if line.state != 'valid':
|
if line.state != 'valid':
|
||||||
raise osv.except_osv(_('Error !'),
|
raise osv.except_osv(_('Error!'),
|
||||||
_('The account entries lines are not in valid state.'))
|
_('The account entries lines are not in valid state.'))
|
||||||
# begin changes
|
# begin changes
|
||||||
errors_stack = []
|
errors_stack = []
|
||||||
@@ -339,7 +339,7 @@ class AccountBankSatement(Model):
|
|||||||
try:
|
try:
|
||||||
if st_line.analytic_account_id:
|
if st_line.analytic_account_id:
|
||||||
if not st.journal_id.analytic_journal_id:
|
if not st.journal_id.analytic_journal_id:
|
||||||
raise osv.except_osv(_('No Analytic Journal !'),
|
raise osv.except_osv(_('No Analytic Journal!'),
|
||||||
_("You have to assign an analytic"
|
_("You have to assign an analytic"
|
||||||
" journal on the '%s' journal!") % st.journal_id.name)
|
" journal on the '%s' journal!") % st.journal_id.name)
|
||||||
if not st_line.amount:
|
if not st_line.amount:
|
||||||
@@ -428,7 +428,7 @@ class AccountBankSatement(Model):
|
|||||||
If amount is positif the type and account will be customer and receivable,
|
If amount is positif the type and account will be customer and receivable,
|
||||||
If amount is negativ, the type and account will be supplier and payable
|
If amount is negativ, the type and account will be supplier and payable
|
||||||
Note that we return the payable or receivable account from agrs and not from the optional partner_id
|
Note that we return the payable or receivable account from agrs and not from the optional partner_id
|
||||||
given !
|
given!
|
||||||
|
|
||||||
:param float: amount of the line
|
:param float: amount of the line
|
||||||
:param int/long: account_receivable the receivable account
|
:param int/long: account_receivable the receivable account
|
||||||
|
|||||||
Reference in New Issue
Block a user