m3asmi
m3asmi

Reputation: 1262

openerp form view don't display field data

I found a problem with the stock module. I want to add some fields the data are well stored in the database but they are not displayed in the view! you find files module test

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>

        <record id="view_picking_out_form_test" model="ir.ui.view">
        <field name="name">stock.picking.out.form.test</field>
        <field name="type">form</field>
        <field name="model">stock.picking.out</field>
        <field name="inherit_id" ref="stock.view_picking_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='partner_id']" position="after">
                <field name="test" placeholder="e.g. [0-9][a-zA-Z]"/>
            </xpath>
        </field>
        </record>
  </data>
</openerp>

test.py

from openerp.osv import fields, osv

class stock_picking_out(osv.osv):
    _inherit = 'stock.picking.out'
    _columns = {
        'test': fields.char('Test Field', size=8, select=True, states={'done': [('readonly', True)]}, domain=[('type', '=', 'out')]),
    }

Upvotes: 0

Views: 588

Answers (2)

Sagar Pise
Sagar Pise

Reputation: 887

In stock module view_picking_form is inherited in other form and replace pratner_id field and add domain form id view_picking_in_form

Line No. 1020

<xpath expr="//field[@name='partner_id']" position="replace">
     <field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Supplier" domain="[('supplier','=',True)]" />
</xpath>

So your field display only when partner is Supplier

You can use another field for position

<xpath expr="//field[@name='stock_journal_id']" position="before">
      <field name="test" placeholder="e.g. [0-9][a-zA-Z]"/>
</xpath>

Upvotes: 1

Daniel Reis
Daniel Reis

Reputation: 13342

Probably your custom module files are not being loaded. To confirm this is so, add some random text to your XML file, to make it invalid. If you are able to install/upgrade it without error, there's something wrong with your _openerp_py or addons path.

Upvotes: 0

Related Questions