Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3138 Lượt xem

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))

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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))

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 16
3440
0
thg 12 15
4496
1
thg 1 25
23363
1
thg 9 23
2784
2
thg 8 22
14400