fix: se corrige error en on_change_product linea 230
This commit is contained in:
parent
a244f18bf9
commit
a4a4481312
21
sale.py
21
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):
|
||||
|
@ -5,5 +5,8 @@
|
||||
<xpath expr="//field[@name='product']" position="after">
|
||||
<label name="pizza"/>
|
||||
<field name="pizza"/>
|
||||
<!--
|
||||
<label name="impreso"/>
|
||||
<field name="impreso"/>-->
|
||||
</xpath>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user