[MERGE] stock.ui: package selection
bzr revid: fva@openerp.com-20130628100419-nq5p93de5b1xta6o
This commit is contained in:
@@ -103,6 +103,9 @@
|
||||
.oe_pick_widget .oe_pick_list_table tbody tr:nth-child(odd){
|
||||
background: rgb(250,250,250);
|
||||
}
|
||||
.oe_pick_widget .oe_pick_list_table tbody tr.oe_selected{
|
||||
background: rgb(236, 236, 247);
|
||||
}
|
||||
.oe_pick_widget .oe_pick_list_table td,
|
||||
.oe_pick_widget .oe_pick_list_table th {
|
||||
padding: 5px;
|
||||
@@ -131,5 +134,8 @@
|
||||
border: solid 1px rgba(0, 0, 0, 0.09);
|
||||
cursor: pointer;
|
||||
}
|
||||
.oe_pick_widget .js-pack{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,14 +36,13 @@ function openerp_picking_widgets(instance){
|
||||
template: 'PackageEditorWidget',
|
||||
get_header: function(){
|
||||
var model = this.getParent();
|
||||
var current_package_id = instance.session.user_context.current_package_id;
|
||||
return current_package_id ? 'Current Operations for package: ' + current_package_id[1] : 'Current Operations';
|
||||
var current_package = model.get_selected_package();
|
||||
return current_package ? 'Operations for Package: ' + current_package.name : 'Current Operations';
|
||||
},
|
||||
get_rows: function(){
|
||||
var current_package_id = instance.session.user_context.current_package_id;
|
||||
var model = this.getParent();
|
||||
var rows = [];
|
||||
console.log('package id',current_package_id)
|
||||
var current_package_id = instance.session.user_context.current_package_id;
|
||||
|
||||
_.each( model.operations, function(op){
|
||||
if((typeof current_package_id !== 'undefined') && op.result_package_id !== current_package_id){
|
||||
@@ -69,15 +68,24 @@ function openerp_picking_widgets(instance){
|
||||
},
|
||||
get_rows: function(){
|
||||
var model = this.getParent();
|
||||
var current_package = model.get_selected_package();
|
||||
var rows = [];
|
||||
_.each( model.packages, function(pack){
|
||||
rows.push({
|
||||
cols:{ pack: pack.name},
|
||||
id: pack.id
|
||||
id: pack.id,
|
||||
classes: 'js-pack' + ( pack === current_package ? ' oe_selected' : '') ,
|
||||
});
|
||||
});
|
||||
return rows;
|
||||
},
|
||||
renderElement: function(){
|
||||
this._super();
|
||||
var model = this.getParent();
|
||||
this.$('.js-pack').click(function(){
|
||||
model.select_package(parseInt($(this).attr('pack-id')));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
module.PickingMainWidget = instance.web.Widget.extend({
|
||||
@@ -206,6 +214,23 @@ function openerp_picking_widgets(instance){
|
||||
console.log('New picking id:',new_picking_id);
|
||||
});
|
||||
},
|
||||
select_package: function(package_id){
|
||||
console.log('Select Package:',package_id);
|
||||
instance.session.user_context.current_package_id = package_id;
|
||||
this.package_editor.renderElement();
|
||||
this.package_selector.renderElement();
|
||||
},
|
||||
get_selected_package: function(){
|
||||
var current_package;
|
||||
|
||||
_.each( this.packages, function(pack){
|
||||
if(pack.id === instance.session.user_context.current_package_id){
|
||||
current_package = pack;
|
||||
}
|
||||
});
|
||||
|
||||
return current_package;
|
||||
},
|
||||
connect_barcode_scanner: function(){
|
||||
var self =this;
|
||||
var code = [];
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
|
||||
<tbody>
|
||||
<t t-foreach="widget.get_rows()" t-as="row">
|
||||
<tr t-att-class="row.classes" t-att-data-id="row.id">
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user