banking-addons-team team mailing list archive
-
banking-addons-team team
-
Mailing list archive
-
Message #01169
lp:~florian-dacosta/banking-addons/bank-statement-reconcile-70-possibility-to-add-transfer-lines into lp:banking-addons/bank-statement-reconcile-7.0
Florian da Costa has proposed merging lp:~florian-dacosta/banking-addons/bank-statement-reconcile-70-possibility-to-add-transfer-lines into lp:banking-addons/bank-statement-reconcile-7.0.
Requested reviews:
Sébastien BEAU - http://www.akretion.com (sebastien.beau)
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c)
For more details, see:
https://code.launchpad.net/~florian-dacosta/banking-addons/bank-statement-reconcile-70-possibility-to-add-transfer-lines/+merge/198837
Add possibility to create one or two tranfer lines for credit card deposit bank statement.
Adapt the commission module for this change.
--
https://code.launchpad.net/~florian-dacosta/banking-addons/bank-statement-reconcile-70-possibility-to-add-transfer-lines/+merge/198837
Your team Banking Addons Core Editors is subscribed to branch lp:banking-addons/bank-statement-reconcile-7.0.
=== modified file 'account_statement_base_import/parser/parser.py'
--- account_statement_base_import/parser/parser.py 2013-05-03 19:57:26 +0000
+++ account_statement_base_import/parser/parser.py 2013-12-12 22:05:13 +0000
@@ -49,6 +49,8 @@
self.result_row_list = None
# The file buffer on which to work on
self.filebuffer = None
+ self.refund_transfer = None
+ self.payment_transfer = None
@classmethod
def parser_for(cls, parser_name):
@@ -151,6 +153,22 @@
return self.result_row_list
+ def get_refund_transfer(self, *args, **kwargs):
+ """
+ This is called by the importation method to set the statement
+ refund transfer in the bank statement.
+ return: float of the refund transfer amount (self.refund_transfer)
+ """
+ return self.refund_transfer
+
+ def get_payment_transfer(self, *args, **kwargs):
+ """
+ This is called by the importation method to set the statement
+ transfer in the bank statement.
+ return: float of the transfer amount (self.payment_transfer)
+ """
+ return self.payment_transfer
+
def itersubclasses(cls, _seen=None):
"""
itersubclasses(cls)
=== modified file 'account_statement_base_import/statement.py'
--- account_statement_base_import/statement.py 2013-09-12 09:05:01 +0000
+++ account_statement_base_import/statement.py 2013-12-12 22:05:13 +0000
@@ -54,6 +54,44 @@
}
+ def prepare_payment_tranfer_line_vals(self, cr, uid, parser, result_row_list,
+ profile, statement_id, context=None):
+ partner_id = profile.partner_id and profile.partner_id.id or False
+ transfer_account_id = profile.journal_id.default_credit_account_id.id
+ statement_line_obj = self.pool.get('account.bank.statement.line')
+ return {
+ 'name': _('IN Transfer'),
+ 'date': parser.get_statement_date(),
+ 'amount': parser.get_payment_transfer(),
+ 'partner_id': partner_id,
+ 'type': 'general',
+ 'statement_id': statement_id,
+ 'account_id': transfer_account_id,
+ 'ref': 'transfer',
+ # !! We set the already_completed so auto-completion will not update those values !
+ 'already_completed': True,
+ }
+
+
+ def prepare_refund_tranfer_line_vals(self, cr, uid, parser, result_row_list,
+ profile, statement_id, context=None):
+ partner_id = profile.partner_id and profile.partner_id.id or False
+ transfer_account_id = profile.journal_id.default_credit_account_id.id
+ statement_line_obj = self.pool.get('account.bank.statement.line')
+ return {
+ 'name': _('OUT Transfer'),
+ 'date': parser.get_statement_date(),
+ 'amount': parser.get_refund_transfer(),
+ 'partner_id': partner_id,
+ 'type': 'general',
+ 'statement_id': statement_id,
+ 'account_id': transfer_account_id,
+ 'ref': 'transfer',
+ # !! We set the already_completed so auto-completion will not update those values !
+ 'already_completed': True,
+ }
+
+
def _write_extra_statement_lines(
self, cr, uid, parser, result_row_list, profile, statement_id, context):
"""Insert extra lines after the main statement lines.
@@ -67,7 +105,16 @@
:param: statement_id: int/long of the current importing statement ID
:param: context: global context
"""
- pass
+ statement_line_obj = self.pool.get('account.bank.statement.line')
+ if parser.get_payment_transfer():
+ transfer_vals = self.prepare_payment_tranfer_line_vals(cr, uid, parser, result_row_list,
+ profile, statement_id, context=context)
+ statement_line_obj.create(cr, uid, transfer_vals, context=context)
+ if parser.get_refund_transfer():
+ transfer_vals = self.prepare_refund_tranfer_line_vals(cr, uid, parser, result_row_list,
+ profile, statement_id, context=context)
+ statement_line_obj.create(cr, uid, transfer_vals, context=context)
+
def write_logs_after_import(self, cr, uid, ids, statement_id, num_lines, context):
"""
=== modified file 'account_statement_commission/commission.py'
--- account_statement_commission/commission.py 2013-07-08 18:03:34 +0000
+++ account_statement_commission/commission.py 2013-12-12 22:05:13 +0000
@@ -12,6 +12,8 @@
self, cr, uid, parser, result_row_list, profile, statement_id, context):
"""Prepare the global commission line if there is one.
"""
+ super(AccountStatementProfil,self)._write_extra_statement_lines(cr, uid, parser, result_row_list,
+ profile, statement_id, context=context)
global_commission_amount = 0
for row in parser.result_row_list:
global_commission_amount += float_or_zero(row.get('commission_amount', '0.0'))
=== modified file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py 2013-10-16 08:58:12 +0000
+++ account_statement_ext/statement.py 2013-12-12 22:05:13 +0000
@@ -100,6 +100,10 @@
'profile_id',
'Bank Statement Imported'),
'company_id': fields.many2one('res.company', 'Company'),
+ 'internal_account_transfer_id': fields.many2one('account.account',
+ 'Internal Account Transfer',
+ help="Choose the default account for internal\
+ bank transfer"),
}
def _check_partner(self, cr, uid, ids, context=None):
=== modified file 'account_statement_ext/statement_view.xml'
--- account_statement_ext/statement_view.xml 2013-06-28 15:00:20 +0000
+++ account_statement_ext/statement_view.xml 2013-12-12 22:05:13 +0000
@@ -16,6 +16,7 @@
<field name="commission_account_id" />
<field name="commission_analytic_id" />
<field name="receivable_account_id" />
+ <field name="internal_account_transfer_id"/>
<field name="force_partner_on_bank"/>
<field name="balance_check"/>
<field name="bank_statement_prefix"/>