Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Print button

By
Umashankar Subramani
on 1/21/15, 4:42 AM 884 views

Is it possible to add a customized option in print button other than report action. Such that the option should call a function, is it possible? if yes how can we do that

Thanks in advance.....

hi uma

aci aisha
on 1/21/15, 4:46 AM
0
Dairidi
On 4/17/15, 9:28 AM

You can add a undermenu in the print button.

You have to use in act_window key2="client_print_multi" for the more button. Instead of key2="client_action_multi for the more button

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 1/21/15, 5:08 AM

@Umashankar.  Short answer: yes.  There are 3 types of buttons which is indicated by it's type: worfklow (default and usually not stated), action (type='action'), and object (type='object').

  1. Object buttons can be used to call the related model's method.  The name attribute of the button is the name of the method.  A sample of this type of button in OpenERP 7 is "Set to Draft" button of account.invoice.  It calls account.invoice's action_cancel_draft method. (For most of the samples I've stated here, you can check addons/account/account_invoice_view.xml and addons/account/account_invoice.py)
  2. Workflow buttons are used to call a workflow transition.  The name attribute of the button is the signal of the workflow transition.  A sample of this is "Validate" button of account.invoice.  It sends the invoice_open signal to account.invoice's workflow.
  3. Action buttons are used to call an action.  The name attribute of the button is the action's ID (which is represented by the XML ID).  A sample of this is "Re-Open" button of account.inoice.  It calls the action_account_state_open action, which will open a window of a wizard.

Now, more on the actions, there are at least 4 types of actions, AFAIK: window (which will display a view), report (which will execute a report), clients (which calls a method in client and AFAIK cannot be used properly in buttons), and server (which will execute a method).

So, if you want to call a method from a button, you have 2 alternatives: use an object button, or use an action button that calls a server action.  Samples of server action can be found in odoo/addons/stock/wizard/stock_partial_move_view.xml, e.g. action_partial_move_server action calls a code.  The action is called by "Process Partially" button in odoo/addons/stock/stock_view.xml.

Hi Ivan, You from??

aci aisha
on 1/21/15, 5:12 AM

Hi ivan i just wanted to add option in the dropdown menu in the print button is it possible

Umashankar Subramani
on 1/21/15, 5:16 AM

@Umarshankar, no. But you can add that to the More button. The 'action_partial_move_server' sample that I gave above is also available through the More button. It is done through creation of ir.values record which you can also find in odoo/addons/stock/wizard/stock_partial_move_view.xml.

Ivan
on 1/21/15, 5:27 AM

How can we do using this Ivan i cant understand

Umashankar Subramani
on 1/21/15, 5:33 AM

I would suggest that you look at the example first. It is quite simple.

Ivan
on 1/21/15, 5:38 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 1/21/15, 4:42 AM
Seen: 884 times
Last updated: 4/17/15, 9:28 AM