Merge lp:~santagada-proge/openobject-addons/6.1 into lp:openobject-addons/6.1

Proposed by Leonardo Santagada @ Proge.com.br
Status: Needs review
Proposed branch: lp:~santagada-proge/openobject-addons/6.1
Merge into: lp:openobject-addons/6.1
Diff against target: 55 lines (+13/-3)
3 files modified
account_voucher/account_voucher.py (+10/-0)
account_voucher/account_voucher_view.xml (+1/-1)
account_voucher/voucher_payment_receipt_view.xml (+2/-2)
To merge this branch: bzr merge lp:~santagada-proge/openobject-addons/6.1
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+123823@code.launchpad.net

Description of the change

proposal to fix bug 1043857

To post a comment you must log in.

Unmerged revisions

6967. By Leonardo Santagada

Fix for setting the correct period when changing companies

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 2012-08-28 10:58:11 +0000
3+++ account_voucher/account_voucher.py 2012-09-11 19:50:24 +0000
4@@ -705,6 +705,16 @@
5 res[key].update(vals[key])
6 return res
7
8+ def onchange_company_id(self, cr, uid, ids, company_id, date, context=None):
9+ if context is None:
10+ context ={}
11+ ctx = context.copy()
12+ ctx.update({'company_id': company_id})
13+ period_pool = self.pool.get('account.period')
14+ pids = period_pool.find(cr, uid, date, context=ctx)
15+ if pids:
16+ return {'value': {'period_id': pids[0]}}
17+
18 def onchange_date(self, cr, uid, ids, date, currency_id, payment_rate_currency_id, amount, company_id, context=None):
19 """
20 @param date: latest value from user input for field date
21
22=== modified file 'account_voucher/account_voucher_view.xml'
23--- account_voucher/account_voucher_view.xml 2012-01-31 13:36:57 +0000
24+++ account_voucher/account_voucher_view.xml 2012-09-11 19:50:24 +0000
25@@ -47,7 +47,7 @@
26 <field name="journal_id" widget="selection" select="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
27 <field name="type" required="1"/>
28 <field name="name" colspan="2"/>
29- <field name="company_id" widget="selection" groups="base.group_multi_company"/>
30+ <field name="company_id" widget="selection" on_change="onchange_company_id(company_id, date)" groups="base.group_multi_company"/>
31 <field name="reference" select="1"/>
32 <field name="account_id" widget="selection" invisible="True"/>
33 </group>
34
35=== modified file 'account_voucher/voucher_payment_receipt_view.xml'
36--- account_voucher/voucher_payment_receipt_view.xml 2012-01-31 13:36:57 +0000
37+++ account_voucher/voucher_payment_receipt_view.xml 2012-09-11 19:50:24 +0000
38@@ -156,7 +156,7 @@
39 <field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
40 <field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
41 <field name="name" colspan="2" invisible="context.get('line_type', False)"/>
42- <field name="company_id" widget="selection" groups="base.group_multi_company"/>
43+ <field name="company_id" widget="selection" groups="base.group_multi_company" on_change="onchange_company_id(company_id, date)"/>
44 <field name="account_id"
45 widget="selection"
46 invisible="True"/>
47@@ -309,7 +309,7 @@
48 <field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
49 <field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
50 <field name="name" colspan="2" invisible="context.get('line_type', False)"/>
51- <field name="company_id" widget="selection" groups="base.group_multi_company"/>
52+ <field name="company_id" widget="selection" groups="base.group_multi_company" on_change="onchange_company_id(company_id, date)"/>
53 <field name="account_id"
54 widget="selection"
55 invisible="True"/>