From b2ec2351e2fe5dda389dfbbe413a90c891fb22a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 26 Jun 2013 10:30:39 +0200 Subject: [PATCH 1/6] [IMP] stock: picking gui initial commit bzr revid: fva@openerp.com-20130626083039-vrwwmwulddkirg83 --- addons/stock/__openerp__.py | 10 +- addons/stock/static/src/css/picking.css | 179 +++++++++++++++++++++++ addons/stock/static/src/js/main.js | 14 ++ addons/stock/static/src/js/widgets.js | 154 ++++++++++++++++++++ addons/stock/static/src/xml/picking.xml | 184 ++++++++++++++++++++++++ 5 files changed, 540 insertions(+), 1 deletion(-) create mode 100644 addons/stock/static/src/css/picking.css create mode 100644 addons/stock/static/src/js/main.js create mode 100644 addons/stock/static/src/js/widgets.js create mode 100644 addons/stock/static/src/xml/picking.xml diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index b3d7e30f1ce..a4acc026d7e 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -98,7 +98,15 @@ Dashboard / Reports for Warehouse Management will include: 'installable': True, 'application': True, 'auto_install': False, - 'css': [ 'static/src/css/stock.css' ], + 'css': [ + 'static/src/css/picking.css', + 'static/src/css/stock.css', + ], + 'js': [ + 'static/src/js/widgets.js', + 'static/src/js/main.js', + ], + 'qweb':['static/src/xml/picking.xml'], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock/static/src/css/picking.css b/addons/stock/static/src/css/picking.css new file mode 100644 index 00000000000..bc131efb715 --- /dev/null +++ b/addons/stock/static/src/css/picking.css @@ -0,0 +1,179 @@ + +/* ----------------------- * + * PICKING WIDGET LAYOUT * + * ----------------------- */ + +.oe_pick_widget { + position: absolute; + top: 0px; right: 0px; bottom: 0px; left: 0px; + color: #444444; + background: #686868; + text-shadow: none; + font-family: 'Lato'; +} +.oe_pick_widget .oe_pick_layout { + width: 100%; + height: 100%; +} + +.oe_pick_widget .oe_pick_header{ + background: red; +} +.oe_pick_widget .oe_pick_body_cont{ + background: blue; + height: 100%; +} +.oe_pick_widget .oe_pick_body{ + width: 100%; + height: 100%; + background: green; + overflow: hidden; + overflow-y: auto; +} +.oe_pick_widget .oe_pick_app{ + width: 600px; + background: yellow; + margin: 40px auto; +} +.oe_pick_widget .oe_pick_toolbar{ + width: 600px; + background: purple; + margin: auto; + text-align: center; +} +.oe_pick_widget .oe_pick_button{ + display: inline-block; + min-width: 120px; + padding: 15px; + margin: 10px; + text-align: center; + line-height: 30px; + background: white; +} +.oe_pick_widget .oe_pick_right_toolbar{ + background: blue; + float: right; +} +.oe_pick_widget .oe_pick_col_small{ width: 50px; } +.oe_pick_widget .oe_pick_col_medium{ width: 100px; } +.oe_pick_widget .oe_pick_col_big{ width: 200px; } +.oe_pick_widget .oe_pick_col_expand{ width: 100%; } +.oe_pick_widget .oe_invalid{ + background: red; + color: white; +} + +/* ----------------------- * + * PICKING TABLES * + * ----------------------- */ + +.oe_pick_widget .oe_pick_list{ + background: red; + margin: 20px 0px; +} + +.oe_pick_widget .oe_pick_list_header{ + background: blue; +} +.oe_pick_widget .oe_pick_list_table{ + width: 100%; + table-layout: fixed; + background: greenyellow; + +} + + + +/* ----------------------- * + * TACTILE LIST * + * ----------------------- */ + +.openerp .oe_tactlist { + border-radius: 3px; + font-size: 18px; + background: black; + color: white; + margin-bottom: 20px; +} +.openerp .oe_tactlist .oe_tactlist_header{ + padding: 5px; + font-size: 24px; + overflow: hidden; +} +.openerp .oe_tactlist .oe_vresizer{ + cursor: ns-resize; + height: 15px; +} +.openerp .oe_tactlist .oe_hresizer{ + display: inline-block; + float: right; + height: 15px; + width: 15px; + line-height: 15px; + text-align: center; + font-size: 9px; + color: rgba(255,255,255,0.3); + cursor: move; +} +.openerp .oe_tactlist .oe_scrolltable{ + position: relative; + background: rgb(209,209,209); +} +.openerp .oe_tactlist td{ + padding: 5px; + box-sizing: border-box; + overflow: hidden; +} +.openerp .oe_tactlist .oe_scrolltable_scroll{ + height: 100%; + overflow-y: scroll; + overflow-x: hidden; +} +.openerp .oe_tactlist .oe_scrolltable_header_container{ + position: absolute; + top: 0px; + overflow: hidden; +} +.openerp .oe_tactlist .oe_scrolltable_header{ + background: black; + color: white; + width: 100%; + table-layout: fixed; +} +.openerp .oe_tactlist .oe_scrolltable_body{ + table-layout: fixed; + margin-top: 32px; + background: #D6D6D6; + color: #444444; +} +.openerp .oe_tactlist .oe_invalid{ + background: rgb(255, 192, 192); + color: rgb(201, 0, 0); +} +.openerp .oe_tactlist .oe_scrolltable_body tr:nth-child(even){ + background: rgba(0,0,0,0.02); +} +.openerp .oe_tactlist td.oe_small, .openerp .oe_tactlist col.oe_small{ width: 50px; } +.openerp .oe_tactlist td.oe_medium, .openerp .oe_tactlist col.oe_medium{ width: 100px; } +.openerp .oe_tactlist td.oe_big, .openerp .oe_tactlist col.oe_big{ width: 200px; } +.openerp .oe_tactlist td.oe_expand, .openerp .oe_tactlist col.oe_expand{ width: 100%; } + +.openerp .oe_tactlist ::-webkit-scrollbar{ + width: 15px; + background-color: black; +} +.openerp .oe_tactlist ::-webkit-scrollbar-track{ + background-color: black; +} +.openerp .oe_tactlist ::-webkit-scrollbar-thumb{ + background-color: rgba(255,255,255,0.6); + border: solid 4px black; +} +.openerp .oe_tactlist ::-wekbit-scrollbar-button{ + display: none; +} + + + + + diff --git a/addons/stock/static/src/js/main.js b/addons/stock/static/src/js/main.js new file mode 100644 index 00000000000..ca345c5e6b1 --- /dev/null +++ b/addons/stock/static/src/js/main.js @@ -0,0 +1,14 @@ +console.log('Executing picking module'); + +openerp.stock = function(instance){ + + console.log('Loading stock picking module'); + + instance.stock = instance.stock || {}; + + openerp_picking_widgets(instance); + + instance.web.client_actions.add('stock.ui', 'instance.stock.PickingMainWidget'); +}; + + diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js new file mode 100644 index 00000000000..44d836511d5 --- /dev/null +++ b/addons/stock/static/src/js/widgets.js @@ -0,0 +1,154 @@ + +function openerp_picking_widgets(instance){ + var module = instance.stock; + + /* + * new TactileListWidget(parent,{ + * height: '500px', + * width: '100%', + * title: 'Sample List', + * collumns: [ + * {header:'Foobar', classes:'oe_small'}, + * {header:'Foobar', classes:'oe_medium'}, + * {header:'' , classes:'oe_big'}, + * {header:'BarFoo', classes:'oe_expand'}, + * ], + * rows: [ + * {cols: [0,1,2,3] }, + * {cols: [1,2,3,4], classes:'oe_selected oe_invalid'}, + * {cols: [2,1,3,4] }, + * ] + * }); + */ + + module.TactileListWidget = instance.web.Widget.extend({ + template: 'TactileListWidget', + init: function(parent, options){ + this._super(parent,options); + this._collumns = options.collumns || []; + this._rows = options.rows || []; + this._title = options.title || ''; + this._width = options.width || 625; + this._height = options.height || 200; + this._scrollbarwidth = 15; + }, + renderElement: function(){ + var self = this; + this._super(); + this.$('.js_vresizer, .js_hresizer').mousedown(function(event){ + self._startsize = {height: self.get_height(), width: self.get_width()}; + console.log('drag init:',self._startsize); + }); + this.$('.js_vresizer').drag(function(event,dragevent){ + self.set_height(self._startsize.height + dragevent.deltaY); + }); + this.$('.js_hresizer').drag(function(event,dragevent){ + self.set_height(self._startsize.height + dragevent.deltaY); + self.set_width(self._startsize.width + dragevent.deltaX); + }); + }, + get_collumns: function(){ + return this._collumns; + }, + get_rows: function(){ + return this._rows; + }, + add_row: function(row){ + this._rows.push(row); + this.renderElement(); + }, + get_title: function(){ + return this._title; + }, + get_width: function(){ + return this._width; + }, + get_innerwidth: function(){ + return this._width - this._scrollbarwidth; + }, + set_width: function(width){ + if(width >= 0){ + this._width = width; + this.$('.js_innerwidth').css({'width':this.get_innerwidth()+'px'}); + this.$el.css({'width':this.get_width()+'px'}); + } + }, + get_height: function(){ + return this._height; + }, + set_height: function(height){ + if(height >= 0){ + this._height = height; + this.$('.js_height').css({'height':this.get_height()+'px'}); + } + }, + }); + + module.PickingEditorWidget = instance.web.Widget.extend({ + template: 'PickingEditorWidget', + get_header: function(){ + return 'Picking: INTERNAL/00112'; + }, + get_rows: function(){ + return [ + { cols: { product:'abc', qty:1, rem: 4, uom: 5, loc: 'def', stat: 'available' }, }, + { cols: { product:'dec', qty:2, rem: 3, uom: 5, loc: 'rcd', stat: 'available' }, classes: 'oe_invalid' }, + { cols: { product:'qcr', qty:4, rem: 4, uom: 5, loc: 'hre', stat: 'unavailable' }, }, + ]; + }, + }); + + module.PackageEditorWidget = instance.web.Widget.extend({ + template: 'PackageEditorWidget', + get_header: function(){ + return 'Package: 032 '; + }, + get_rows: function(){ + return [ + { cols: { product:'abc', qty:1, uom: 5, }, }, + { cols: { product:'dec', qty:2, uom: 5, }, classes: 'oe_invalid' }, + { cols: { product:'qcr', qty:4, uom: 5, }, }, + ]; + }, + }); + + module.PackageSelectorWidget = instance.web.Widget.extend({ + template: 'PackageSelectorWidget', + get_header: function(){ + return 'Package Selector'; + }, + get_rows: function(){ + return [ + { cols: { pack:'abc' }, }, + { cols: { pack:'def' }, classes: 'oe_invalid' }, + { cols: { pack:'ghi' }, }, + ]; + }, + increment: function(){ + }, + decrement: function(){ + }, + }); + + module.PickingMainWidget = instance.web.Widget.extend({ + template: 'PickingMainWidget', + init: function(){ + + }, + start: function(){ + var self = this; + instance.webclient.set_content_full_screen(true); + + var picking_editor = new module.PickingEditorWidget(this); + picking_editor.replace(this.$('.oe_placeholder_picking_editor')); + + var package_editor = new module.PackageEditorWidget(this); + package_editor.replace(this.$('.oe_placeholder_package_editor')); + + var package_selector = new module.PackageSelectorWidget(this); + package_selector.replace(this.$('.oe_placeholder_package_selector')); + + return this._super(); + }, + }); +} diff --git a/addons/stock/static/src/xml/picking.xml b/addons/stock/static/src/xml/picking.xml new file mode 100644 index 00000000000..8b6847a54b0 --- /dev/null +++ b/addons/stock/static/src/xml/picking.xml @@ -0,0 +1,184 @@ + + + + +
+
+ +
+ +
+
+
+ + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + +
+
+
+
+ ● +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Product Qty Rem UoM Location Status
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Product Qty UoM
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Package
+ -
+
+
+ + +
+ + + + + + + +
+ +
+
Quit
+
+ +
+
Pack
+
Reset
+
Done
+
+ + +
+
+
+ +
+
+
+ +
+
+
+
+
+ +
From 713be5f47f24bdf043dee7a5a7272e9727967d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 26 Jun 2013 11:20:29 +0200 Subject: [PATCH 2/6] [WIP] stock.ui: loading packaging data bzr revid: fva@openerp.com-20130626092029-c8ja8rlix8oxftgp --- addons/stock/static/src/js/widgets.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js index 44d836511d5..fc5d88276e5 100644 --- a/addons/stock/static/src/js/widgets.js +++ b/addons/stock/static/src/js/widgets.js @@ -132,8 +132,14 @@ function openerp_picking_widgets(instance){ module.PickingMainWidget = instance.web.Widget.extend({ template: 'PickingMainWidget', - init: function(){ + init: function(parent,params){ + this._super(parent,params); + console.log(params); + var packages = new instance.web.Model('stock.quant.package'); + packages.query('name','packaging_id','quant_ids','parent_id','children_ids','location_id','pack_operation_id').all().then(function(result){ + console.log(result); + }); }, start: function(){ var self = this; From 1e20612f170e09026b8186e9061cc71babfa5916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 26 Jun 2013 15:11:31 +0200 Subject: [PATCH 3/6] [IMP] stock.ui: styling bzr revid: fva@openerp.com-20130626131131-8hn0f5cmqw19k7no --- addons/stock/static/src/css/picking.css | 169 +++++++++--------------- addons/stock/static/src/js/widgets.js | 146 ++++++-------------- addons/stock/static/src/xml/picking.xml | 29 ++-- 3 files changed, 124 insertions(+), 220 deletions(-) diff --git a/addons/stock/static/src/css/picking.css b/addons/stock/static/src/css/picking.css index bc131efb715..5baa9846710 100644 --- a/addons/stock/static/src/css/picking.css +++ b/addons/stock/static/src/css/picking.css @@ -17,50 +17,65 @@ } .oe_pick_widget .oe_pick_header{ - background: red; + background: #454343; + background-image: linear-gradient(#646060,#262626); } .oe_pick_widget .oe_pick_body_cont{ - background: blue; height: 100%; } .oe_pick_widget .oe_pick_body{ width: 100%; height: 100%; - background: green; + background-color: white; + background: url('/web/static/src/img/form_sheetbg.png'); + box-shadow: 0px 9px 5px -5px rgba(0, 0, 0, 0.16) inset; overflow: hidden; overflow-y: auto; } .oe_pick_widget .oe_pick_app{ width: 600px; - background: yellow; + background: white; margin: 40px auto; + padding: 20px; + border: solid 1px rgb(228, 228, 255); + box-shadow: 0px 2px 3px rgba(114, 114, 175, 0.11); } .oe_pick_widget .oe_pick_toolbar{ width: 600px; - background: purple; margin: auto; text-align: center; } .oe_pick_widget .oe_pick_button{ display: inline-block; min-width: 120px; - padding: 15px; - margin: 10px; + padding: 5px; + font-size: 18px; + border-radius: 3px; + margin: 10px 5px; text-align: center; line-height: 30px; - background: white; + background: linear-gradient(#b2b3d7, #7f82ac); + color: #273072; + border: 1px solid #353A7E; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + cursor: pointer; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); } .oe_pick_widget .oe_pick_right_toolbar{ - background: blue; float: right; } -.oe_pick_widget .oe_pick_col_small{ width: 50px; } -.oe_pick_widget .oe_pick_col_medium{ width: 100px; } -.oe_pick_widget .oe_pick_col_big{ width: 200px; } -.oe_pick_widget .oe_pick_col_expand{ width: 100%; } +.oe_pick_widget .oe_pick_right_toolbar .oe_pick_button{ + margin-right: 10px; +} +.oe_pick_widget .oe_pick_col_small{ width: 50px; } +.oe_pick_widget .oe_pick_col_medium{ width: 100px; } +.oe_pick_widget .oe_pick_col_big{ width: 200px; } +.oe_pick_widget .oe_pick_col_expand{ width: 100%; } +.oe_pick_widget .oe_centeralign{ text-align: center; } + .oe_pick_widget .oe_invalid{ - background: red; - color: white; + background: rgb(255, 226, 226); + color: rgb(168, 6, 6); } /* ----------------------- * @@ -68,112 +83,50 @@ * ----------------------- */ .oe_pick_widget .oe_pick_list{ - background: red; - margin: 20px 0px; + margin: 0px 0px 20px 0px; + padding: 5px; } .oe_pick_widget .oe_pick_list_header{ - background: blue; + font-size: 20px; + margin-bottom: 5px; } .oe_pick_widget .oe_pick_list_table{ + background: whitesmoke; width: 100%; table-layout: fixed; - background: greenyellow; - -} - - - -/* ----------------------- * - * TACTILE LIST * - * ----------------------- */ - -.openerp .oe_tactlist { + font-size: 16px; border-radius: 3px; - font-size: 18px; - background: black; - color: white; - margin-bottom: 20px; + } -.openerp .oe_tactlist .oe_tactlist_header{ +.oe_pick_widget .oe_pick_list_table tbody tr:nth-child(odd){ + background: rgb(250,250,250); +} +.oe_pick_widget .oe_pick_list_table td, +.oe_pick_widget .oe_pick_list_table th { padding: 5px; - font-size: 24px; - overflow: hidden; } -.openerp .oe_tactlist .oe_vresizer{ - cursor: ns-resize; - height: 15px; +.oe_pick_widget .oe_pick_list_table thead{ + background: rgb(224, 225, 235); + border-top-left-radius: 3px; + border-top-right-radius: 3px; } -.openerp .oe_tactlist .oe_hresizer{ +.oe_pick_widget .oe_pick_list_table th { + background: none; + border: none; + font-weight: bold; +} +.oe_pick_widget .oe_row_button{ display: inline-block; - float: right; - height: 15px; - width: 15px; - line-height: 15px; - text-align: center; - font-size: 9px; - color: rgba(255,255,255,0.3); - cursor: move; + background: rgb(255, 255, 255); + width: 16px; + height: 16px; + line-height: 14px; + color: rgb(102, 98, 133); + font-weight: bold; + border-radius: 9px; + border: solid 1px rgba(0, 0, 0, 0.09); + cursor: pointer; } -.openerp .oe_tactlist .oe_scrolltable{ - position: relative; - background: rgb(209,209,209); -} -.openerp .oe_tactlist td{ - padding: 5px; - box-sizing: border-box; - overflow: hidden; -} -.openerp .oe_tactlist .oe_scrolltable_scroll{ - height: 100%; - overflow-y: scroll; - overflow-x: hidden; -} -.openerp .oe_tactlist .oe_scrolltable_header_container{ - position: absolute; - top: 0px; - overflow: hidden; -} -.openerp .oe_tactlist .oe_scrolltable_header{ - background: black; - color: white; - width: 100%; - table-layout: fixed; -} -.openerp .oe_tactlist .oe_scrolltable_body{ - table-layout: fixed; - margin-top: 32px; - background: #D6D6D6; - color: #444444; -} -.openerp .oe_tactlist .oe_invalid{ - background: rgb(255, 192, 192); - color: rgb(201, 0, 0); -} -.openerp .oe_tactlist .oe_scrolltable_body tr:nth-child(even){ - background: rgba(0,0,0,0.02); -} -.openerp .oe_tactlist td.oe_small, .openerp .oe_tactlist col.oe_small{ width: 50px; } -.openerp .oe_tactlist td.oe_medium, .openerp .oe_tactlist col.oe_medium{ width: 100px; } -.openerp .oe_tactlist td.oe_big, .openerp .oe_tactlist col.oe_big{ width: 200px; } -.openerp .oe_tactlist td.oe_expand, .openerp .oe_tactlist col.oe_expand{ width: 100%; } - -.openerp .oe_tactlist ::-webkit-scrollbar{ - width: 15px; - background-color: black; -} -.openerp .oe_tactlist ::-webkit-scrollbar-track{ - background-color: black; -} -.openerp .oe_tactlist ::-webkit-scrollbar-thumb{ - background-color: rgba(255,255,255,0.6); - border: solid 4px black; -} -.openerp .oe_tactlist ::-wekbit-scrollbar-button{ - display: none; -} - - - diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js index fc5d88276e5..f49275ef2c0 100644 --- a/addons/stock/static/src/js/widgets.js +++ b/addons/stock/static/src/js/widgets.js @@ -2,97 +2,18 @@ function openerp_picking_widgets(instance){ var module = instance.stock; - /* - * new TactileListWidget(parent,{ - * height: '500px', - * width: '100%', - * title: 'Sample List', - * collumns: [ - * {header:'Foobar', classes:'oe_small'}, - * {header:'Foobar', classes:'oe_medium'}, - * {header:'' , classes:'oe_big'}, - * {header:'BarFoo', classes:'oe_expand'}, - * ], - * rows: [ - * {cols: [0,1,2,3] }, - * {cols: [1,2,3,4], classes:'oe_selected oe_invalid'}, - * {cols: [2,1,3,4] }, - * ] - * }); - */ - - module.TactileListWidget = instance.web.Widget.extend({ - template: 'TactileListWidget', - init: function(parent, options){ - this._super(parent,options); - this._collumns = options.collumns || []; - this._rows = options.rows || []; - this._title = options.title || ''; - this._width = options.width || 625; - this._height = options.height || 200; - this._scrollbarwidth = 15; - }, - renderElement: function(){ - var self = this; - this._super(); - this.$('.js_vresizer, .js_hresizer').mousedown(function(event){ - self._startsize = {height: self.get_height(), width: self.get_width()}; - console.log('drag init:',self._startsize); - }); - this.$('.js_vresizer').drag(function(event,dragevent){ - self.set_height(self._startsize.height + dragevent.deltaY); - }); - this.$('.js_hresizer').drag(function(event,dragevent){ - self.set_height(self._startsize.height + dragevent.deltaY); - self.set_width(self._startsize.width + dragevent.deltaX); - }); - }, - get_collumns: function(){ - return this._collumns; - }, - get_rows: function(){ - return this._rows; - }, - add_row: function(row){ - this._rows.push(row); - this.renderElement(); - }, - get_title: function(){ - return this._title; - }, - get_width: function(){ - return this._width; - }, - get_innerwidth: function(){ - return this._width - this._scrollbarwidth; - }, - set_width: function(width){ - if(width >= 0){ - this._width = width; - this.$('.js_innerwidth').css({'width':this.get_innerwidth()+'px'}); - this.$el.css({'width':this.get_width()+'px'}); - } - }, - get_height: function(){ - return this._height; - }, - set_height: function(height){ - if(height >= 0){ - this._height = height; - this.$('.js_height').css({'height':this.get_height()+'px'}); - } - }, - }); - module.PickingEditorWidget = instance.web.Widget.extend({ template: 'PickingEditorWidget', + init: function(parent,options){ + this._super(parent,options); + }, get_header: function(){ - return 'Picking: INTERNAL/00112'; + return this._header || 'Picking: INTERNAL/00112'; }, get_rows: function(){ - return [ + return this._rows || [ { cols: { product:'abc', qty:1, rem: 4, uom: 5, loc: 'def', stat: 'available' }, }, - { cols: { product:'dec', qty:2, rem: 3, uom: 5, loc: 'rcd', stat: 'available' }, classes: 'oe_invalid' }, + { cols: { product:'dec', qty:2, rem: 3, uom: 5, loc: 'rcd', stat: 'available' }, classes: '' }, { cols: { product:'qcr', qty:4, rem: 4, uom: 5, loc: 'hre', stat: 'unavailable' }, }, ]; }, @@ -101,12 +22,12 @@ function openerp_picking_widgets(instance){ module.PackageEditorWidget = instance.web.Widget.extend({ template: 'PackageEditorWidget', get_header: function(){ - return 'Package: 032 '; + return this._header || 'Package: 032 '; }, get_rows: function(){ - return [ + return this._rows || [ { cols: { product:'abc', qty:1, uom: 5, }, }, - { cols: { product:'dec', qty:2, uom: 5, }, classes: 'oe_invalid' }, + { cols: { product:'dec', qty:2, uom: 5, }, classes: '' }, { cols: { product:'qcr', qty:4, uom: 5, }, }, ]; }, @@ -115,31 +36,52 @@ function openerp_picking_widgets(instance){ module.PackageSelectorWidget = instance.web.Widget.extend({ template: 'PackageSelectorWidget', get_header: function(){ - return 'Package Selector'; + return this._header || 'Package Selector'; }, get_rows: function(){ - return [ - { cols: { pack:'abc' }, }, - { cols: { pack:'def' }, classes: 'oe_invalid' }, - { cols: { pack:'ghi' }, }, + return this._rows || [ + { cols: { pack:'abc', qty:12 }, }, + { cols: { pack:'def', qty:500 }, classes: '' }, + { cols: { pack:'ghi', qty:1 }, }, ]; }, - increment: function(){ - }, - decrement: function(){ - }, }); module.PickingMainWidget = instance.web.Widget.extend({ template: 'PickingMainWidget', init: function(parent,params){ this._super(parent,params); - console.log(params); + + console.log('Action params:', params); + + new instance.web.Model('stock.picking.in') + .query() + .all() + .then(function(results){ + console.log('Picking In:',results); + }); + + new instance.web.Model('stock.picking.out') + .query() + .all() + .then(function(results){ + console.log('Picking Out:',results); + }); + + new instance.web.Model('stock.quant.package') + .query(['name','packaging_id','quant_ids','parent_id','children_ids','location_id','pack_operation_id']) + .all() + .then(function(result){ + console.log('Packages: ',result); + }); + + new instance.web.Model('stock.pack.operation') + .query(['picking_id','product_id','product_uom','product_qty','package_id','quant_id','result_package_id']) + .all() + .then(function(results){ + console.log('Pack Operations:',results); + }); - var packages = new instance.web.Model('stock.quant.package'); - packages.query('name','packaging_id','quant_ids','parent_id','children_ids','location_id','pack_operation_id').all().then(function(result){ - console.log(result); - }); }, start: function(){ var self = this; diff --git a/addons/stock/static/src/xml/picking.xml b/addons/stock/static/src/xml/picking.xml index 8b6847a54b0..c1c5f088f11 100644 --- a/addons/stock/static/src/xml/picking.xml +++ b/addons/stock/static/src/xml/picking.xml @@ -62,7 +62,12 @@ - Product Qty Rem UoM Location Status + Product + Qty + Rem + UoM + Location + Status @@ -70,9 +75,9 @@ - - - + + + @@ -96,7 +101,9 @@ - Product Qty UoM + Product + Qty + UoM @@ -104,8 +111,8 @@ - - + + @@ -123,11 +130,12 @@ + - Package + Package Qty @@ -135,8 +143,9 @@ - + - - + + + + - From 53a8aadac3584c84c99d481d5c70bfc25734d603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 26 Jun 2013 16:14:21 +0200 Subject: [PATCH 4/6] [IMP] stock.ui: load picking data, and scan api usage bzr revid: fva@openerp.com-20130626141421-hal2ji0mhxsbk7rd --- addons/stock/static/src/js/widgets.js | 85 ++++++++++++++++----------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js index f49275ef2c0..85233e486fe 100644 --- a/addons/stock/static/src/js/widgets.js +++ b/addons/stock/static/src/js/widgets.js @@ -11,11 +11,25 @@ function openerp_picking_widgets(instance){ return this._header || 'Picking: INTERNAL/00112'; }, get_rows: function(){ - return this._rows || [ - { cols: { product:'abc', qty:1, rem: 4, uom: 5, loc: 'def', stat: 'available' }, }, - { cols: { product:'dec', qty:2, rem: 3, uom: 5, loc: 'rcd', stat: 'available' }, classes: '' }, - { cols: { product:'qcr', qty:4, rem: 4, uom: 5, loc: 'hre', stat: 'unavailable' }, }, - ]; + var model = this.getParent(); + var rows = []; + console.log('Parent:', this.getParent()); + + _.each( model.movelines, function(moveline){ + console.log('Moveline:',moveline); + rows.push({ + cols: { product: moveline.product_id[1], + qty: moveline.product_qty, + rem: moveline.qty_remaining, + uom: moveline.product_uom[1], + loc: moveline.location_id[1], + stat: moveline.state + }, + classes: (moveline.qty_remaining < 0 ? 'oe_invalid' : '') + }); + }); + + return rows; }, }); @@ -51,35 +65,26 @@ function openerp_picking_widgets(instance){ template: 'PickingMainWidget', init: function(parent,params){ this._super(parent,params); + var self = this; + + this.picking = null; + this.movelines = null; + + window.pickwidget = this; console.log('Action params:', params); - new instance.web.Model('stock.picking.in') + this.loaded = new instance.web.Model('stock.picking.in') .query() .all() - .then(function(results){ - console.log('Picking In:',results); - }); - - new instance.web.Model('stock.picking.out') - .query() - .all() - .then(function(results){ - console.log('Picking Out:',results); - }); - - new instance.web.Model('stock.quant.package') - .query(['name','packaging_id','quant_ids','parent_id','children_ids','location_id','pack_operation_id']) - .all() - .then(function(result){ - console.log('Packages: ',result); - }); - - new instance.web.Model('stock.pack.operation') - .query(['picking_id','product_id','product_uom','product_qty','package_id','quant_id','result_package_id']) - .all() - .then(function(results){ - console.log('Pack Operations:',results); + .then(function(picking_in){ + self.picking = picking_in[0]; + console.log('Picking In:',picking_in); + + return new instance.web.Model('stock.move').call('read',[self.picking.move_lines, []]); + }).then(function(movelines){ + self.movelines = movelines; + console.log('Move Lines:',movelines); }); }, @@ -87,16 +92,26 @@ function openerp_picking_widgets(instance){ var self = this; instance.webclient.set_content_full_screen(true); - var picking_editor = new module.PickingEditorWidget(this); - picking_editor.replace(this.$('.oe_placeholder_picking_editor')); + $.when(this.loaded).done(function(){ + var picking_editor = new module.PickingEditorWidget(self); + picking_editor.replace(self.$('.oe_placeholder_picking_editor')); - var package_editor = new module.PackageEditorWidget(this); - package_editor.replace(this.$('.oe_placeholder_package_editor')); + var package_editor = new module.PackageEditorWidget(self); + package_editor.replace(self.$('.oe_placeholder_package_editor')); + + var package_selector = new module.PackageSelectorWidget(self); + package_selector.replace(self.$('.oe_placeholder_package_selector')); + }); - var package_selector = new module.PackageSelectorWidget(this); - package_selector.replace(this.$('.oe_placeholder_package_selector')); return this._super(); }, + scan: function(ean){ + new instance.web.Model('stock.picking') + .call('get_barcode_and_return_todo_stuff', [this.picking.id, ean]) + .then(function(results){ + console.log('STUFF TODO:', arguments); + }); + }, }); } From 353698d211a520f677d8a1af1e1f6e63865197c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 26 Jun 2013 16:38:15 +0200 Subject: [PATCH 5/6] [IMP] stock.ui: close bzr revid: fva@openerp.com-20130626143815-jnnp2rcu0c6qqsec --- addons/stock/static/src/css/picking.css | 2 ++ addons/stock/static/src/js/widgets.js | 7 +++++++ addons/stock/static/src/xml/picking.xml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/stock/static/src/css/picking.css b/addons/stock/static/src/css/picking.css index 5baa9846710..4231c014d6e 100644 --- a/addons/stock/static/src/css/picking.css +++ b/addons/stock/static/src/css/picking.css @@ -105,6 +105,8 @@ .oe_pick_widget .oe_pick_list_table td, .oe_pick_widget .oe_pick_list_table th { padding: 5px; + overflow: hidden; + text-overflow: ellipsis; } .oe_pick_widget .oe_pick_list_table thead{ background: rgb(224, 225, 235); diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js index 85233e486fe..7792939c780 100644 --- a/addons/stock/static/src/js/widgets.js +++ b/addons/stock/static/src/js/widgets.js @@ -92,6 +92,8 @@ function openerp_picking_widgets(instance){ var self = this; instance.webclient.set_content_full_screen(true); + this.$('.js_pick_quit').click(function(){ self.quit(); }); + $.when(this.loaded).done(function(){ var picking_editor = new module.PickingEditorWidget(self); picking_editor.replace(self.$('.oe_placeholder_picking_editor')); @@ -113,5 +115,10 @@ function openerp_picking_widgets(instance){ console.log('STUFF TODO:', arguments); }); }, + quit: function(){ + console.log('Quit'); + instance.webclient.set_content_full_screen(false); + window.location = '/'; // FIXME THIS IS SHIT NIV WILL KILL YOU (BY MULTIPLE FACE-STABBING) IF YOU MERGE THIS IN TRUNK + }, }); } diff --git a/addons/stock/static/src/xml/picking.xml b/addons/stock/static/src/xml/picking.xml index c1c5f088f11..9af59a67661 100644 --- a/addons/stock/static/src/xml/picking.xml +++ b/addons/stock/static/src/xml/picking.xml @@ -166,7 +166,7 @@
Pack
-
Reset
+
Done
From 7bad5e494a26f9cd366e5f74587e3a1b8d2e599a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 26 Jun 2013 16:42:58 +0200 Subject: [PATCH 6/6] [IMP] stock.ui: made columns slightly larger (20% to be perfectly exact and accurate! ) bzr revid: fva@openerp.com-20130626144258-17i014uo4dhycktr --- addons/stock/static/src/css/picking.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/static/src/css/picking.css b/addons/stock/static/src/css/picking.css index 4231c014d6e..6df9459278b 100644 --- a/addons/stock/static/src/css/picking.css +++ b/addons/stock/static/src/css/picking.css @@ -67,7 +67,7 @@ .oe_pick_widget .oe_pick_right_toolbar .oe_pick_button{ margin-right: 10px; } -.oe_pick_widget .oe_pick_col_small{ width: 50px; } +.oe_pick_widget .oe_pick_col_small{ width: 60px; } .oe_pick_widget .oe_pick_col_medium{ width: 100px; } .oe_pick_widget .oe_pick_col_big{ width: 200px; } .oe_pick_widget .oe_pick_col_expand{ width: 100%; }