Soaad
Soaad

Reputation: 112

openerp 7 can't render view

I'm trying to extend product model like this

import logging
from openerp.osv import fields, osv
import time
import openerp.addons.decimal_precision as dp
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp.tools.translate import _
from openerp import netsvc
from datetime import datetime, date

_logger = logging.getLogger(__name__)

class product_override(osv.osv):
      _name = 'product.prdouct'
      _inherit = 'product.product'
      _columns = {
           'overheads' :fields.float('Overheads'),
            'basic_cost': fields.float('Basic Cost'),
            'min_charge' : fields.float('Min.Charge'),
            }

and its view like this

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <record id="product_view" model="ir.ui.view">
        <field name="name">product.normal.form</field>
        <field name="model">product.product</field>
        <field eval="1" name="priority"/>
        <field name="type">form</field>
        <field name="inherit_id" ref="product.product_normal_form_view"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='list_price']" position="after">
                 <field name="min_charge"/> 
            </xpath>
        </field>
    </record>

  </data>
</openerp>

but i have these errors while installing my custom module

2014-10-09 17:59:32,484 10020 ERROR OZB1 openerp.osv.orm: Can't find field 'min_charge' in the following view parts composing the view of object model 'product.product':
 * product.normal.form
 * product.normal.form

Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model

2014-10-09 17:59:32,489 10020 ERROR OZB1 openerp.addons.base.ir.ir_ui_view: Can't render view itk_sales_extra_ozb.product_view for model: product.product

Upvotes: 1

Views: 477

Answers (1)

Monica For CEO
Monica For CEO

Reputation: 509

The solution in my case:

  1. Restart the OpenERP server.
  2. Install or upgrade the module.

For some reason, without the restart, OpenERP was not allowing newly created fields to be added to a view, even though the fields in question were defined in the module that was being installed.

Upvotes: 1

Related Questions