Merge lp:~openerp-dev/openobject-addons/trunk-bug-1111430-nco into lp:openobject-addons

Proposed by Nimesh Contractor(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1111430-nco
Merge into: lp:openobject-addons
Diff against target: 89 lines (+31/-15)
3 files modified
account/account_invoice.py (+0/-14)
purchase/purchase.py (+15/-1)
sale/sale.py (+16/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1111430-nco
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+165009@code.launchpad.net

Description of the change

Hello,

Fix account invoice line fields_view_get is broken.
As the purchase_ok field is in purchase module and sale_ok field is in sale module so remove the fields view get form the account invoice line and set in purchase for type 'in_invoice', 'in_refund' also in sale for type 'out_invoice' and 'out_refund'.

Thank You!

To post a comment you must log in.

Unmerged revisions

8709. By Ishwar Malvi(OpenERP)

[FIX] as the purchase ok field is in purchase and sale_ok in sale module so remove unuesed fields view get and set in purchase and sale module.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2013-04-22 15:34:49 +0000
3+++ account/account_invoice.py 2013-05-22 05:43:27 +0000
4@@ -1402,20 +1402,6 @@
5 'account_id': _default_account_id,
6 }
7
8- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
9- if context is None:
10- context = {}
11- res = super(account_invoice_line,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
12- if context.get('type', False):
13- doc = etree.XML(res['arch'])
14- for node in doc.xpath("//field[@name='product_id']"):
15- if context['type'] in ('in_invoice', 'in_refund'):
16- node.set('domain', "[('purchase_ok', '=', True)]")
17- else:
18- node.set('domain', "[('sale_ok', '=', True)]")
19- res['arch'] = etree.tostring(doc)
20- return res
21-
22 def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
23 if context is None:
24 context = {}
25
26=== modified file 'purchase/purchase.py'
27--- purchase/purchase.py 2013-04-15 10:23:49 +0000
28+++ purchase/purchase.py 2013-05-22 05:43:27 +0000
29@@ -20,6 +20,7 @@
30 ##############################################################################
31
32 import time
33+from lxml import etree
34 import pytz
35 from openerp import SUPERUSER_ID
36 from datetime import datetime
37@@ -1243,6 +1244,19 @@
38 if po_ids:
39 purchase_order_obj.message_post(cr, uid, po_ids, body=_("Invoice paid"), context=context)
40 return res
41-
42+class account_invoice_line(osv.Model):
43+ _inherit = 'account.invoice.line'
44+
45+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
46+ if context is None:
47+ context = {}
48+ res = super(account_invoice_line,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
49+ if context.get('type', False):
50+ doc = etree.XML(res['arch'])
51+ for node in doc.xpath("//field[@name='product_id']"):
52+ if context['type'] in ('in_invoice', 'in_refund'):
53+ node.set('domain', "[('purchase_ok', '=', True)]")
54+ res['arch'] = etree.tostring(doc)
55+ return res
56
57 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
58
59=== modified file 'sale/sale.py'
60--- sale/sale.py 2013-04-22 15:34:49 +0000
61+++ sale/sale.py 2013-05-22 05:43:27 +0000
62@@ -19,6 +19,7 @@
63 #
64 ##############################################################################
65
66+from lxml import etree
67 from datetime import datetime, timedelta
68 from dateutil.relativedelta import relativedelta
69 import time
70@@ -1032,4 +1033,19 @@
71 wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
72 return super(account_invoice, self).unlink(cr, uid, ids, context=context)
73
74+class account_invoice_line(osv.Model):
75+ _inherit = 'account.invoice.line'
76+
77+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
78+ if context is None:
79+ context = {}
80+ res = super(account_invoice_line,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
81+ if context.get('type', False):
82+ doc = etree.XML(res['arch'])
83+ for node in doc.xpath("//field[@name='product_id']"):
84+ if context['type'] in ('out_invoice', 'out_refund'):
85+ node.set('domain', "[('sale_ok', '=', True)]")
86+ res['arch'] = etree.tostring(doc)
87+ return res
88+
89 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Subscribers

People subscribed via source and target branches

to all changes: