Merge lp:~openerp-dev/openobject-addons/trunk-bug-739562-skh into lp:openobject-addons

Proposed by Somesh Khare
Status: Merged
Merged at revision: 4649
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-739562-skh
Merge into: lp:openobject-addons
Diff against target: 45 lines (+14/-3)
2 files modified
account_payment/account_payment.py (+11/-1)
account_payment/account_payment_view.xml (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-739562-skh
Reviewer Review Type Date Requested Status
qdp (OpenERP) Approve
Mustufa Rangwala (Open ERP) (community) Approve
Somesh Khare (community) Needs Resubmitting
Review via email: mp+56343@code.launchpad.net

Description of the change

Hello,

Fix : payment mode - account must belong to company

Thanks,
skh

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

def onchange_company_id => unused variable vals ! and the method is not coded well see onchange_comapany method on account.invoice.

And try to follow python standards while coding.

thanks,
mra

review: Needs Fixing
Revision history for this message
Somesh Khare (somesh.khare) wrote :

Hello,

[Fix]: I have made the changes as suggested.

Thanks,
skh

review: Needs Resubmitting
Revision history for this message
Somesh Khare (somesh.khare) wrote :

Hello,

[Fix]: I have made the changes as suggested.

Thanks,
skh

review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve
Revision history for this message
qdp (OpenERP) (qdp) wrote :

don't forget to include the context in the browse next time ;-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_payment/account_payment.py'
2--- account_payment/account_payment.py 2011-02-28 06:09:22 +0000
3+++ account_payment/account_payment.py 2011-04-06 05:15:54 +0000
4@@ -33,7 +33,9 @@
5 required=True,help='Bank Account for the Payment Mode'),
6 'journal': fields.many2one('account.journal', 'Journal', required=True,
7 domain=[('type', 'in', ('bank','cash'))], help='Bank or Cash Journal for the Payment Mode'),
8- 'company_id': fields.many2one('res.company', 'Company', required=True),
9+ 'company_id': fields.many2one('res.company', 'Company',required=True),
10+ 'partner_id':fields.related('company_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True,),
11+
12 }
13 _defaults = {
14 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
15@@ -49,6 +51,14 @@
16 JOIN payment_mode pm ON (pm.bank_id = pb.id)
17 WHERE pm.id = %s """, [payment_code])
18 return [x[0] for x in cr.fetchall()]
19+
20+ def onchange_company_id (self, cr, uid, ids, company_id=False, context=None):
21+ result = {}
22+ if company_id:
23+ partner_id = self.pool.get('res.company').browse(cr, uid, company_id).partner_id.id
24+ result['partner_id'] = partner_id
25+ return {'value': result}
26+
27
28 payment_mode()
29
30
31=== modified file 'account_payment/account_payment_view.xml'
32--- account_payment/account_payment_view.xml 2011-02-24 11:45:37 +0000
33+++ account_payment/account_payment_view.xml 2011-04-06 05:15:54 +0000
34@@ -79,8 +79,9 @@
35 <form string="Payment Mode">
36 <field name="name" select="1"/>
37 <field name="journal" select="1"/>
38- <field name="bank_id"/>
39- <field name="company_id" select="1" widget='selection' groups="base.group_multi_company"/>
40+ <field name="bank_id" domain="[('partner_id','=',partner_id)]" />
41+ <field name="company_id" select="1" widget='selection' groups="base.group_multi_company" on_change="onchange_company_id(company_id)"/>
42+ <field name="partner_id" select="1" widget='selection' invisible="1"/>
43 </form>
44 </field>
45 </record>

Subscribers

People subscribed via source and target branches

to all changes: