summaryrefslogtreecommitdiff
path: root/addons/stock/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/stock/static/src')
-rw-r--r--addons/stock/static/src/js/widgets.js43
-rw-r--r--addons/stock/static/src/xml/picking.xml52
2 files changed, 38 insertions, 57 deletions
diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js
index 756d3caf841..8bb36bd3e42 100644
--- a/addons/stock/static/src/js/widgets.js
+++ b/addons/stock/static/src/js/widgets.js
@@ -534,7 +534,6 @@ function openerp_picking_widgets(instance){
this.picking = null;
this.pickings = [];
this.packoplines = null;
- this.operations = null;
this.selected_operation = { id: null, picking_id: null};
this.packages = null;
this.barcode_scanner = new module.BarcodeScanner();
@@ -604,20 +603,22 @@ function openerp_picking_widgets(instance){
}
return loaded_picking.then(function(){
- new instance.web.Model('stock.location').call('search',[[['usage','=','internal']]]).then(function(locations_ids){
+ return new instance.web.Model('stock.location').call('search',[[['usage','=','internal']]]).then(function(locations_ids){
return new instance.web.Model('stock.location').call('read',[locations_ids, []]).then(function(locations){
self.locations = locations;
});
});
}).then(function(){
-
- return new instance.web.Model('stock.pack.operation').call('read',[self.picking.pack_operation_ids, [], new instance.web.CompoundContext()]);
- }).then(function(packoplines){
- self.packoplines = packoplines;
-
- return new instance.web.Model('stock.pack.operation').call('read',[self.picking.pack_operation_ids, [], new instance.web.CompoundContext()]);
+ if (self.picking.pack_operation_exist === false){
+ self.picking.recompute_pack_op = false;
+ return new instance.web.Model('stock.picking').call('do_prepare_partial',[[self.picking.id]]);
+ }
+ }).then(function(){
+ return new instance.web.Model('stock.pack.operation').call('search',[[['picking_id','=',self.picking.id]]])
+ }).then(function(pack_op_ids){
+ return new instance.web.Model('stock.pack.operation').call('read',[pack_op_ids, [], new instance.web.CompoundContext()])
}).then(function(operations){
- self.operations = operations;
+ self.packoplines = operations;
var package_ids = [];
for(var i = 0; i < operations.length; i++){
@@ -627,7 +628,7 @@ function openerp_picking_widgets(instance){
}
}
}
- return new instance.web.Model('stock.quant.package').call('read',[package_ids, [], new instance.web.CompoundContext()]);
+ return new instance.web.Model('stock.quant.package').call('read',[package_ids, [], new instance.web.CompoundContext()])
}).then(function(packages){
self.packages = packages;
});
@@ -644,6 +645,7 @@ function openerp_picking_widgets(instance){
this.$('.js_pick_prev').click(function(){ self.picking_prev(); });
this.$('.js_pick_next').click(function(){ self.picking_next(); });
this.$('.js_pick_menu').click(function(){ self.menu(); });
+ this.$('.js_reload_op').click(function(){ self.reload_pack_operation();});
this.hotkey_handler = function(event){
if(event.keyCode === 37 ){ // Left Arrow
@@ -670,6 +672,12 @@ function openerp_picking_widgets(instance){
}else{
self.$('.js_pick_next').removeClass('disabled');
}
+ if (self.picking.recompute_pack_op){
+ self.$('.js_reload_op').removeClass('hidden');
+ }
+ else {
+ self.$('.js_reload_op').addClass('hidden');
+ }
}).fail(function(error) {console.log(error);});
@@ -691,6 +699,13 @@ function openerp_picking_widgets(instance){
self.picking_editor.remove_blink();
self.picking_editor.renderElement();
+ if (self.picking.recompute_pack_op){
+ self.$('.js_reload_op').removeClass('hidden');
+ }
+ else {
+ self.$('.js_reload_op').addClass('hidden');
+ }
+
if( self.picking.id === self.pickings[0]){
self.$('.js_pick_prev').addClass('disabled');
}else{
@@ -886,6 +901,14 @@ function openerp_picking_widgets(instance){
}
},
+ reload_pack_operation: function(){
+ var self = this;
+ new instance.web.Model('stock.picking')
+ .call('do_prepare_partial',[[self.picking.id]])
+ .then(function(){
+ self.refresh_ui(self.picking.id);
+ });
+ },
quit: function(){
this.destroy();
return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_picking_type_form']], ['res_id']).pipe(function(res) {
diff --git a/addons/stock/static/src/xml/picking.xml b/addons/stock/static/src/xml/picking.xml
index 0e2e8653bce..9bdab1e89d9 100644
--- a/addons/stock/static/src/xml/picking.xml
+++ b/addons/stock/static/src/xml/picking.xml
@@ -1,51 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
- <!-- <t t-name="TactileListWidget">
- <div class='oe_tactlist js_width' t-att-style="'width:' + widget.get_width() + 'px'">
- <div class='oe_tactlist_header'>
- <t t-esc='widget.get_title()' />
- </div>
-
- <div class='oe_scrolltable js_height' t-att-style="'height:' + widget.get_height() + 'px'">
- <div class='oe_scrolltable_scroll'>
- <div class='oe_scrolltable_header_container js_innerwidth' t-att-style="'width:' + widget.get_innerwidth() + 'px'">
- <table class='oe_scrolltable_header js_innerwidth' >
- <tbody>
- <tr>
- <t t-foreach="widget.get_collumns()" t-as="col">
- <td t-att-class="col.classes">
- <t t-esc="col.header" />
- </td>
- </t>
- </tr>
- </tbody>
- </table>
- </div>
- <table class='oe_scrolltable_body js_innerwidth' t-att-style="'width:' + widget.get_innerwidth() + 'px'">
- <colgroup>
- <t t-foreach="widget.get_collumns()" t-as="col">
- <col t-att-class="col.classes"></col>
- </t>
- </colgroup>
- <tbody>
- <t t-foreach="widget.get_rows()" t-as="row">
- <tr t-att-class="row.classes">
- <t t-foreach="row.cols" t-as="col">
- <td><t t-esc="col" /></td>
- </t>
- </tr>
- </t>
- </tbody>
- </table>
- </div>
- </div>
- <div class='oe_vresizer js_vresizer'>
- <span class='oe_hresizer js_hresizer'>●</span>
- </div>
- </div>
- </t> -->
-
<t t-name='PickingEditorWidget'>
<div class="modal fade" id="js_LocationChooseModal" tabindex="-1" role="dialog" aria-labelledby="LocationChooseModal" aria-hidden="true">
@@ -164,9 +119,9 @@
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
- <!-- <t t-if="!row.cols.lot &amp;&amp; row.cols.product_id">
+ <t t-if="!row.cols.lot &amp;&amp; row.cols.product_id">
<li><a class="js_create_lot" href="#">Create Lot</a></li>
- </t> -->
+ </t>
<t t-if="!row.cols.head_container &amp;&amp; !row.cols.container">
<li><a class="js_change_src" href="#">Change source location</a></li>
<li><a class="js_change_dst" href="#">Change destination location</a></li>
@@ -266,6 +221,9 @@
<div class="container">
<div class='oe_placeholder_picking_editor'/>
+ <div class="text-center">
+ <button class="btn btn-default js_reload_op">Recompute operations</button>
+ </div>
</div>
</t>