Merge lp:~numerigraphe/openobject-addons/6.0-refund-bank-account-domain into lp:openobject-addons/6.0

Proposed by Numérigraphe
Status: Needs review
Proposed branch: lp:~numerigraphe/openobject-addons/6.0-refund-bank-account-domain
Merge into: lp:openobject-addons/6.0
Diff against target: 24 lines (+11/-1)
1 file modified
account/invoice.py (+11/-1)
To merge this branch: bzr merge lp:~numerigraphe/openobject-addons/6.0-refund-bank-account-domain
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+89401@code.launchpad.net

Description of the change

Backport Jagdish Panchal's fix for bank account domain on refunds from lp:~openerp-dev/openobject-addons/trunk-bug-914282-jap

To post a comment you must log in.

Unmerged revisions

5007. By Jagdish Panchal(Open ERP)

[FIX] account_invoice.py: Replace the domain on partner_bank_id in customer refund and supplier refund

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/invoice.py'
2--- account/invoice.py 2012-01-10 13:07:02 +0000
3+++ account/invoice.py 2012-01-20 09:42:23 +0000
4@@ -313,9 +313,19 @@
5 if field == 'journal_id':
6 journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
7 res['fields'][field]['selection'] = journal_select
8+
9+ doc = etree.XML(res['arch'])
10+
11+ if context.get('type', False):
12+ for node in doc.xpath("//field[@name='partner_bank_id']"):
13+ print node,context['type']
14+ if context['type'] == 'in_refund':
15+ node.set('domain', "[('partner_id.ref_companies', 'in', [company_id])]")
16+ elif context['type'] == 'out_refund':
17+ node.set('domain', "[('partner_id', '=', partner_id)]")
18+ res['arch'] = etree.tostring(doc)
19
20 if view_type == 'tree':
21- doc = etree.XML(res['arch'])
22 nodes = doc.xpath("//field[@name='partner_id']")
23 partner_string = _('Customer')
24 if context.get('type', 'out_invoice') in ('in_invoice', 'in_refund'):