Browse Source

[FIX] pylint / flake8 errors

pull/517/head
Sylvain LE GAL 8 years ago
committed by Cyril VINH-TUNG
parent
commit
81bad98ba3
  1. 3
      pos_order_load/__openerp__.py
  2. 13
      pos_order_load/models/pos_order.py
  3. 14
      pos_order_load/static/src/js/pos_order_load.js

3
pos_order_load/__openerp__.py

@ -22,9 +22,10 @@
{
'name': 'POS Order Load and Save',
'version': '0.2',
'version': '8.0.1.0.0',
'author': 'Akretion,GRAP,Odoo Community Association (OCA)',
'category': 'Point Of Sale',
'license': 'AGPL-3',
'depends': [
'point_of_sale',
],

13
pos_order_load/models/pos_order.py

@ -68,15 +68,16 @@ class PosOrder(models.Model):
fields = ['name', 'partner_id', 'amount_total']
return self.search_read(condition, fields, limit=10)
@api.one
def load_order(self):
condition = [('order_id', '=', self.id)]
@api.model
def load_order(self, order_id):
order = self.browse(order_id)
condition = [('order_id', '=', order_id)]
fields = ['product_id', 'price_unit', 'qty', 'discount']
orderlines = self.lines.search_read(condition, fields)
return {
'id': self.id,
'name': self.pos_reference,
'partner_id': self.partner_id and self.partner_id.id or False,
'id': order.id,
'name': order.pos_reference,
'partner_id': self.partner_id.id,
'orderlines': orderlines
}

14
pos_order_load/static/src/js/pos_order_load.js

@ -95,8 +95,7 @@ openerp.pos_order_load = function(instance, local) {
this.orderlist_screen.appendTo(this.$('.screens'));
this.orderlist_screen.hide();
this.screen_selector.screen_set['orderlist'] =
this.orderlist_screen;
this.screen_selector.screen_set.orderlist = this.orderlist_screen;
// Add buttons
this.load_button = new module.LoadButtonWidget(this,{});
@ -232,10 +231,9 @@ openerp.pos_order_load = function(instance, local) {
return orderModel.call('load_order', [order_id])
.then(function (result) {
var order = self.pos.get('selectedOrder');
var result = result[0];
order = self.load_order_fields(order, result);
order.get('orderLines').reset();
var orderlines = result.orderlines || [];
var orderlines = result.orderlines || [];
var unknown_products = [];
for (var i=0, len=orderlines.length; i<len; i++) {
var orderline = orderlines[i];
@ -247,7 +245,7 @@ openerp.pos_order_load = function(instance, local) {
continue;
}
for (key in orderline) {
for (var key in orderline) {
if (!key.indexOf('product__')) {
product = self.add_product_attribute(
product, key, orderline
@ -330,7 +328,7 @@ openerp.pos_order_load = function(instance, local) {
},
on_click_draft_order: function(event){
this.current_order_id = parseInt(event.target.parentNode.dataset['orderId']);
this.current_order_id = parseInt(event.target.parentNode.dataset.orderId);
this.load_order(this.current_order_id);
},
@ -351,7 +349,7 @@ openerp.pos_order_load = function(instance, local) {
},
perform_search: function(query){
this.load_orders(query)
this.load_orders(query);
},
clear_search: function(){
@ -362,4 +360,4 @@ openerp.pos_order_load = function(instance, local) {
});
}
};
Loading…
Cancel
Save