Hi,
I need help in coding.
first I have a selection type field with 3 choices in the field ('a', 'b', 'c') and 3 fields of Char type.
I need help in coding, for example, the selection field is selected by input 'a', then the 3 char type fields are automatically filled with values that have been set before, for example, the value is:
field1 = 2000
field2 = 3000
field3 = 5000
and for the selection field 'b' or 'c' is the same but with different values.
for another example, I select the selection field to 'b', the value changes immediately according to the value that has been set, as the case when I select 'a'.
My Code:
class ParkingPoint(models.Model):
_name='parking_point'
parking_zone=fields.Selection([('a','Zona Pusat'),
('b','Zona Menengah'),
('c','Zona Pinggiran'),
],string='Zona parkir', copy='False' ,default='a')
two_wheels = fields.Integer(string='Motor')
four_wheels = fields.Integer(string='Mobil Umum')
box_car = fields.Integer(string='Mobil Box')
big_car = fields.Integer(string='Bus / Truk')
@api.depends
def harga(self):
_default= {
'two_wheels' : '2000'
}
Beforehand, any answer I would appreciate. Thanks you 😃