Skip to content
Permalink
Browse files

m

  • Loading branch information...
nim-odoo committed Apr 15, 2019
1 parent 8e272bd commit d743e054a8510fb3e216177b0218b42e8636ca16
Showing with 8 additions and 12 deletions.
  1. +8 −6 addons/sale_mrp/models/sale_mrp.py
  2. +0 −6 addons/sale_stock/models/sale_order.py
@@ -25,12 +25,14 @@ def _get_delivered_qty(self):
return super(SaleOrderLine, self)._get_delivered_qty()

@api.multi
def _compute_qty_delivered_updateable_for_kit(self):
self.ensure_one()
bom = self.env['mrp.bom']._bom_find(product=self.product_id, company_id=self.company_id.id)
pick_moves = self.move_ids.filtered(lambda m: m.picking_id)
done_pick_moves = pick_moves.filtered(lambda m: m.picking_id.state == 'done')
return bom and bom.type == 'phantom' and len(pick_moves) != len(done_pick_moves)
def _compute_qty_delivered_updateable(self):
lines = self.env['sale.order.line']
for line in self:
bom = self.env['mrp.bom']._bom_find(product=line.product_id, company_id=line.company_id.id)
if bom and bom.type == 'phantom' and line.order_id.state == 'sale':
line.qty_delivered_updateable = True
lines |= line
super(SaleOrderLine, self - lines)._compute_qty_delivered_updateable()

@api.multi
def _get_bom_component_qty(self, bom):
@@ -135,18 +135,12 @@ def _compute_product_updatable(self):
else:
line.product_updatable = False

@api.multi
def _compute_qty_delivered_updateable_for_kit(self):
return False

@api.multi
@api.depends('product_id')
def _compute_qty_delivered_updateable(self):
for line in self:
if line.product_id.type not in ('consu', 'product'):
super(SaleOrderLine, line)._compute_qty_delivered_updateable()
elif line._compute_qty_delivered_updateable_for_kit():
super(SaleOrderLine, line)._compute_qty_delivered_updateable()

@api.onchange('product_id')
def _onchange_product_id_set_customer_lead(self):

0 comments on commit d743e05

Please sign in to comment.
You can’t perform that action at this time.