[FIX] stock: cant create lot for untracked product

Before this commit, you can create production lot for product who isn't
tracked. This commit add the condition in the domain.
This commit is contained in:
svs-odoo
2019-09-05 09:17:34 +00:00
parent 34db511c8d
commit 454a05a0da
+11 -3
View File
@@ -33,10 +33,18 @@ class ProductionLot(models.Model):
]
def _domain_product_id(self):
domain = "[('type', '=', 'product'), '|', ('company_id', '=', False), ('company_id', '=', company_id)]"
domain = [
"('tracking', '!=', 'none')",
"('type', '=', 'product')",
"'|'",
"('company_id', '=', False)",
"('company_id', '=', company_id)"
]
if self.env.context.get('default_product_tmpl_id'):
domain = "[('type', '=', 'product'), ('product_tmpl_id', '=', %s), '|', ('company_id', '=', False), ('company_id', '=', company_id)]" % self.env.context['default_product_tmpl_id']
return domain
domain.insert(0,
("('product_tmpl_id', '=', %s)" % self.env.context['default_product_tmpl_id'])
)
return '[' + ', '.join(domain) + ']'
def _check_create(self):
active_picking_id = self.env.context.get('active_picking_id', False)