Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
485 Tampilan

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

Avatar
Buang
Jawaban Terbai

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"/>

Avatar
Buang