odoo自动生成助记码并且能编辑

@api.onchange(‘driver_name’)
def _get_initial(self):
driver_name = self.driver_name
if driver_name:
driver_name = re.sub(r’\W*’, ‘’, driver_name)
values = {}
mnicode = pinyin.get_initial(driver_name).replace(’ ', ‘’).upper()
values[‘driver_mni_code’] = mnicode
self.update(values)

这样生成的就是可以编辑的了

你可能感兴趣的:(odoo自动生成助记码并且能编辑)