Test sale_order with pg9_complete
parent
1cab4e69e7
commit
cc6fac83df
|
|
@ -68,6 +68,7 @@ class SaleOrder(models.Model):
|
||||||
pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False)
|
pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False)
|
||||||
pg9_call_T = fields.Char(string='PG9-Auftrag_T', compute='_pg9_call', store=False)
|
pg9_call_T = fields.Char(string='PG9-Auftrag_T', compute='_pg9_call', store=False)
|
||||||
partner_flash = fields.Text(compute='_get_partner_flash', store=False)
|
partner_flash = fields.Text(compute='_get_partner_flash', store=False)
|
||||||
|
pg9_complete = fields.Boolean(string='PG9-Komplett', compute='_compute_positions', store=False, default=False)
|
||||||
# partner_flash = fields.Char(store=False)
|
# partner_flash = fields.Char(store=False)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|
@ -115,12 +116,17 @@ class SaleOrder(models.Model):
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_positions(self):
|
def _compute_positions(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
|
pg_complete = True
|
||||||
p = 0
|
p = 0
|
||||||
pp = 0
|
pp = 0
|
||||||
for line in record.order_line:
|
for line in record.order_line:
|
||||||
p += 1
|
p += 1
|
||||||
if line.product_id.material_type_id.production_relevant:
|
if line.product_id.material_type_id.production_relevant:
|
||||||
pp += 1
|
pp += 1
|
||||||
|
if line.product_uom_qty > line.qty_delivered and line.from_designbox:
|
||||||
|
pg_complete = False
|
||||||
|
|
||||||
|
record.pg9_complete = pg_complete
|
||||||
record.positions = p
|
record.positions = p
|
||||||
record.production_positions = pp
|
record.production_positions = pp
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue