@@ -45,9 +45,8 @@ class CategoryCompany(ModelSQL, CompanyValueMixin):
45
45
lot_sequence = fields .Many2One (
46
46
'ir.sequence' , 'Lot Sequence' ,
47
47
domain = [
48
- ('sequence_type' , '=' , Id ('stock_lot' ,
49
- 'sequence_type_stock_lot' )),
50
- ('company' , 'in' , [Eval ('company' , - 1 ), None ]),
48
+ ('sequence_type' , '=' , Id ('stock_lot' , 'sequence_type_stock_lot' )),
49
+ ('company' , '=' , None ),
51
50
])
52
51
53
52
@classmethod
@@ -56,72 +55,15 @@ def __register__(cls, module_name):
56
55
57
56
if exist :
58
57
backend .TableHandler .table_rename ('product_category_company' , cls ._table )
59
- super (CategoryCompany , cls ).__register__ (module_name )
58
+ super ().__register__ (module_name )
60
59
61
60
62
61
class Category (CompanyMultiValueMixin , metaclass = PoolMeta ):
63
62
__name__ = 'product.category'
64
63
lot_sequence = fields .MultiValue (fields .Many2One ('ir.sequence' ,
65
- 'Lot Sequence' , domain = [
66
- ('sequence_type' , '=' , Id ('stock_lot' ,
67
- 'sequence_type_stock_lot' )),
68
- ('company' , 'in' ,
69
- [Eval ('context' , {}).get ('company' , - 1 ), None ]),
70
- ],
71
- states = {
72
- 'invisible' : ~ Eval ('context' , {}).get ('company' ),
73
- }))
74
-
64
+ 'Lot Sequence' , domain = [
65
+ ('sequence_type' , '=' , Id ('stock_lot' , 'sequence_type_stock_lot' )),
66
+ ('company' , '=' , None ),
67
+ ]))
75
68
lot_sequences = fields .One2Many ('product.category.lot_sequence' ,
76
69
'category' , 'Lot Sequences' )
77
-
78
-
79
- class TemplateCompany (ModelSQL , CompanyValueMixin ):
80
- 'Template per Company'
81
- __name__ = 'product.template.lot_sequence'
82
- template = fields .Many2One ('product.template' , 'Template' , required = True ,
83
- ondelete = 'CASCADE' , context = {
84
- 'company' : Eval ('company' , - 1 ),
85
- },
86
- depends = ['company' ])
87
- lot_sequence = fields .Many2One (
88
- 'ir.sequence' , 'Lot Sequence' ,
89
- domain = [
90
- ('sequence_type' , '=' , Id ('stock_lot' ,
91
- 'sequence_type_stock_lot' )),
92
- ('company' , 'in' , [Eval ('company' , - 1 ), None ]),
93
- ])
94
-
95
- @classmethod
96
- def __register__ (cls , module_name ):
97
- exist = backend .TableHandler .table_exist ('product_template_company' )
98
-
99
- if exist :
100
- backend .TableHandler .table_rename ('product_template_company' ,
101
- cls ._table )
102
- super (TemplateCompany , cls ).__register__ (module_name )
103
-
104
-
105
- class Template (metaclass = PoolMeta ):
106
- __name__ = 'product.template'
107
- lot_sequences = fields .One2Many ('product.template.lot_sequence' ,
108
- 'template' , 'Lot Sequences' )
109
-
110
- @classmethod
111
- def __setup__ (cls ):
112
- super (Template , cls ).__setup__ ()
113
- # replace m2o field from stock_lot to MultiValue
114
- cls .lot_sequence = fields .MultiValue (fields .Many2One ('ir.sequence' ,
115
- 'Lot Sequence' , domain = [
116
- ('sequence_type' , '=' , Id ('stock_lot' ,
117
- 'sequence_type_stock_lot' )),
118
- ('company' , 'in' ,
119
- [Eval ('context' , {}).get ('company' , - 1 ), None ]),
120
- ],
121
- states = {
122
- 'invisible' : ~ Eval ('context' , {}).get ('company' ),
123
- }))
124
-
125
-
126
- class Product (metaclass = PoolMeta ):
127
- __name__ = 'product.product'
0 commit comments