'static/src/css/stock.css',
],
'js': [
- 'static/lib/sparkline/jquery.sparkline.js',
- 'static/lib/justgage.js',
- 'static/src/js/stock_picking_type.js',
'static/src/js/widgets.js',
],
'qweb': ['static/src/xml/picking.xml'],
* ----------------------- */
.oe_pick_widget .oe_searchbox{
- float: right;
+ margin-top: 13px;
}
.oe_pick_widget .oe_searchbox input{
padding: 8px;
console.log('Id:',id);
self.getParent().scan_product_id(id);
});
+
+ //remove navigtion bar from default openerp GUI
+ $('td.navbar').html('<div></div>');
},
});
}
self.pickings_by_type[0] = [];
- return new instance.web.Model('stock.picking').call('search_read',[ [['state','in',['confirmed','assigned']]], [] ], {context: new instance.web.CompoundContext()});
+ return new instance.web.Model('stock.picking').call('search_read',[ [['state','in', ['assigned', 'partially_available']]], [] ], {context: new instance.web.CompoundContext()});
}).then(function(pickings){
self.pickings = pickings;
this.$('.oe_searchbox input').keyup(function(event){
self.on_searchbox($(this).val());
});
+ //remove navigtion bar from default openerp GUI
+ $('td.navbar').html('<div></div>');
},
start: function(){
this._super();
this.packages = null;
this.barcode_scanner = new module.BarcodeScanner();
this.picking_type_id = params.context.active_id || 0;
-
if(params.context.picking_id){
this.loaded = this.load(params.context.picking_id);
function load_picking_list(type_id){
var pickings = new $.Deferred();
-
new instance.web.Model('stock.picking')
.call('get_next_picking_for_ui',[{'default_picking_type_id':type_id}])
.then(function(picking_ids){
buttons: [{
text:_t('Ok'),
click: function(){
- self.quit();
+ self.menu();
}
}]
}, _t('<p>We could not find a picking to display.</p>'))).open();
})
.then(function(picking){
self.picking = picking;
+ self.picking_type_id = picking.picking_type_id[0];
loaded_picking.resolve();
});
}
this.barcode_scanner.connect(function(ean){
self.scan(ean);
});
+
this.$('.js_pick_quit').click(function(){ self.quit(); });
this.$('.js_pick_pack').click(function(){ self.pack(); });
this.$('.js_pick_done').click(function(){ self.done(); });
+ this.$('.js_pick_print').click(function(){ self.print_picking(); });
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(); });
});
-
- return this._super();
},
// reloads the data from the provided picking and refresh the ui.
// (if no picking_id is provided, gets the first picking in the db)
}else{
self.$('.js_pick_next').removeClass('oe_disabled');
}
-
self.$('.oe_pick_app_header').text(self.get_header());
});
},
get_header: function(){
if(this.picking){
- return _t('Picking:') +' '+this.picking.name;
+ return this.picking.name;
}else{
- return _t('Picking:');
+ return '';
}
},
menu: function(){
done: function(){
var self = this;
new instance.web.Model('stock.picking')
- .call('action_done_from_ui',[self.picking.id])
- .then(function(new_picking_id){
- return self.refresh_ui(new_picking_id);
+ .call('action_done_from_ui',[self.picking.id, {'default_picking_type_id': self.picking_type_id}])
+ .then(function(new_picking_ids){
+ if (new_picking_ids){
+ return self.refresh_ui(new_picking_ids[0]);
+ }
+ else {
+ return 0;
+ }
});
},
print_package: function(package_id){
return self.do_action(action);
});
},
+ print_picking: function(){
+ var self = this;
+ new instance.web.Model('stock.picking.type').call('read', [[self.picking_type_id], ['code'], new instance.web.CompoundContext()])
+ .then(function(pick_type){
+ console.log('self.picking_type_id.code '+pick_type[0]['code']);
+ if (pick_type[0]['code'] == 'outgoing'){
+ new instance.web.Model('stock.picking').call('do_print_delivery',[[self.picking.id]])
+ .then(function(action){
+ return self.do_action(action);
+ });
+ }
+ else {
+ console.log('self.picking_id '+picking_id);
+ new instance.web.Model('stock.picking').call('do_print_picking',[[self.picking.id]])
+ .then(function(action){
+ return self.do_action(action);
+ });
+ }
+ });
+ },
picking_next: function(){
for(var i = 0; i < this.pickings.length; i++){
if(this.pickings[i] === this.picking.id){
});
}
+
+openerp.stock = function(openerp) {
+ openerp.stock = openerp.stock || {};
+ openerp_picking_widgets(openerp);
+
+
+}
+
<table class='oe_pick_layout'>
<tr class='oe_pick_header_row'>
<td class='oe_pick_header'>
-
<div class='oe_pick_right_toolbar'>
<div class='oe_pick_button js_pick_quit'> Quit </div>
</div>
-
+ <div class='oe_pick_toolbar'>
+ <div class='oe_searchbox oe_left'>
+ <input type='text' placeholder='Search'/>
+ </div>
+ </div>
</td>
</tr>
<tr class='oe_pick_body_row'>
<div class='oe_pick_body'>
<div class='oe_pick_app'>
- <div class='oe_searchbox'>
- <input type='text' placeholder='Search'/>
- </div>
-
<h3 class='oe_pick_app_title'>Pickings</h3>
<div class='oe_picking_not_found oe_hidden'>
<div t-att-class="'oe_picking ' + (widget.pickings_by_type[type.id].length === 0 ? 'oe_empty':'js_pick_last') "
t-att-data-id="type.id">
- <span class='oe_picking_name'><t t-esc="type.name" /></span>
+ <span class='oe_picking_name'><t t-esc="type.complete_name" /></span>
<t t-if="widget.pickings_by_type[type.id].length === 0">
<span class='oe_pick_app_info'>Nothing to do</span>
</t>
</div>
</t>
+
+
<t t-name="PickingMainWidget">
<div class='oe_pick_widget'>
<table class='oe_pick_layout'>
<tr class='oe_pick_header_row'>
<td class='oe_pick_header'>
-
<div class='oe_pick_right_toolbar'>
<div class='oe_pick_button js_pick_menu'> Menu </div>
- <div class='oe_pick_button js_pick_quit'> Quit </div>
</div>
-
<div class='oe_pick_toolbar'>
- <div class='oe_pick_button oe_small oe_disabled oe_left js_pick_prev'><</div>
- <div class='oe_pick_button js_pick_pack'> Pack </div>
- <div class='oe_pick_button js_pick_done'> Done </div>
- <div class='oe_pick_button oe_small oe_disabled oe_right js_pick_next'>></div>
+ <div class='oe_pick_button oe_disabled js_pick_prev'>< Previous</div>
+ <div class='oe_pick_button oe_disabled js_pick_next'>Next ></div>
</div>
</td>
<td class='oe_pick_body_cont'>
<div class='oe_pick_body'>
<div class='oe_pick_app'>
+ <div class='oe_pick_button js_pick_done'> Done </div>
+ <div class='oe_pick_button js_pick_print'> Print </div>
<div class='oe_pick_app_header'>
<t t-esc='widget.get_header()' />
</div>
-
+
+ <div class='oe_pick_button js_pick_pack'> Put in Pack </div>
<div class='oe_placeholder_picking_editor'></div>
<div class='oe_placeholder_package_editor'></div>
<div class='oe_placeholder_package_selector'></div>
_name = "stock.picking"
_inherit = ['mail.thread']
_description = "Picking List"
- _order = "priority desc, date desc, id desc"
+ _order = "priority desc, date asc, id desc"
def _set_min_date(self, cr, uid, id, field, value, arg, context=None):
move_obj = self.pool.get("stock.move")
""" returns the next pickings to process. Used in the barcode scanner UI"""
if context is None:
context = {}
- domain = [('state', 'in', ('confirmed', 'assigned'))]
+ domain = [('state', 'in', ('assigned', 'partially_available'))]
if context.get('default_picking_type_id'):
domain.append(('picking_type_id', '=', context['default_picking_type_id']))
return self.search(cr, uid, domain, context=context)
def action_done_from_ui(self, cr, uid, picking_id, context=None):
- """ called when button 'done' in pused in the barcode scanner UI """
+ """ called when button 'done' is pushed in the barcode scanner UI """
self.do_transfer(cr, uid, [picking_id], context=context)
#return id of next picking to work on
return self.get_next_picking_for_ui(cr, uid, context=context)
_description = "The picking type determines the picking view"
_order = 'sequence'
- def __get_bar_values(self, cr, uid, obj, domain, read_fields, value_field, groupby_field, context=None):
- """ Generic method to generate data for bar chart values using SparklineBarWidget.
- This method performs obj.read_group(cr, uid, domain, read_fields, groupby_field).
-
- :param obj: the target model (i.e. crm_lead)
- :param domain: the domain applied to the read_group
- :param list read_fields: the list of fields to read in the read_group
- :param str value_field: the field used to compute the value of the bar slice
- :param str groupby_field: the fields used to group
-
- :return list section_result: a list of dicts: [
- { 'value': (int) bar_column_value,
- 'tootip': (str) bar_column_tooltip,
- }
- ]
- """
- month_begin = date.today().replace(day=1)
- section_result = [{
- 'value': 0,
- 'tooltip': (month_begin + relativedelta.relativedelta(months=i)).strftime('%B'),
- } for i in range(-2, 2, 1)]
- group_obj = obj.read_group(cr, uid, domain, read_fields, groupby_field, context=context)
- for group in group_obj:
- group_begin_date = datetime.strptime(group['__domain'][0][2], DEFAULT_SERVER_DATE_FORMAT)
- month_delta = relativedelta.relativedelta(month_begin, group_begin_date)
- section_result[-month_delta.months + 2] = {'value': group.get(value_field, 0), 'tooltip': group_begin_date.strftime('%B')}
- inner_groupby = (group.get('__context', {})).get('group_by',[])
- if inner_groupby:
- groupby_picking = obj.read_group(cr, uid, group.get('__domain'), read_fields, inner_groupby, context=context)
- for groupby in groupby_picking:
- section_result[-month_delta.months + 2]['value'] = groupby.get(value_field, 0)
- return section_result
-
def _get_tristate_values(self, cr, uid, ids, field_name, arg, context=None):
picking_obj = self.pool.get('stock.picking')
res = dict.fromkeys(ids, [])
res[picking_type_id] = tristates
return res
-
-
- def _get_monthly_pickings(self, cr, uid, ids, field_name, arg, context=None):
- obj = self.pool.get('stock.picking')
- res = dict.fromkeys(ids, False)
- month_begin = date.today().replace(day=1)
- groupby_begin = (month_begin + relativedelta.relativedelta(months=-2)).strftime(DEFAULT_SERVER_DATE_FORMAT)
- groupby_end = (month_begin + relativedelta.relativedelta(months=2)).strftime(DEFAULT_SERVER_DATE_FORMAT)
- for id in ids:
- created_domain = [
- ('picking_type_id', '=', id),
- ('state', '=', 'done'),
- ('date', '>=', groupby_begin),
- ('date', '<', groupby_end),
- ]
- res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['date', 'picking_type_id'], 'picking_type_id_count', ['date', 'picking_type_id'], context=context)
- return res
-
def _get_picking_count(self, cr, uid, ids, field_names, arg, context=None):
obj = self.pool.get('stock.picking')
domains = {
'active': fields.boolean('Active'),
# Statistics for the kanban view
- 'monthly_picking': fields.function(_get_monthly_pickings,
- type='string',
- string='Done Pickings per Month'),
'last_done_picking': fields.function(_get_tristate_values,
type='string',
string='Last 10 Done Pickings'),
</div>
<div>
<a name="%(action_picking_tree)d" type="action">All Operations</a>
- <!--<a name="%(action_picking_tree_done_grouped)d" type="action" class="oe_sparkline_bar_link">
- <field name="monthly_picking" widget="sparkline_bar">Monthly Done Operations</field>
- </a>-->
</div>
</div>
<div class="oe_picking_type_gauge">