Merge lp:~openerp-community/openobject-addons/fix-1127198-import-invoice-payment-date into lp:openobject-addons/7.0

Proposed by Niels Huylebroeck
Status: Merged
Merged at revision: 9799
Proposed branch: lp:~openerp-community/openobject-addons/fix-1127198-import-invoice-payment-date
Merge into: lp:openobject-addons/7.0
Diff against target: 65 lines (+17/-3)
3 files modified
account_voucher/account_voucher.py (+12/-1)
account_voucher/account_voucher_view.xml (+3/-0)
account_voucher/wizard/account_statement_from_invoice.py (+2/-2)
To merge this branch: bzr merge lp:~openerp-community/openobject-addons/fix-1127198-import-invoice-payment-date
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve
Serpent Consulting Services (community) Approve
OpenERP Core Team Pending
Review via email: mp+163006@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Faced a similar issue and your fix is perfect!

review: Approve
Revision history for this message
Open Net Sàrl (openerp-open-net) wrote :

Hi,
Could you please review and merge it, It's been such a long time...

Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hello,

Sorry for the long delay on this one and thanks for your work to fix the bug.

One small remark: Please do not make write calls in on_change methods. on_change should only be for user interface, no impact on the data (eg: if I close my browser after making the change in edit mode without saving).

On the bug report, you mentioned the issue that the date will be changed when confirming is late. On the other hand it is not really problematic as long as these are in draft.
What do you think ?

In the meanwhile I have merged your changes (everything except the on_change) into 7.0

Regards

revno: 9799 [merge]
revision-id: <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2013-05-14 11:52:13 +0000
+++ account_voucher/account_voucher.py 2013-05-15 14:01:27 +0000
@@ -1619,7 +1619,11 @@
1619 bank_st_line_obj = self.pool.get('account.bank.statement.line')1619 bank_st_line_obj = self.pool.get('account.bank.statement.line')
1620 st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)1620 st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
1621 if st_line.voucher_id:1621 if st_line.voucher_id:
1622 voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)1622 voucher_obj.write(cr, uid, [st_line.voucher_id.id],
1623 {'number': next_number,
1624 'date': st_line.date,
1625 'period_id': st_line.statement_id.period_id.id},
1626 context=context)
1623 if st_line.voucher_id.state == 'cancel':1627 if st_line.voucher_id.state == 'cancel':
1624 voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context)1628 voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context)
1625 wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)1629 wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
@@ -1645,6 +1649,13 @@
16451649
1646class account_bank_statement_line(osv.osv):1650class account_bank_statement_line(osv.osv):
1647 _inherit = 'account.bank.statement.line'1651 _inherit = 'account.bank.statement.line'
1652
1653 def onchange_line_date(self, cr, uid, ids, date, context=None):
1654 voucher_obj = self.pool.get('account.voucher')
1655 for statement_line in self.browse(cr, uid, ids, context=context):
1656 if statement_line.voucher_id:
1657 voucher_obj.write(cr, uid, [statement_line.voucher_id.id], {'date': date}, context=context)
1658 return {}
16481659
1649 def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):1660 def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
1650 res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context)1661 res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context)
16511662
=== modified file 'account_voucher/account_voucher_view.xml'
--- account_voucher/account_voucher_view.xml 2013-04-08 00:55:26 +0000
+++ account_voucher/account_voucher_view.xml 2013-05-15 14:01:27 +0000
@@ -221,6 +221,9 @@
221 <field name="amount" position="attributes">221 <field name="amount" position="attributes">
222 <attribute name="on_change">onchange_amount(amount)</attribute>222 <attribute name="on_change">onchange_amount(amount)</attribute>
223 </field>223 </field>
224 <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='date']" position="attributes">
225 <attribute name="on_change">onchange_line_date(date)</attribute>
226 </xpath>
224 </field>227 </field>
225 </record>228 </record>
226229
227230
=== modified file 'account_voucher/wizard/account_statement_from_invoice.py'
--- account_voucher/wizard/account_statement_from_invoice.py 2012-12-18 17:55:47 +0000
+++ account_voucher/wizard/account_statement_from_invoice.py 2013-05-15 14:01:27 +0000
@@ -94,7 +94,7 @@
94 'account_id': result['value'].get('account_id', statement.journal_id.default_credit_account_id.id),94 'account_id': result['value'].get('account_id', statement.journal_id.default_credit_account_id.id),
95 'company_id': statement.company_id.id,95 'company_id': statement.company_id.id,
96 'currency_id': statement.currency.id,96 'currency_id': statement.currency.id,
97 'date': line.date,97 'date': statement.date,
98 'amount': sign*amount,98 'amount': sign*amount,
99 'payment_rate': result['value']['payment_rate'],99 'payment_rate': result['value']['payment_rate'],
100 'payment_rate_currency_id': result['value']['payment_rate_currency_id'],100 'payment_rate_currency_id': result['value']['payment_rate_currency_id'],
@@ -119,7 +119,7 @@
119 'statement_id': statement_id,119 'statement_id': statement_id,
120 'ref': line.ref,120 'ref': line.ref,
121 'voucher_id': voucher_id,121 'voucher_id': voucher_id,
122 'date': time.strftime('%Y-%m-%d'),122 'date': statement.date,
123 }, context=context)123 }, context=context)
124 return {'type': 'ir.actions.act_window_close'}124 return {'type': 'ir.actions.act_window_close'}
125125