2015-02-05 2 views
1

저는 Odoo v8.0에서 beginer입니다. 모듈 "판매"에 사용자 정의 필드를 추가하고 싶습니다. 오류는 "type_customer 필드가 존재하지 않습니다"Odoo 8 : 모든 모듈에 사용자 정의 필드 추가

내 코드는 여기에 있습니다.

__init__.py :

from . import modify_type_quotation 

__openerp__.py :

{ 
     'name' : "Modify report template", 
     'description' : """Modify report template for Quotation/Sale report""", 
     'author' : "Nhu Van Tran", 
     'category' : "Tools", 
     'depends' : ['sale'], 
     'data' : ['modify_create_quotation.xml'], 
     'demo' : [], 
     'installable' : True, 
    } 

modify_type_quotation.py :

# -*- coding: utf-8 -*- 

from openerp import models, fields 

class modify_print_content(models.Model): 

    _inherit = "sale.order" 
    _description = "Modify Print Content" 

    type_customer = fields.selection([ 
       ('Commercial', 'Commercial Customer'), 
       ('Residential', 'Risidential Customer'), 
       ], string = "Type of Customer", help = "Type of Customer", default = "Commercial", required = True) 

modify_create_quotation.xml :

0,123,977

답변

1

내가 실수로 소문자로 's'를 만든 것은 fields.selection이고 실수 일 수 있다고 생각합니다.

type_customer = fields.Selection([ 
       ('Commercial', 'Commercial Customer'), 
       ('Residential', 'Risidential Customer') 
       ], string = "Type of Customer", help = "Type of Customer", default = "Commercial", required = True) 

이러한 것들을 적용하려면 odoo 서버를 다시 시작하십시오. 이 문제지만 selectionfield 선언에이 추가적으로 매개 변수를 추가 만약

<xpath expr="/form/sheet/group/group[2]/field[@name='client_order_ref']" position="after"> 
     <field name="type_customer"/> 
    </xpath> 

가 나도 몰라 :

1

는 XPath에 대한 여러분의 필드가 짧아 질 수

type_customer = fields.selection([ 
       ('Commercial', 'Commercial Customer'), 
       ('Residential', 'Risidential Customer'), 
       ], "Type of Customer", help = "Type of Customer", default = "Commercial",select=True, required = True) 

와 나는 생각 해결책은 다음과 같을 수 있습니다. 이 필드를 이미 상속받은 것이 아니라 sale.order에 추가합니다.

관련 문제