odoo.py odoo 14 code example

Example 1: odoo.py odoo 14

$ git add requirements.txt
$ git add my_module
$ git commit -m "[IMP] my_module: automatically remove special chars in my_module.my_module name field"

Example 2: odoo.py odoo 14

'version': '0.3',

Example 3: odoo.py odoo 14

'version': '0.2',

Example 4: odoo.py odoo 14

from odoo import models, fields, api

Example 5: odoo.py odoo 14

@api.model
def create(self, values):
    if 'name' in values:
        values['name'] = unidecode(values['name'])
    return super(my_module, self).create(values)

def write(self, values):
    if 'name' in values:
        values['name'] = unidecode(values['name'])
    return super(my_module, self).write(values)

Example 6: odoo.py odoo 14

start_datetime = fields.Datetime('Start time', default=lambda self: fields.Datetime.now())

Example 7: odoo.py odoo 14

$ git push https HEAD:feature-1

Tags:

Misc Example