Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
521 Lượt xem

Hi,


I am trying to inherit action "Reserve" from model mrp.production to model mrp.workorder


I dont have access to server machine so I am trying to creat server action and contextual action button, is this possible? I am running Odoo 14 community version

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

In Odoo 14 Community Edition, you can indeed create server actions and contextual action buttons, even if you don’t have direct access to the server machine. Here’s a general approach to achieve this.
# Find the action from mrp.production

production_action = env['ir.actions.server'].search([('model_id.model', '=', 'mrp.production'), ('name', '=', 'Reserve')], limit=1)


# Check if action is found

if production_action:

    # Call the action

    production_action.with_context(active_ids=record.ids).run()

and Go to Settings > Technical > User Interface > Views.
you have to add button - button name="%(your_server_action_id)d" type="action" string="Reserve" class="btn-primary"/>

Ảnh đại diện
Huỷ bỏ