Odoo Help


Add a field from model to a popup window?

on 9/24/13, 2:37 AM 2,297 views

i have a model amount.amount()

class amount_amount()

    _name = "amount.amount"

_columns = {

                'name' : fields.float("Amount");


    def action_amount()




in xml

<button string="Select Amount" type="object" class="oe_highlight" name="action_amount"/>

My requirement is: when i click the above button, i want to select the needed fields from my model. How can i achieve this?

On 9/24/13, 10:52 AM

There are three kinds of types for button: object, action & workflow. workflow is the default.

  1. "workflow" is used if you want to call workflow. In your case this is not apt one.

  2. "object" is used if you want to call a method which is written in .py file. Here you can select necessary fields within the function but its a sort of static( you wont get a view to select fields). So you need to decide which fields to be selected in your function (python code)

     def action_amount()        # Need to apply some conditions to select fields,
       if   case 1:
             return (amt1,amt2)
             return (amt1 , amt3)
  3. "action" is used if you want to call any action which is written in .xml file. Let say if you want to open a wizard from button click then you can use type="action" and design your wizard with whatever field you need to select based on your functional requirement.

         <button name="%(action_amount)d" class="oe_highlight" string="Select Amount" type="action">

    Design your view and put it in a folder namely 'wizard' within your addons folder.

if i select these fields in a popup, can i edit it?

on 9/25/13, 2:27 AM

Yes, you can ... it simply act like normal view . You may refer to "Sale order" , there you can add items through a pop up window, what ever value you entered or selected on the last pop up will save it in to the database.

on 9/25/13, 2:53 AM

Can you share the code? Or where it starts from?

on 9/25/13, 6:27 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 9/24/13, 2:37 AM
Seen: 2297 times
Last updated: 9/26/17, 12:16 AM