diff --git a/account_advanced_reconcile_transaction_ref/__init__.py b/account_advanced_reconcile_transaction_ref/__init__.py index 2b663dd0..e19ad65a 100644 --- a/account_advanced_reconcile_transaction_ref/__init__.py +++ b/account_advanced_reconcile_transaction_ref/__init__.py @@ -18,7 +18,6 @@ # ############################################################################## -from . import account from . import easy_reconcile from . import base_advanced_reconciliation from . import advanced_reconciliation diff --git a/account_advanced_reconcile_transaction_ref/__openerp__.py b/account_advanced_reconcile_transaction_ref/__openerp__.py index bd1586cf..d2b0d1cc 100644 --- a/account_advanced_reconcile_transaction_ref/__openerp__.py +++ b/account_advanced_reconcile_transaction_ref/__openerp__.py @@ -20,8 +20,8 @@ {'name': 'Advanced Reconcile Transaction Ref', 'description': """ -Advanced reconciliation method for the module account_easy_reconcile -================================================= +Advanced reconciliation method for the module account_advanced_reconcile +======================================================================== Reconcile rules with transaction_ref """, diff --git a/account_advanced_reconcile_transaction_ref/account.py b/account_advanced_reconcile_transaction_ref/account.py deleted file mode 100644 index b3e2cd24..00000000 --- a/account_advanced_reconcile_transaction_ref/account.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Romain Deheele -# Copyright 2013 Camptocamp SA -# -# 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 . -# -############################################################################## - -from openerp.osv.orm import Model, fields - -class AccountMoveLine(Model): - """ - Inherit account.move.line class in order to add transaction_ref field - """ - _inherit = "account.move.line" - _columns = { - 'transaction_ref': fields.char('Transaction Ref.', size=128), - } - -class AccountBankStatement(Model): - """ - Inherit account.bank.statement class in order to set transaction_ref info on account.move.line - """ - _inherit = "account.bank.statement" - - def _prepare_move_line_vals( - self, cr, uid, st_line, move_id, debit, credit, currency_id=False, - amount_currency=False, account_id=False, analytic_id=False, - partner_id=False, context=None): - - if context is None: - context = {} - res = super(AccountBankStatement, self)._prepare_move_line_vals( - cr, uid, st_line, move_id, debit, credit, - currency_id=currency_id, - amount_currency=amount_currency, - account_id=account_id, - analytic_id=analytic_id, - partner_id=partner_id, context=context) - res.update({'transaction_ref': st_line.ref}) - return res diff --git a/account_advanced_reconcile_transaction_ref/advanced_reconciliation.py b/account_advanced_reconcile_transaction_ref/advanced_reconciliation.py index 50687d9c..c104cbb3 100644 --- a/account_advanced_reconcile_transaction_ref/advanced_reconciliation.py +++ b/account_advanced_reconcile_transaction_ref/advanced_reconciliation.py @@ -32,7 +32,8 @@ class easy_reconcile_advanced_transaction_ref(orm.TransientModel): will be skipped for reconciliation. Can be inherited to skip on some conditions. ie: ref or partner_id is empty. """ - return not (move_line.get('ref') and move_line.get('partner_id')) + return not (move_line.get('transaction_ref') and + move_line.get('partner_id')) def _matchers(self, cr, uid, rec, move_line, context=None): return (('partner_id', move_line['partner_id']), @@ -41,3 +42,25 @@ class easy_reconcile_advanced_transaction_ref(orm.TransientModel): def _opposite_matchers(self, cr, uid, rec, move_line, context=None): yield ('partner_id', move_line['partner_id']) yield ('ref', (move_line['transaction_ref'] or '').lower().strip()) + + +class easy_reconcile_advanced_transaction_ref_vs_ref(orm.TransientModel): + + _name = 'easy.reconcile.advanced.trans_ref_vs_ref' + _inherit = 'easy.reconcile.advanced' + + def _skip_line(self, cr, uid, rec, move_line, context=None): + """ + When True is returned on some conditions, the credit move line + will be skipped for reconciliation. Can be inherited to + skip on some conditions. ie: ref or partner_id is empty. + """ + return not (move_line.get('ref') and move_line.get('partner_id')) + + def _matchers(self, cr, uid, rec, move_line, context=None): + return (('partner_id', move_line['partner_id']), + ('ref', move_line['ref'].lower().strip())) + + def _opposite_matchers(self, cr, uid, rec, move_line, context=None): + yield ('partner_id', move_line['partner_id']) + yield ('ref', (move_line['transaction_ref'] or '').lower().strip()) diff --git a/account_advanced_reconcile_transaction_ref/easy_reconcile.py b/account_advanced_reconcile_transaction_ref/easy_reconcile.py index a4cf11ab..92930446 100644 --- a/account_advanced_reconcile_transaction_ref/easy_reconcile.py +++ b/account_advanced_reconcile_transaction_ref/easy_reconcile.py @@ -32,6 +32,8 @@ class account_easy_reconcile_method(orm.Model): methods += [ ('easy.reconcile.advanced.transaction_ref', 'Advanced. Partner and Transaction Ref.'), + ('easy.reconcile.advanced.trans_ref_vs_ref', + 'Advanced. Partner and Transaction Ref. vs Ref.'), ] return methods diff --git a/account_advanced_reconcile_transaction_ref/easy_reconcile_view.xml b/account_advanced_reconcile_transaction_ref/easy_reconcile_view.xml index b341e7b8..9d0745d4 100644 --- a/account_advanced_reconcile_transaction_ref/easy_reconcile_view.xml +++ b/account_advanced_reconcile_transaction_ref/easy_reconcile_view.xml @@ -10,7 +10,12 @@ + + + diff --git a/account_easy_reconcile/easy_reconcile.xml b/account_easy_reconcile/easy_reconcile.xml index 56e12b2e..00771b73 100644 --- a/account_easy_reconcile/easy_reconcile.xml +++ b/account_easy_reconcile/easy_reconcile.xml @@ -124,7 +124,7 @@ The lines should have the same amount (with the write-off) and the same referenc account.easy.reconcile.method
- + @@ -141,7 +141,7 @@ The lines should have the same amount (with the write-off) and the same referenc account.easy.reconcile.method - + diff --git a/account_payment_transaction_id/__init__.py b/account_payment_transaction_id/__init__.py new file mode 100644 index 00000000..d564ba5d --- /dev/null +++ b/account_payment_transaction_id/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import account_payment diff --git a/account_payment_transaction_id/__openerp__.py b/account_payment_transaction_id/__openerp__.py new file mode 100644 index 00000000..b69c1dd2 --- /dev/null +++ b/account_payment_transaction_id/__openerp__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright 2014 Camptocamp SA +# +# 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 . +# +############################################################################## + + +{'name': 'Account Payment - Transaction ID', + 'version': '1.0', + 'author': 'Camptocamp', + 'maintainer': 'Camptocamp', + 'license': 'AGPL-3', + 'category': 'Hidden', + 'depends': ['base_transaction_id', + 'account_payment', + 'statement_voucher_killer', + ], + 'description': """ +Compatibility module between Account Payment and Base Transaction ID. + +Needs `statement_voucher_killer` + """, + 'website': 'http://www.camptocamp.com', + 'data': [], + 'test': [], + 'installable': True, + 'auto_install': True, +} diff --git a/account_payment_transaction_id/account_payment.py b/account_payment_transaction_id/account_payment.py new file mode 100644 index 00000000..227a61a8 --- /dev/null +++ b/account_payment_transaction_id/account_payment.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright 2014 Camptocamp SA +# +# 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 . +# +############################################################################## + +from openerp.osv import orm + + +class AccountPaymentPopulateStatement(orm.TransientModel): + _inherit = "account.payment.populate.statement" + + def _prepare_statement_line_vals(self, cr, uid, payment_line, amount, + statement, context=None): + superself = super(AccountPaymentPopulateStatement, self) + vals = superself._prepare_statement_line_vals( + cr, uid, payment_line, amount, statement, context=context) + if payment_line.move_line_id: + vals['transaction_id'] = payment_line.move_line_id.transaction_ref + return vals + + +class account_statement_from_invoice_lines(orm.TransientModel): + _inherit = "account.statement.from.invoice.lines" + + def _prepare_statement_line_vals(self, cr, uid, move_line, s_type, + statement_id, amount, context=None): + superself = super(account_statement_from_invoice_lines, self) + vals = superself._prepare_statement_line_vals( + cr, uid, move_line, s_type, statement_id, amount, context=context) + vals['transaction_id'] = move_line.transaction_ref + return vals diff --git a/account_statement_transactionid_completion/__openerp__.py b/account_statement_transactionid_completion/__openerp__.py index 46513591..6864c245 100644 --- a/account_statement_transactionid_completion/__openerp__.py +++ b/account_statement_transactionid_completion/__openerp__.py @@ -51,6 +51,8 @@ 'test': [ 'test/sale.yml', 'test/completion_transactionid_test.yml', + 'test/invoice.yml', + 'test/completion_invoice_transactionid_test.yml', ], 'installable': True, 'images': [], diff --git a/account_statement_transactionid_completion/data.xml b/account_statement_transactionid_completion/data.xml index d92143dc..70294cf2 100644 --- a/account_statement_transactionid_completion/data.xml +++ b/account_statement_transactionid_completion/data.xml @@ -3,10 +3,16 @@ - Match from line reference (based on transaction ID) + Match from Sales Order using transaction ID 30 get_from_transaction_id_and_so + + + Match from Invoice using transaction ID + 40 + get_from_transaction_id_and_invoice + diff --git a/account_statement_transactionid_completion/statement.py b/account_statement_transactionid_completion/statement.py index 57d743f7..a44d20a0 100644 --- a/account_statement_transactionid_completion/statement.py +++ b/account_statement_transactionid_completion/statement.py @@ -33,8 +33,12 @@ class AccountStatementCompletionRule(Model): def _get_functions(self, cr, uid, context=None): res = super(AccountStatementCompletionRule, self)._get_functions( cr, uid, context=context) - res.append(('get_from_transaction_id_and_so', - 'From line reference (based on SO transaction ID)')) + res += [ + ('get_from_transaction_id_and_so', + 'Match Sales Order using transaction ID'), + ('get_from_transaction_id_and_invoice', + 'Match Invoice using transaction ID'), + ] return res _columns = { @@ -79,6 +83,52 @@ class AccountStatementCompletionRule(Model): res.update(st_vals) return res + def get_from_transaction_id_and_invoice(self, cr, uid, st_line, context=None): + """ + Match the partner based on the transaction ID field of the invoice. + Then, call the generic st_line method to complete other values. + + In that case, we always fullfill the reference of the line with the invoice name. + + :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, + ...} + """ + st_obj = self.pool.get('account.bank.statement.line') + res = {} + invoice_obj = self.pool.get('account.invoice') + invoice_id = invoice_obj.search( + cr, uid, + [('transaction_id', '=', st_line['transaction_id'])], + context=context) + if len(invoice_id) > 1: + raise ErrorTooManyPartner( + _('Line named "%s" (Ref:%s) was matched by more than ' + 'one partner.') % (st_line['name'], st_line['ref'])) + elif len(invoice_id) == 1: + invoice = invoice_obj.browse(cr, uid, invoice_id[0], + context=context) + res['partner_id'] = invoice.partner_id.id + # we want the move to have the same ref than the found + # invoice's move, thus it will be easier to link them for the + # accountants + if invoice.move_id: + res['ref'] = invoice.move_id.ref + st_vals = st_obj.get_values_for_line( + cr, uid, + profile_id=st_line['profile_id'], + master_account_id=st_line['master_account_id'], + partner_id=res.get('partner_id', False), + line_type=st_line['type'], + amount=st_line['amount'] if st_line['amount'] else 0.0, + context=context) + res.update(st_vals) + return res + class AccountStatementLine(Model): _inherit = "account.bank.statement.line" @@ -92,3 +142,38 @@ class AccountStatementLine(Model): serialization_field='additionnal_bank_fields', help="Transaction id from the financial institute"), } + + +class AccountBankStatement(Model): + _inherit = "account.bank.statement" + + def _prepare_move_line_vals( + self, cr, uid, st_line, move_id, debit, credit, currency_id=False, + amount_currency=False, account_id=False, analytic_id=False, + partner_id=False, context=None): + """Add the period_id from the statement line date to the move preparation. + Originaly, it was taken from the statement period_id + + :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 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 create + :param float amount_currency: amount of the debit/credit expressed in the currency_id + :param int/long account_id: ID of the account to use in the move 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 + :return: dict of value to create() the account.move.line + """ + res = super(AccountBankStatement, self)._prepare_move_line_vals( + cr, uid, st_line, move_id, debit, credit, + currency_id=currency_id, + amount_currency=amount_currency, + account_id=account_id, + analytic_id=analytic_id, + partner_id=partner_id, context=context) + if st_line.transaction_id: + res['transaction_ref'] = st_line.transaction_id + return res diff --git a/account_statement_transactionid_completion/statement_view.xml b/account_statement_transactionid_completion/statement_view.xml index 5854791f..0f03be7c 100644 --- a/account_statement_transactionid_completion/statement_view.xml +++ b/account_statement_transactionid_completion/statement_view.xml @@ -7,13 +7,13 @@ account.bank.statement - form - - - - - + + + + + + diff --git a/account_statement_transactionid_completion/test/completion_invoice_transactionid_test.yml b/account_statement_transactionid_completion/test/completion_invoice_transactionid_test.yml new file mode 100644 index 00000000..0c3bd7ea --- /dev/null +++ b/account_statement_transactionid_completion/test/completion_invoice_transactionid_test.yml @@ -0,0 +1,49 @@ +- + In order to test the banking framework, I first need to create a profile +- + !record {model: account.statement.profile, id: statement_profile_invoice_transactionid}: + name: Bank EUR Profile (invoice transaction ID) + journal_id: account.bank_journal + commission_account_id: account.a_expense + company_id: base.main_company + balance_check: True + rule_ids: + - bank_statement_completion_rule_trans_id_invoice +- + Now I create a statement. I create statment lines separately because I need + to find each one by XML id +- + !record {model: account.bank.statement, id: statement_invoice_transactionid_test1}: + name: Statement with transaction ID + profile_id: statement_profile_invoice_transactionid + company_id: base.main_company +- + I create a statement line for an invoice with transaction ID +- + !record {model: account.bank.statement.line, id: statement_line_invoice_transactionid}: + name: Test autocompletion based on invoice with transaction ID + statement_id: statement_invoice_transactionid_test1 + transaction_id: XXX77Z + ref: 6 + date: !eval time.strftime('%Y-%m-%d') + amount: 450 +- + I run the auto complete +- + !python {model: account.bank.statement}: | + result = self.button_auto_completion(cr, uid, [ref("statement_invoice_transactionid_test1")]) +- + Now I can check that all is nice and shiny, line 1. I expect the invoice has been + recognised from the transaction ID. +- + !assert {model: account.bank.statement.line, id: statement_line_invoice_transactionid, string: Check completion by Invoice transaction ID}: + - partner_id.name == u'Agrolait' +- + I verify if the reference of the move has been copied to the statement line +- + !python {model: account.bank.statement.line}: | + statement_line = self.browse(cr, uid, ref('statement_line_invoice_transactionid')) + invoice_obj = self.pool['account.invoice'] + invoice = invoice_obj.browse(cr, uid, ref('invoice_with_transaction_id')) + reference = invoice.move_id.ref + assert statement_line.ref == reference diff --git a/account_statement_transactionid_completion/test/completion_transactionid_test.yml b/account_statement_transactionid_completion/test/completion_transactionid_test.yml index 5b1cb4bd..0d9c0b2f 100644 --- a/account_statement_transactionid_completion/test/completion_transactionid_test.yml +++ b/account_statement_transactionid_completion/test/completion_transactionid_test.yml @@ -35,7 +35,7 @@ I run the auto complete - !python {model: account.bank.statement}: | - result = self.button_auto_completion(cr, uid, [ref("statement_profile_transactionid")]) + result = self.button_auto_completion(cr, uid, [ref("statement_transactionid_test1")]) - Now I can check that all is nice and shiny, line 1. I expect the SO has been recognised from the transaction ID. diff --git a/account_statement_transactionid_completion/test/invoice.yml b/account_statement_transactionid_completion/test/invoice.yml new file mode 100644 index 00000000..68ee3c43 --- /dev/null +++ b/account_statement_transactionid_completion/test/invoice.yml @@ -0,0 +1,30 @@ +- + I create a new invoice with transaction ID +- + !record {model: account.invoice, id: invoice_with_transaction_id}: + account_id: account.a_recv + company_id: base.main_company + currency_id: base.EUR + partner_id: base.res_partner_2 + transaction_id: XXX77Z + invoice_line: + - account_id: account.a_sale + name: '[PCSC234] PC Assemble SC234' + price_unit: 450.0 + quantity: 1.0 + product_id: product.product_product_3 + uos_id: product.product_uom_unit + journal_id: account.bank_journal + reference_type: none +- + I called the "Confirm Draft Invoices" wizard +- + !record {model: account.invoice.confirm, id: invoice_transaction_id_confirm}: + {} +- + I clicked on Confirm Invoices Button +- + !python {model: account.invoice.confirm}: | + self.invoice_confirm(cr, uid, [ref("invoice_transaction_id_confirm")], {"lang": 'en_US', + "tz": False, "active_model": "account.invoice", "active_ids": [ref("invoice_with_transaction_id")], + "type": "out_invoice", "active_id": ref("invoice_with_transaction_id"), }) diff --git a/base_transaction_id/__init__.py b/base_transaction_id/__init__.py index 81f72930..ef5622e1 100644 --- a/base_transaction_id/__init__.py +++ b/base_transaction_id/__init__.py @@ -22,3 +22,4 @@ from . import invoice from . import sale from . import stock +from . import account_move diff --git a/base_transaction_id/account_move.py b/base_transaction_id/account_move.py new file mode 100644 index 00000000..dd64e529 --- /dev/null +++ b/base_transaction_id/account_move.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright 2014 Camptocamp SA +# +# 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 . +# +############################################################################## +from openerp.osv import orm, fields + + +class account_move_line(orm.Model): + _inherit = 'account.move.line' + + _columns = { + 'transaction_ref': fields.char('Transaction Ref.', + select=True), + } + + def copy_data(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default['transaction_ref'] = False + return super(account_move_line, self).\ + copy_data(cr, uid, id, default=default, context=context) diff --git a/base_transaction_id/invoice.py b/base_transaction_id/invoice.py index c1292595..7460495c 100644 --- a/base_transaction_id/invoice.py +++ b/base_transaction_id/invoice.py @@ -29,8 +29,22 @@ class AccountInvoice(Model): _columns = { 'transaction_id': fields.char( 'Transaction id', - size=128, - required=False, select=1, - help="Transction id from the financial institute"), + help="Transaction id from the financial institute"), } + + def copy_data(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default['transaction_id'] = False + return super(AccountInvoice, self).\ + copy_data(cr, uid, id, default=default, context=context) + + def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines): + if invoice_browse.transaction_id: + invoice_account_id = invoice_browse.account_id.id + for line in move_lines: + # tuple (0, 0, {values}) + if invoice_account_id == line[2]['account_id']: + line[2]['transaction_ref'] = invoice_browse.transaction_id + return move_lines diff --git a/statement_voucher_killer/voucher.py b/statement_voucher_killer/voucher.py index 6cc27608..d01c0b84 100644 --- a/statement_voucher_killer/voucher.py +++ b/statement_voucher_killer/voucher.py @@ -72,18 +72,23 @@ class AccountStatementFromInvoiceLines(orm.TransientModel): s_type = 'customer' elif line.journal_id.type in ('purchase', 'purhcase_refund'): s_type = 'supplier' - statement_line_obj.create(cr, uid, { - 'name': line.name or '?', + vals = self._prepare_statement_line_vals( + cr, uid, line, s_type, statement_id, amount, context=context) + statement_line_obj.create(cr, uid, vals, context=context) + return {'type': 'ir.actions.act_window_close'} + + def _prepare_statement_line_vals(self, cr, uid, move_line, s_type, + statement_id, amount, context=None): + return {'name': move_line.name or '?', 'amount': amount, 'type': s_type, - 'partner_id': line.partner_id.id, - 'account_id': line.account_id.id, + 'partner_id': move_line.partner_id.id, + 'account_id': move_line.account_id.id, 'statement_id': statement_id, - 'ref': line.ref, + 'ref': move_line.ref, 'voucher_id': False, 'date': time.strftime('%Y-%m-%d'), - }, context=context) - return {'type': 'ir.actions.act_window_close'} + } class AccountPaymentPopulateStatement(orm.TransientModel): @@ -114,16 +119,23 @@ class AccountPaymentPopulateStatement(orm.TransientModel): if not line.move_line_id.id: continue context.update({'move_line_ids': [line.move_line_id.id]}) - st_line_id = statement_line_obj.create(cr, uid, { - 'name': line.order_id.reference or '?', - 'amount': - amount, - 'type': 'supplier', - 'partner_id': line.partner_id.id, - 'account_id': line.move_line_id.account_id.id, - 'statement_id': statement.id, - 'ref': line.communication, - 'date': line.date or line.ml_maturity_date or statement.date, - }, context=context) + vals = self._prepare_statement_line_vals( + cr, uid, line, -amount, statement, context=context) + st_line_id = statement_line_obj.create(cr, uid, vals, + context=context) line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) return {'type': 'ir.actions.act_window_close'} + + def _prepare_statement_line_vals(self, cr, uid, payment_line, amount, + statement, context=None): + return {'name': payment_line.order_id.reference or '?', + 'amount': amount, + 'type': 'supplier', + 'partner_id': payment_line.partner_id.id, + 'account_id': payment_line.move_line_id.account_id.id, + 'statement_id': statement.id, + 'ref': payment_line.communication, + 'date': (payment_line.date or payment_line.ml_maturity_date or + statement.date) + }