Ensure rec_name is a char, text type

Model.default_get with 'default_rec_name' context relies on the fact that
rec_name is a string base field.

issue6630
review36501002
This commit is contained in:
Cédric Krier committed 2017-07-26 23:43:23 +02:00
1 parent af7a103b80
commit fd1aa84921
1 file changed
+7 -1
+7 -1
View File
@@ -52,7 +52,6 @@ class BOM(ModelSQL, ModelView):
class BOMInput(ModelSQL, ModelView):
"Bill of Material Input"
__name__ = 'production.bom.input'
_rec_name = 'product'
bom = fields.Many2One('production.bom', 'BOM', required=True,
select=1, ondelete='CASCADE')
@@ -111,6 +110,13 @@ class BOMInput(ModelSQL, ModelView):
return self.uom.digits
return 2
def get_rec_name(self, name):
return self.product.rec_name
@classmethod
def search_rec_name(cls, name, clause):
return [('product',) + tuple(clause[1:])]
@classmethod
def validate(cls, boms):
super(BOMInput, cls).validate(boms)