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.

1
Demirel yakito
On 12/29/14, 12:12 AM

filename.py

from openerp import models, fields, api, _

class student_details(models.Model):
    _name="student.process"

    number1=fields.Float(string="Enter number 1: ")
    number2=fields.Float(string="Enter number 2: ")
    sum=fields.Float(string="Sum: ",compute="addition_operation")

@api.multi

@api.depends("number1","number2")
    def addition_operation(self):
        self.sum=self.number1+self.number2

-------------------

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        
        <record model="ir.ui.view" id="form_id">
            <field name="name">Student details</field>
            <field name="model">student.process</field>
            <field name="arch" type="xml">
                <form string="Student" version="7.0" >
                    <sheet>
                    <group><field name="number1"></field>
                        <field name="number2"></field>
                        <field name="sum"></field></group>        
                    </sheet>                    
                </form>
            </field>
        </record>

<record model="ir.actions.act_window" id="gopal_action">
            <field name = "name">STUDENT DETAILS</field>
            <field name = "res_model">student.process</field>
            <field name = "view_mode">tree,form</field>
        </record>
        <menuitem name="Child" id="child"  parent="parent" action="gopal_action"></menuitem>
    </data>
</openerp>

1
louie
On 1/13/15, 3:51 AM

the codes are not working. one thing what is the purpose of api? and also kindly please give me a good example.. kindly provide a simple code? thanks and advance

there is no wrong in this code. iam worked this code before u sent. once u type some number in number1 and number 2 field, tht will sum together and display result in sum field. its very simple example.

Demirel yakito
on 1/20/15, 2:18 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

1 follower(s)

Stats

Asked: 12/28/14, 9:05 PM
Seen: 801 times
Last updated: 3/28/15, 3:13 AM