Skip to Content
Menu
This question has been flagged
2 Replies
797 Views

i have field Char

qr_code = fields.Char(string='QR CODE')
lot_qr = fields.Char(string='LOT', compute='calculate_qr_code_fun')


 ex : qr_code = '010628108600022910110553172108012100000000000H45'


i need too know also if i can assign the value by domain 

like if there is <10 > start till reach to< 17> for example 


lot_qr = '110553​'


i tried this : 

@api.model
def calculate_qr_code_fun
(self, qr_code):
self.lot_qr = qr_code.spilt('14', 1)[0]


Avatar
Discard
Author Best Answer

thanks

Avatar
Discard
Best Answer

Hi,

You can try the below code

qr_code[:14]

Avatar
Discard