File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 2020
2121{
2222 "name" : "Product Internal Code" ,
23- "version" : "18 .0.1.0.0" ,
23+ "version" : "19 .0.1.0.0" ,
2424 "category" : "Tools" ,
2525 "sequence" : 14 ,
2626 "author" : "ADHOC SA" ,
3636 ],
3737 "demo" : [],
3838 "test" : [],
39- "installable" : False ,
39+ "installable" : True ,
4040 "auto_install" : False ,
4141 "application" : False ,
4242}
Original file line number Diff line number Diff line change @@ -13,11 +13,14 @@ class ProductProduct(models.Model):
1313 index = "btree_not_null" ,
1414 )
1515
16+ _internal_code_uniq = models .Constraint (
17+ "unique (internal_code)" ,
18+ "Internal Code must be unique!" ,
19+ )
20+
1621 @api .model_create_multi
1722 def create (self , vals_list ):
1823 for vals in vals_list :
19- if not vals .get ("internal_code" , False ) and not self ._context .get ("default_internal_code" , False ):
24+ if not vals .get ("internal_code" , False ) and not self .env . context .get ("default_internal_code" , False ):
2025 vals ["internal_code" ] = self .env ["ir.sequence" ].next_by_code ("product.internal.code" )
2126 return super ().create (vals_list )
22-
23- _sql_constraints = {("internal_code_uniq" , "unique(internal_code)" , "Internal Code must be unique!" )}
You can’t perform that action at this time.
0 commit comments