Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-578024-xal into 
lp:openobject-client-web.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-578024-xal/+merge/119368

Hi,

This fix a silent failure in eval_domain_context_request() when create a new 
o2m record on an unsaved parent (and that unsaved parent is also a one2many).

If you have view hierarchy like this:

- root object (form)
  - sale_order_ids field (one2many => ...)
    - line_ids field (one2many => ...)
      (with attrs like context="{'default_name': name, 'form_view_ref': 
'customz.my_beautiful_form_view'}")

Steps:
- we create a root object
- we click on create from "sale_order_ids" field
  (this save the parent "root object" - then open a popup window for 
"sale_order_ids" form view)
- we click on create from "line_ids" field
  (this save the parent "sale_order_ids" - then open a popup window for 
"line_ids" form view)

Current: we get standard form view of "line_ids", name is unfilled
Expected: as per context, we should get "a beautiful view" and name should be 
filled

NOTE: The problem is that when saving "sale_order_ids" parent - resulting view 
doesn't containt "_terp_editable" field, getFormData() then believe we're not 
editable and doesn't add any field value. We simple get the "_terp_editable" 
from the widgets one.

Regards,
Xavier
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-578024-xal/+merge/119368
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-578024-xal.
=== modified file 'addons/openerp/static/javascript/form.js'
--- addons/openerp/static/javascript/form.js	2012-07-30 12:23:28 +0000
+++ addons/openerp/static/javascript/form.js	2012-08-13 15:08:09 +0000
@@ -301,13 +301,17 @@
  * readonly fields (default: excludes disabled fields and fields with
  * readonly="True"
  */
-function getFormData(extended, include_readonly) {
+function getFormData(extended, include_readonly, source) {
 
     var parentNode = openobject.dom.get('_terp_list') || document.forms['view_form'];
 
     var frm = {};
+    var prefix = '';
+    if (source) {
+        prefix = source + '/';
+    }
 
-    var is_editable = jQuery('#_terp_editable').val() == 'True';
+    var is_editable = jQuery(idSelector(prefix+'_terp_editable')).val() == 'True';
 
     var $fields = jQuery(parentNode).find('img[kind=picture]');
     if (is_editable) {
@@ -745,7 +749,7 @@
     if (prefix[0] == '_terp_listfields') {
         prefix.shift();
     }
-    var params = jQuery.extend(getFormData(1, true), {
+    var params = jQuery.extend(getFormData(1, true, options.source), {
         '_terp_domain': options.domain,
         '_terp_context': options.context,
         '_terp_prefix': prefix.join('/'),

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to