diff --git a/sale.py b/sale.py index e8dce4e..287ba4d 100644 --- a/sale.py +++ b/sale.py @@ -82,7 +82,7 @@ class Sale(metaclass=PoolMeta): "product": line.product.name if line.type != 'title' else None, "quantity": line.quantity if line.type != 'title' else None, "uom": line.unit.symbol if line.type != 'title' else None, - "unit_price": str(line.unit_price) if line.type != 'title' else None, + "unit_price": str(line.amount_w_tax) if line.type != 'title' else None, "taxes": str(round(line.taxes[0].rate * 100, 2))+'%' if line.type != 'title' and line.taxes else None } for line in record.lines] @@ -120,6 +120,17 @@ class Sale(metaclass=PoolMeta): "quantity": line.quantity if line.type != 'title' else None, "uom": line.unit.name if line.type != 'title' else None} for line in report.lines] + #data["lines"] = [{'type': line.type, + # "product": line.product.name if line.type != 'title' else None, + # "quantity": line.quantity if line.type != 'title' else None, + # "uom": line.unit.name if line.type != 'title' else None} for line in report.lines if line.impreso == False] + + + #for line in data["lines"]: + # line.impreso = True + + #record.save() + return data @@ -160,10 +171,10 @@ class Sale(metaclass=PoolMeta): def kitchen(cls, records): pool = Pool() context = Transaction().context - #shop = context['shop'] - shop = 1 + shop = context['shop'] Printer = pool.get('sale.printer') printers = Printer.search([('zone', '=', 'kitchen'), ('shop', '=', shop)]) + #raise UserError(str(printers)) if not printers: return @@ -207,7 +218,7 @@ class Line(metaclass=PoolMeta): __name__ = 'sale.line' pizza = fields.Integer("Pizza") - + #impreso = fields.Boolean("Impreso") @fields.depends('product', 'unit', 'sale', '_parent_sale.party', '_parent_sale.invoice_party', @@ -216,7 +227,7 @@ class Line(metaclass=PoolMeta): 'on_change_with_amount']) def on_change_product(self): super(Line, self).on_change_product() - if self.product.pizza: + if self.product and self.product.pizza: self.pizza = self.sale.pizza_number def get_production(self): diff --git a/view/sale_line_form.xml b/view/sale_line_form.xml index 5575453..e797f53 100644 --- a/view/sale_line_form.xml +++ b/view/sale_line_form.xml @@ -5,5 +5,8 @@