コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
6214 ビュー

Hello,.

I'm trying to create a new module based on "res_partner" adding a new field "is a supplier" ( boolean).
here's my code (both model and view) :

models.py : 

from odoo import models, fields, api


class ResPatnerAmeliore(models.Model):

_inherit = 'res.partner'

_name = 'res_partner_amelioration'


announcer = fields.Boolean(string='Est un annoceur :')

View code : .

<odoo>

  <data>

    <record id="view_partner_inherit" model="ir.ui.view">

        <field name="name">ameliored.view.partner</field>

        <field name="model">res_partner_amelioration</field>

        <field name="inherit_id" ref="base.view_partner_form"/>

        <field name="arch" type="xml">

            <xpath expr="//field[@name='supplier']" position="after">

                <field name="announcer"/> 

            </xpath>

        </field>

    </record>

  </data>

</odoo>


get an error : " field `announcer` doesn't exist ".

Thanks!!

アバター
破棄
最善の回答

Hi Bouzegzeg,

You just restart your odoo service ones more. then I think the issue will solve automatically. if it's not, then use

ps aux|grep odoo 

Kill all the running odoo services. then start your odoo service ones more.

sudo kill -9 <task number> 

sudo service odoo-server start 

Before starting this, please check the init.py file, import this new file.

Thanks

Nikhilkrishnan

アバター
破棄
最善の回答
Hi Bouzegzeg,

There is another way,  
01) Remove the field contents from the python file and also from the XML view file. 
02) Go to the app that you need to install/upgrade.
03)Then add the field contents and restart the Odoo server.
04) Do not refresh the browser Just click the Update button.

Thank You!

アバター
破棄