fix: Se actualiza a 6.8
This commit is contained in:
parent
6c3052902d
commit
741d8f4ad3
@ -12,12 +12,14 @@ from trytond.exceptions import UserError
|
|||||||
BOM_CHANGES = ['bom', 'product', 'quantity', 'uom', 'warehouse', 'location',
|
BOM_CHANGES = ['bom', 'product', 'quantity', 'uom', 'warehouse', 'location',
|
||||||
'company', 'inputs', 'outputs']
|
'company', 'inputs', 'outputs']
|
||||||
|
|
||||||
|
|
||||||
class Production(metaclass=PoolMeta):
|
class Production(metaclass=PoolMeta):
|
||||||
"Production"
|
"Production"
|
||||||
__name__ = 'production'
|
__name__ = 'production'
|
||||||
|
|
||||||
|
@fields.depends(
|
||||||
@fields.depends(*BOM_CHANGES)
|
'bom', 'product', 'uom', 'quantity', 'company', 'inputs', 'outputs',
|
||||||
|
methods=['_explode_move_values'])
|
||||||
def explode_bom(self):
|
def explode_bom(self):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Uom = pool.get('product.uom')
|
Uom = pool.get('product.uom')
|
||||||
@ -29,32 +31,27 @@ class Production(metaclass=PoolMeta):
|
|||||||
|
|
||||||
inputs = []
|
inputs = []
|
||||||
for input_ in self.bom.inputs:
|
for input_ in self.bom.inputs:
|
||||||
if input_.product.producible:
|
# if input_.product.producible:
|
||||||
for input_ in input_.product.template.boms.inputs:
|
# for input_ in input_.product.template.boms.inputs:
|
||||||
quantity = input_.compute_quantity(factor)
|
quantity = input_.compute_quantity(factor)
|
||||||
move = self._explode_move_values(
|
move = self._explode_move_values('input', input_, quantity)
|
||||||
self.picking_location, self.location, self.company,
|
|
||||||
input_, quantity)
|
|
||||||
if move:
|
|
||||||
inputs.append(move)
|
|
||||||
quantity = Uom.compute_qty(input_.uom, quantity,
|
|
||||||
input_.product.default_uom, round=False)
|
|
||||||
else:
|
|
||||||
quantity = input_.compute_quantity(factor)
|
|
||||||
move = self._explode_move_values(
|
|
||||||
self.picking_location, self.location, self.company,
|
|
||||||
input_, quantity)
|
|
||||||
if move:
|
if move:
|
||||||
inputs.append(move)
|
inputs.append(move)
|
||||||
quantity = Uom.compute_qty(input_.uom, quantity,
|
quantity = Uom.compute_qty(input_.uom, quantity,
|
||||||
input_.product.default_uom, round=False)
|
input_.product.default_uom, round=False)
|
||||||
|
# else:
|
||||||
|
# quantity = input_.compute_quantity(factor)
|
||||||
|
# move = self._explode_move_values('output', input_, quantity)
|
||||||
|
# if move:
|
||||||
|
# inputs.append(move)
|
||||||
|
# quantity = Uom.compute_qty(input_.uom, quantity,
|
||||||
|
# input_.product.default_uom, round=False)
|
||||||
self.inputs = inputs
|
self.inputs = inputs
|
||||||
|
|
||||||
outputs = []
|
outputs = []
|
||||||
for output in self.bom.outputs:
|
for output in self.bom.outputs:
|
||||||
quantity = output.compute_quantity(factor)
|
quantity = output.compute_quantity(factor)
|
||||||
move = self._explode_move_values(
|
move = self._explode_move_values('output', output,
|
||||||
self.location, self.output_location, self.company, output,
|
|
||||||
quantity)
|
quantity)
|
||||||
if move:
|
if move:
|
||||||
move.unit_price = Decimal(0)
|
move.unit_price = Decimal(0)
|
||||||
|
8
sale.py
8
sale.py
@ -90,7 +90,7 @@ class Sale(metaclass=PoolMeta):
|
|||||||
else:
|
else:
|
||||||
untaxed_amount[sale.id] = round(sum(
|
untaxed_amount[sale.id] = round(sum(
|
||||||
(line.amount for line in sale.lines
|
(line.amount for line in sale.lines
|
||||||
if line.type == 'line'), Decimal(0)),2)
|
if line.type == 'line'), Decimal(0)), 2)
|
||||||
total_discount[sale.id] = round(sum(
|
total_discount[sale.id] = round(sum(
|
||||||
(line.discount_amount for line in sale.lines
|
(line.discount_amount for line in sale.lines
|
||||||
if line.type == 'line'), Decimal(0)), 2)
|
if line.type == 'line'), Decimal(0)), 2)
|
||||||
@ -166,11 +166,11 @@ class Sale(metaclass=PoolMeta):
|
|||||||
"quantity": line.quantity 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,
|
"uom": line.unit.symbol if line.type != 'title' else None,
|
||||||
"unit_price": str(line.amount_w_tax) 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))+'%'
|
"taxes": str(round(line.taxes[0].rate * 100, 2)) + '%'
|
||||||
if line.type != 'title' and line.taxes else None
|
if line.type != 'title' and line.taxes else None
|
||||||
} for line in record.lines]
|
} for line in record.lines]
|
||||||
|
|
||||||
data["total_discount"] = str(round(record.total_discount,2))
|
data["total_discount"] = str(round(record.total_discount, 2))
|
||||||
data["untaxed_amount"] = str(record.untaxed_amount)
|
data["untaxed_amount"] = str(record.untaxed_amount)
|
||||||
data["tax_amount"] = str(record.tax_amount)
|
data["tax_amount"] = str(record.tax_amount)
|
||||||
data["total"] = str(record.total_amount)
|
data["total"] = str(record.total_amount)
|
||||||
@ -345,7 +345,7 @@ class Line(metaclass=PoolMeta):
|
|||||||
else:
|
else:
|
||||||
self.bought_pizza = False
|
self.bought_pizza = False
|
||||||
|
|
||||||
def get_production(self, product_quantities ):
|
def get_production(self, product_quantities):
|
||||||
"Return production for the sale line"
|
"Return production for the sale line"
|
||||||
Production = super(Line, self).get_production(product_quantities)
|
Production = super(Line, self).get_production(product_quantities)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user