Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to add value in text box using click of button in odoo-9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.30k
    Comment on it

    In odoo-9 first we have to create the three fields in .py file and then add two fields and store it in third fields to click the button to help the get_total function. Then pass get_total function in button.

    Use this point show in below:

    1- In .py file use this code show in below

     class Feedback(models.Model):
        _name = "feedback"   
        name1 = fields.Integer(string="Subject")
        name2 = fields.Integer(string="Description")
        total = fields.Integer(string="total")
        def get_total(self):
   = self.name1 + self.name2


    2- In .xml file use this below code

    <?xml version="1.0"?>
    <record id="view_nursery_form77" model="ir.ui.view">
                <field name="name"></field>
                <field name="model">feedback</field>
                <field name="arch" type="xml">
                    <form string="Feedback">
                            <field name="name1" />
                            <field name="name2" />
                            <field name="total" />
                            <button type="object" name="get_total"   string="Calculate Total"/>
    <record id="action_nursery33" model="ir.actions.act_window">
                <field name="name">Feedback</field>
                <field name="type">ir.actions.act_window</field>
                <field name="res_model">feedback</field>
                <field name="view_mode">tree,form</field>
        <menuitem name="nursery" id="menu_student"/>
        <menuitem name="nursery" id="menu_nursery_item" parent="menu_student" action="action_nursery"/>
       <menuitem name="nursery create" id="menu_nursery_item" parent="menu_student" action="action_nursery33"/>



 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: