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

How do you name a new field in a model? Is there any field name update issue in Odoo v8?

By
E.M.
on 7/22/15, 3:52 PM 273 views

I am adding a new field in a model, while it works fine, I think its name is not being updated. In this case I got '%' as field name, which if I recall correctly it i the first name I gave it. Then I have changed the name t 'Margen de Ventas (%)' as you can see in the code. I have uninstalled and reinstalled the module but it seems stuck with %.

Is this the right way to name new fields? Thanks


# -*- coding: utf-8 -*-
from openerp import models, fields, api
class SaleMarginLines(models.Model):
        _inherit = 'sale.order.line',
        x_sale_margin = fields.Float('Margen de Ventas (%)', (4, 2))

0

Drees Far

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 7/22/15, 5:56 PM

In Odoo 8, you dont need to give a name to your field. It will automatically be named X Sale Margin if you want to add an other name you can add it through string = 'Margen de Ventas (%) ' and digits (4,2).

->

from openerp import models, fields, api

class SaleMarginLines(models.Model):

_inherit = 'sale.order.line',

x_sale_margin = fields.Float(string ='Margen de Ventas (%)', digits(4, 2))

I have changed: x_sale_margin = fields.Float('Margen de Ventas (%)', (4, 2)) by x_sale_margin = fields.Float(string ='Margen de Ventas (%)', digits(4, 2)) But the "field_description" for this new field is still not changed. I have restarted the server and updated the module.

E.M.
on 7/22/15, 6:50 PM

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: 7/22/15, 3:52 PM
Seen: 273 times
Last updated: 7/22/15, 5:56 PM