Merge lp:~openerp-dev/openobject-addons/6.0-opw-592430-ado into lp:openobject-addons/6.0

Proposed by Amit Dodiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-592430-ado
Merge into: lp:openobject-addons/6.0
Diff against target: 44 lines (+11/-1)
3 files modified
account_voucher/account_voucher.py (+7/-0)
account_voucher/account_voucher_view.xml (+3/-0)
account_voucher/wizard/account_statement_from_invoice.py (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-592430-ado
Reviewer Review Type Date Requested Status
Xavier ALT Pending
Naresh(OpenERP) Pending
Review via email: mp+164296@code.launchpad.net

Description of the change

Hello,

[FIX]account_voucher: (1) updated bank statement date on voucher while importing invoice which was taking invoice date on voucher (2) added onchange on date field of bank statement line so the date on voucher is updated accordingly

Issue:
1). While importing the invoice on bank statement the voucher is created and it takes the date from invoice instead of bank statement date.
2). Added onchange on "date" field of on bank statement line so while changing the date in bank statement line reflect in voucher and changed the voucher date according to statement line.

To post a comment you must log in.

Unmerged revisions

5473. By Amit Dodiya (OpenERP)

[FIX]account_voucher: (1) updated bank statement date on voucher while importing invoice which was taking invoice date on voucher (2) added onchange on bank statement line so the statement line is updated on voucher

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_voucher/account_voucher.py'
2--- account_voucher/account_voucher.py 2013-02-28 08:55:11 +0000
3+++ account_voucher/account_voucher.py 2013-05-17 05:42:28 +0000
4@@ -1022,6 +1022,13 @@
5
6 class account_bank_statement_line(osv.osv):
7 _inherit = 'account.bank.statement.line'
8+
9+ def onchange_line_date(self, cr, uid, ids, date, context=None):
10+ voucher_obj = self.pool.get('account.voucher')
11+ for statement_line in self.browse(cr, uid, ids, context=context):
12+ if statement_line.voucher_id:
13+ voucher_obj.write(cr, uid, [statement_line.voucher_id.id], {'date': date}, context=context)
14+ return {}
15
16 def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
17 if not ids:
18
19=== modified file 'account_voucher/account_voucher_view.xml'
20--- account_voucher/account_voucher_view.xml 2012-03-13 11:43:02 +0000
21+++ account_voucher/account_voucher_view.xml 2013-05-17 05:42:28 +0000
22@@ -227,6 +227,9 @@
23 <xpath expr="/form/notebook/page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
24 <field name="voucher_id" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
25 </xpath>
26+ <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='date']" position="attributes">
27+ <attribute name="on_change">onchange_line_date(date)</attribute>
28+ </xpath>
29 </field>
30 </record>
31
32
33=== modified file 'account_voucher/wizard/account_statement_from_invoice.py'
34--- account_voucher/wizard/account_statement_from_invoice.py 2012-11-29 11:02:12 +0000
35+++ account_voucher/wizard/account_statement_from_invoice.py 2013-05-17 05:42:28 +0000
36@@ -83,7 +83,7 @@
37 'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id), # improve me: statement.journal_id.default_credit_account_id.id
38 'company_id':statement.company_id.id,
39 'currency_id':statement.currency.id,
40- 'date':line.date,
41+ 'date':statement.date,
42 'amount':abs(amount),
43 'period_id':statement.period_id.id}
44 voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)