53.Odoo Server Action || Add New Action To Action Button In Odoo || Odoo 14 Development
Вставка
- Опубліковано 5 жов 2024
- How to add new action to action button in Odoo 14. How to create a server action in Odoo. Different type of actions in Odoo. Steps to create server action in Odoo. Steps to add new action to odoo action button. Odoo 14 development tutorials, how to add new server action in Odoo 14.
Server Action:
Server actions model. Server action work on a base model and offer various type of actions that can be executed automatically, for example using base action rules, of manually, by adding the action in the ‘More’ contextual menu.
Since Odoo 8.0 a button ‘Create Menu Action’ button is available on the action form view. It creates an entry in the More menu of the base model. This allows to create server actions and run them in mass mode easily through the interface.
The available actions are :
‘Execute Python Code’: a block of python code that will be executed
‘Create a new Record’: create a new record with new values
‘Write on a Record’: update the values of a record
‘Execute several actions’: define an action that triggers several other server actions
llow 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
Odoo 14 Playlist: • 2. How To Create Modul...
Module: apps.odoo.com/...
Website: www.odoomates....
Github: github.com/odo...
Email : odoomates@gmail.com
Facebook: / odoomate
Twitter: / odoomates
Support Us in Ko Fi : ko-fi.com/odoo...
Perfect! Exactly what I needed! Thank you!
glad it helped
Sir, how can we change the way price_subtotal is computed in a purchase order please?
Instead of unit_price * product_qty, I would like to make it unit_price * product_qty * time_period
P.S: Your videos are so helpful. Thank you so much sir! May god bless you :)
Hi, you have to override the compute function that computes the value and apply the new logic
Odoo Mates Couldn’t find it anywhere. Looks like that function depends on another one from account module
@@kassimgoulamaly9905 see the field definition: price_subtotal = fields.Monetary(compute='_compute_amount', string='Subtotal', store=True)
function name is _compute_amount
Odoo Mates yess!
Thank you so much for your answer! ❤️
@@kassimgoulamaly9905 welcome :)
Thanks, that helps me a lot 🤗🤗
happy that it helps :)
.. well done, thank you ..
welcome
Hey, i am adding a action button in purchase.order but its not showing in action button any specific reason?
see this sample: github.com/odoomates/odooapps/pull/70/files
any idea how to override "Save & New" button in odoo 14?
Thanks!!🙌👏🙏
Welcome ❤️❤️❤️
How can we update multiple values on sever action using wizard?
Is there a way to trigger wizard when clicking on the action?
You mean how to return wizard from server action?
@@OdooMates i just tried to do it by the frontend but realized I can't since I can't apply xml id to the view when creating it through the front end
actually i didnt understand the code part of create appointment . that is if record: this part
learning orm will help brother: ua-cam.com/video/8V-uOG8KkKA/v-deo.html