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.

2

How to declare fields.function in odoo 8 standard I got Error

By
Odoo
on 1/1/15, 11:50 PM 8,380 views

total_invoiced= fields.function(_invoice_total,string="Total Invoiced",type='float')

2

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 1/2/15, 12:06 AM

Hi Libu,

In odoo8 we use Computed fields. For more you can refer : https://www.odoo.com/documentation/8.0/howtos/backend.html#computed-fields-and-default-values

Eg:

name = fields.Char(compute='_compute_name')

    def _compute_name(self):

        for record in self:

            record.name = str(random.randint(1, 1e6))

 

Thanks............

Odoo
on 1/2/15, 4:22 AM
1

Atul Arvind

--Atul Arvind--
1854
| 3 3 5
India
--Atul Arvind--

Hello, 

I am odoo Enthusiast/Consultant from Baroda, Gujarat, India. Working with odoo from v5 to v9 and other opensource technology since 4+ years. Having Strong Expertise in

Requirement gathering & Gap Analysis

Odoo Development

Odoo Customization

Odoo Training

Odoo Integration

Server Administration

Odoo Migration

Implementation

I am also active on StackOverflow.

or 


Atul Arvind
On 1/2/15, 2:24 AM

In odoo 8 functional field is replaced by computed field.

To create a computed field, create a field and set its attribute compute to the name of a method.
The computation method should simply set the value of the field to compute on every record in self.
Here is the simple example.

    name = fields.Char(compute='_get_value', string='Name')
    value = fields.Char(string='Value')
    
    @api.one
    @api.depends('value')
    def _get_value(self):
        self.name = "Value of name is %s" % self.value

@api.depends('value') decorator specifies the dependency on the 'value' field.
and it is used by the ORM to trigger recomputation of the field.

Thanks............

Odoo
on 1/2/15, 4:21 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: 1/1/15, 11:50 PM
Seen: 8380 times
Last updated: 4/27/16, 3:54 AM