Commit 2f8094f 1 parent ecd57ac commit 2f8094f Copy full SHA for 2f8094f
File tree 1 file changed +11
-8
lines changed
hr_timesheet_name_customer/models
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 6
6
class NameCustomer (models .Model ):
7
7
_inherit = "account.analytic.line"
8
8
9
- name_customer = fields .Char (string = "Customer Description" )
10
- """override create method, initialize name_customer"""
9
+ name_customer = fields .Char (
10
+ string = "Customer Description" ,
11
+ compute = "_compute_name_customer" ,
12
+ store = True ,
13
+ readonly = False ,
14
+ )
11
15
12
- @api .model_create_multi
13
- def create (self , vals_list ):
14
- for vals in vals_list :
15
- if not vals .get ("name_customer" ):
16
- vals ["name_customer" ] = vals ["name" ]
17
- return super (NameCustomer , self ).create (vals_list )
16
+ @api .depends ("name" )
17
+ def _compute_name_customer (self ):
18
+ for rec in self :
19
+ if not rec .name_customer and rec .name :
20
+ rec .name_customer = rec .name
You can’t perform that action at this time.
0 commit comments