Merge lp:~openerp-dev/openerp-web/6.1-opw-578551-msh into lp:openerp-web/6.1

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/6.1-opw-578551-msh
Merge into: lp:openerp-web/6.1
Diff against target: 50 lines (+11/-6)
2 files modified
addons/web/static/src/js/data.js (+1/-0)
addons/web/static/src/js/view_form.js (+10/-6)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-opw-578551-msh
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+123010@code.launchpad.net

Description of the change

Hello,

Fixed the issue of one2many which sending extra values as a link_to tuple hence for that write is called, due to which access error is generated for the user who has only create access not write access.

Demo :- Edit the access right for any user -> Settings -> Security -> Access Control List -> Search for the Attendance object -> Changed the rights for "Human Resource / Employee" Group remove the write access.
Now Go to Human Resource -> Attendances -> Attendances edit any record and create one one2many line nothing else and save the record.

Result :- It will give access error that user don't have write access, even though record is not edited we have just created a one2many record, which will call create of one2many but due to extra link_to record write is called.

Expected :- Here user didn't touch other field of the form and just created the one2many record, so only that record should be send to server to create, but here other one2many records are also sended with to_link tuple, behaviour should be if there is to_link record then and then tuple (4, id, false) created otherwise only to_create i.e. (0,0,values) should go as a data.

Thanks.

To post a comment you must log in.

Unmerged revisions

2448. By Mohammed Shekha(Open ERP)

[FIX]Fixed the issue of one2many access rights, one2many sends unnecessary values as a link_to.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web/static/src/js/data.js'
--- addons/web/static/src/js/data.js 2012-09-03 13:17:44 +0000
+++ addons/web/static/src/js/data.js 2012-09-06 05:31:22 +0000
@@ -707,6 +707,7 @@
707 this.to_delete = [];707 this.to_delete = [];
708 this.to_create = [];708 this.to_create = [];
709 this.to_write = [];709 this.to_write = [];
710 this.to_link = [];
710 this.cache = [];711 this.cache = [];
711 this.delete_all = false;712 this.delete_all = false;
712 },713 },
713714
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2012-09-03 13:17:44 +0000
+++ addons/web/static/src/js/view_form.js 2012-09-06 05:31:22 +0000
@@ -2584,6 +2584,7 @@
2584 self.dataset.to_delete.push({id: command[1]});2584 self.dataset.to_delete.push({id: command[1]});
2585 return;2585 return;
2586 case commands.LINK_TO:2586 case commands.LINK_TO:
2587 self.dataset.to_link.push({id: command[1]});
2587 ids.push(command[1]);2588 ids.push(command[1]);
2588 return;2589 return;
2589 case commands.DELETE_ALL:2590 case commands.DELETE_ALL:
@@ -2622,17 +2623,20 @@
2622 return [];2623 return [];
2623 this.save_any_view();2624 this.save_any_view();
2624 var val = this.dataset.delete_all ? [commands.delete_all()] : [];2625 var val = this.dataset.delete_all ? [commands.delete_all()] : [];
2625 val = val.concat(_.map(this.dataset.ids, function(id) {2626 _.each(this.dataset.ids, function(id){
2626 var alter_order = _.detect(self.dataset.to_create, function(x) {return x.id === id;});2627 var alter_order = _.detect(self.dataset.to_create, function(x) {return x.id === id;});
2627 if (alter_order) {2628 if (alter_order) {
2628 return commands.create(alter_order.values);2629 val.push(commands.create(alter_order.values));
2629 }2630 }
2630 alter_order = _.detect(self.dataset.to_write, function(x) {return x.id === id;});2631 alter_order = _.detect(self.dataset.to_write, function(x) {return x.id === id;});
2631 if (alter_order) {2632 if (alter_order) {
2632 return commands.update(alter_order.id, alter_order.values);2633 val.push(commands.update(alter_order.id, alter_order.values));
2633 }2634 }
2634 return commands.link_to(id);2635 alter_order = _.detect(self.dataset.to_link, function(x) {return x.id === id;});
2635 }));2636 if (alter_order) {
2637 val.push(commands.link_to(alter_order.id));
2638 }
2639 });
2636 return val.concat(_.map(2640 return val.concat(_.map(
2637 this.dataset.to_delete, function(x) {2641 this.dataset.to_delete, function(x) {
2638 return commands['delete'](x.id);}));2642 return commands['delete'](x.id);}));