Server Action In Odoo || Add Action To Action Button In Odoo || Odoo Server Action

Описание к видео Server Action In Odoo || Add Action To Action Button In Odoo || Odoo Server Action

𝐕𝐢𝐝𝐞𝐨 𝐍𝐨: 115
Odoo server action. How to add action to action button in odoo. Working of server action in odoo. Add server action from code. Add server action from ui.

Server Actions (ir.actions.server)
Allow triggering complex server code from any valid action location. Only two fields are relevant to clients:

id
the in-database identifier of the server action to run

context (optional)
context data to use when running the server action

In-database records are significantly richer and can perform a number of specific or generic actions based on their state. Some fields (and corresponding behaviors) are shared between states:

model_id
Odoo model linked to the action.

state

code: Executes python code given through the code argument.

object_create: Creates a new record of model crud_model_id following fields_lines specifications.

object_write: Updates the current record(s) following fields_lines specifications

multi: Executes several actions given through the child_ids argument.

State fields
Depending on its state, the behavior is defined through different fields. The concerned state is given after each field.

code (code)
Specify a piece of Python code to execute when the action is called

Note

The code segment can define a variable called action, which will be returned to the client as the next action to execute:

will ask the client to open a form for the record if it fulfills some condition

crud_model_id (create)(required)
model in which to create a new record

link_field_id (create)
many2one to ir.model.fields, specifies the current record’s m2o field on which the newly created record should be set (models should match)

fields_lines (create/write)
fields to override when creating or copying the record. One2many with the fields:

col1
ir.model.fields to set in the concerned model (crud_model_id for creates, model_id for updates)

value
value for the field, interpreted via type

type (value|reference|equation)
If value, the value field is interpreted as a literal value (possibly converted), if equation the value field is interpreted as a Python expression and evaluated

child_ids (multi)
Specify the multiple sub-actions (ir.actions.server) to enact in state multi. If sub-actions themselves return actions, the last one will be returned to the client as the multi’s own next action

𝐎𝐝𝐨𝐨 𝟏𝟓 𝐏𝐥𝐚𝐲𝐥𝐢𝐬𝐭:    • How To Configure Odoo15 With Pycharm ...  

Sponsor Us: https://github.com/sponsors/odoomates
𝐖𝐞𝐛𝐬𝐢𝐭𝐞: https://www.odoomates.tech/
𝐈𝐧𝐬𝐭𝐠𝐫𝐚𝐦:   / odoomates  
𝐆𝐢𝐭𝐡𝐮𝐛: https://github.com/odoomates
𝐄𝐦𝐚𝐢𝐥 : [email protected]
𝐅𝐚𝐜𝐞𝐛𝐨𝐨𝐤:   / odoomate  
𝐓𝐰𝐢𝐭𝐭𝐞𝐫:   / odoomates  
𝐒𝐮𝐩𝐩𝐨𝐫𝐭 𝐔𝐬 𝐢𝐧 𝐊𝐨 𝐅𝐢 : https://ko-fi.com/odoomates

Комментарии

Информация по комментариям в разработке