[MERGE] stock.ui: package copy and package deletion

bzr revid: fva@openerp.com-20130628114031-276vqg4146qyextm
This commit is contained in:
Frédéric van der Essen
2013-06-28 13:40:31 +02:00
3 changed files with 29 additions and 8 deletions
+1 -1
View File
@@ -134,7 +134,7 @@
border: solid 1px rgba(0, 0, 0, 0.09);
cursor: pointer;
}
.oe_pick_widget .js-pack{
.oe_pick_widget .js_pack_select{
cursor: pointer;
}
+24 -3
View File
@@ -74,7 +74,7 @@ function openerp_picking_widgets(instance){
rows.push({
cols:{ pack: pack.name},
id: pack.id,
classes: 'js-pack' + ( pack === current_package ? ' oe_selected' : '') ,
classes: pack === current_package ? ' oe_selected' : '' ,
});
});
return rows;
@@ -82,8 +82,12 @@ function openerp_picking_widgets(instance){
renderElement: function(){
this._super();
var model = this.getParent();
this.$('.js-pack').click(function(){
model.select_package(parseInt($(this).attr('pack-id')));
this.$('.js_pack_row').each(function(){
var pack_id = parseInt($(this).attr('pack-id'));
$('.js_pack_select', this).click(function(){ model.select_package(pack_id); });
$('.js_pack_plus', this).click(function(){ model.copy_package(pack_id); });
$('.js_pack_minus', this).click(function(){ model.delete_package(pack_id); });
});
},
});
@@ -212,6 +216,23 @@ function openerp_picking_widgets(instance){
.call('action_done_from_packing_ui',[[self.picking.id]])
.then(function(new_picking_id){
console.log('New picking id:',new_picking_id);
//return self.refresh_ui(new_picking_id);
});
},
copy_package: function(package_id){
console.log('Copy Package:',package_id);
new instance.web.Model('stock.quant.package')
.call('action_copy',[[package_id]])
.then(function(){
return self.refresh_ui(self.picking.id);
});
},
delete_package: function(package_id){
console.log('Delete Package:',package_id);
new instance.web.Model('stock.quant.package')
.call('action_copy',[[package_id]])
.then(function(){
return self.refresh_ui(self.picking.id);
});
},
select_package: function(package_id){
+4 -4
View File
@@ -140,10 +140,10 @@
<tbody>
<t t-foreach="widget.get_rows()" t-as="row">
<tr t-att-class="row.classes" t-att-pack-id="row.id">
<td> <t t-esc="row.cols.pack" /> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pick_plus'>+</span> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pick_minus'>-</span> </td>
<tr t-att-class="'js_pack_row' + row.classes" t-att-pack-id="row.id">
<td class='js_pack_select'> <t t-esc="row.cols.pack" /> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pack_plus'>+</span> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pack_minus'>-</span> </td>
</tr>
</t>
</tbody>