Search code examples
pythonxmlodoo

Odoo: Server action returns null value in column "activity_user_type" violates not-null constraint


I am creating a simple server action which just prints a simple test, but when i run the code i get the below error

odoo.tools.convert.ParseError: "null value in column "activity_user_type" violates not-null constraint
DETAIL:  Failing row contains (617, Confirm, ir.actions.server, null, 552, action, 1, 2020-10-24 02:50:49.149867, 1, 2020-10-24 02:50:49.149867, ir_actions_server, code, 5, 552, null, action = model.print_test(), null, null, null, null, null, null, null, null, null, null, null).
" while parsing /home/odoo/odoo12/project1/bearings_module/views/shortfall.xml:52, near

code

<record id="model_custom_shortfall_action_confirm" model="ir.actions.server">
        <field name="name">Confirm</field>
        <field name="type">ir.actions.server</field>
        <field name="model_id" ref="bearings_module.model_custom_shortfall"/>
        <field name="binding_model_id" ref="bearings_module.model_custom_shortfall"/>
        <field name="state">code</field>
        <field name="code">action = model.print_test()</field>
</record>

def print_test(self):
        print("Test")

Solution

  • Add 'mail' module as depends

    Source: https://github.com/ruter/Odoo-Tutorial-Demo/issues/2#issuecomment-525574410