openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #05107
[Merge] lp:~openerp-dev/openobject-client-web/6.0-opw-5029-4852-sma into lp:openobject-client-web/6.0
Sananaz (Open ERP) has proposed merging lp:~openerp-dev/openobject-client-web/6.0-opw-5029-4852-sma into lp:openobject-client-web/6.0.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-5029-4852-sma/+merge/56563
Hello,
Please check with the Supplier Invoice.
1) Create of new invoice, select a supplier (e.g. ASUStek), Fill in a
Total value (e.g. 100.00)
2) Add an invoice line. The invoice line shows a "Unit Price" of 100.00
While performing the above two stops on the web interface, the web_error
logging displays also a bunch of error messages :
expr_eval Error while parsing u"dict({'check_total': check_total,
'invoice_line': invoice_line, 'address_invoice_id': address_invoice_id,
'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type
or False})"
Traceback (most recent call last):
File
"/usr/lib/python2.5/site-packages/openerp_web-6.0.1-py2.5.egg/addons/openerp
/utils/tools.py", line 50, in expr_eval
temp = eval(string, context)
File "<string>", line 1, in <module>
NameError: name 'invoice_line' is not defined
File
"/usr/lib/python2.5/site-packages/openerp_web-6.0.1-py2.5.egg/addons/openerp
/utils/tools.py", line 50, in expr_eval
temp = eval(string, context)
File "<string>", line 1, in <module>
NameError: name 'check_total' is not defined
[06/Apr/2011:18:00:07] expr_eval Error while parsing u"{'type':parent.type}"
Traceback (most recent call last):
File "/home/sananaz/workspace/stable_6.0_source/web-6.0/addons/openerp/utils/tools.py", line 50, in expr_eval
value = eval(string, context)
File "<string>", line 1, in <module>
NameError: name 'parent' is not defined
-->> Other side GTK client gives only this error message:
ERROR:tools.expr_eval:{'type':parent.type}
Traceback (most recent call last):
File "/home/sananaz/workspace/stable_6.0_source/client-6.0/bin/tools/__init__.py", line 52, in expr_eval
temp = eval(string, context)
File "<string>", line 1, in <module>
NameError: name 'parent' is not defined
So need to pass one2many field context when create new record and when add new line in one2many fields.
In web-client we have only consider `default_get` not one2many field `context`, So need to fix this also. So i have updated field context with the default_get_ctx.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-5029-4852-sma/+merge/56563
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client-web/6.0-opw-5029-4852-sma.
=== modified file 'addons/openerp/static/javascript/o2m.js'
--- addons/openerp/static/javascript/o2m.js 2011-04-04 15:02:36 +0000
+++ addons/openerp/static/javascript/o2m.js 2011-04-06 13:19:02 +0000
@@ -31,7 +31,7 @@
this.mode = openobject.dom.get(name + '/_terp_view_type').value;
if (openobject.dom.get(name + '/_terp_default_get_ctx'))
- this.default_get_ctx = openobject.dom.get(name + '/_terp_default_get_ctx').value;
+ this.default_get_ctx = openobject.dom.get(name + '/_terp_context').value;
var parent_prefix = name.indexOf('/') > -1 ? name.slice(0, name.lastIndexOf('/') + 1) : '';
=== modified file 'addons/openerp/widgets/form/_o2m.py'
--- addons/openerp/widgets/form/_o2m.py 2011-03-30 10:27:17 +0000
+++ addons/openerp/widgets/form/_o2m.py 2011-04-06 13:19:02 +0000
@@ -137,9 +137,8 @@
self.switch_to = view_mode[-1]
if view_type == view_mode[-1]: self.switch_to = view_mode[0]
-
+
ids = attrs.get('value') or []
-
if not isinstance(ids, list):
ids = [ids]
@@ -176,18 +175,19 @@
current.context = current.context or {}
group_by_ctx = ''
-
if self.default_get_ctx:
ctx = dict(cherrypy.request.terp_record,
context=current.context,
active_id=self.parent_id or False)
-
+ ctx[attrs['name']] = ids
# XXX: parent record for O2M
#if self.parent:
# ctx['parent'] = EvalEnvironment(self.parent)
try:
- ctx = expr_eval("dict(%s)" % self.default_get_ctx, ctx)
+ context = ctx.copy()
+ ctx = expr_eval("dict(%s)" % self.default_get_ctx, context)
+ ctx.update(expr_eval("dict(%s)" % attrs.get('context', '{}'), context))
current.context.update(ctx)
except:
pass
Follow ups