Make plan not required on product lines, and creat function to return all products to create bom correctly
This commit is contained in:
parent
a187fbb7c4
commit
72928f1331
13
plan.py
13
plan.py
|
@ -404,8 +404,17 @@ class Plan(ModelSQL, ModelView):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Uom = pool.get('product.uom')
|
Uom = pool.get('product.uom')
|
||||||
|
|
||||||
|
def _get_all_inputs(lines):
|
||||||
|
lines = [x for x in lines]
|
||||||
|
for line in lines:
|
||||||
|
if not line.children:
|
||||||
|
continue
|
||||||
|
lines += _get_all_inputs(line.children)
|
||||||
|
return lines
|
||||||
|
|
||||||
inputs = {}
|
inputs = {}
|
||||||
for line in self.products:
|
lines = _get_all_inputs(self.products)
|
||||||
|
for line in lines:
|
||||||
if not line.product:
|
if not line.product:
|
||||||
continue
|
continue
|
||||||
input_ = self._get_input_line(line)
|
input_ = self._get_input_line(line)
|
||||||
|
@ -502,7 +511,7 @@ class PlanProductLine(ModelSQL, ModelView, tree(separator='/')):
|
||||||
parent = fields.Many2One('product.cost.plan.product_line', 'Parent')
|
parent = fields.Many2One('product.cost.plan.product_line', 'Parent')
|
||||||
children = fields.One2Many('product.cost.plan.product_line', 'parent',
|
children = fields.One2Many('product.cost.plan.product_line', 'parent',
|
||||||
'Children')
|
'Children')
|
||||||
plan = fields.Many2One('product.cost.plan', 'Plan', required=True,
|
plan = fields.Many2One('product.cost.plan', 'Plan', required=False,
|
||||||
ondelete='CASCADE')
|
ondelete='CASCADE')
|
||||||
product = fields.Many2One('product.product', 'Product', domain=[
|
product = fields.Many2One('product.product', 'Product', domain=[
|
||||||
('type', '!=', 'service'),
|
('type', '!=', 'service'),
|
||||||
|
|
Loading…
Reference in New Issue