Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

field value doesn't shows in the view

By
Qamar Soft
on 3/28/14, 9:18 AM 4,690 views

hello I found a problem with the stock module I want to add some fields the data are stored in the database but not displayed in the view!!!


__init__.py

import test

openerp.py

{
    "name" : "Test",
    "version" : "1.0",
    "category" : "",
    'complexity' : "normal",
    "author" : "xxxxxx",
    "website" : "www.you.com",
    "depends" : ["stock"],
    "summary" : "Test",
     "description" : """ Test """,
    "data" : ['test_view.xml'],
    "application": False,
    "installable": True
}

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')]),
}

test_view.xml

<?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="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_out_form" />
            <field name="arch" type="xml">
            <field name="partner_id" position="after">
              <field name="test" placeholder="e.g. [0-9][a-zA-Z]" />
            </field>
            </field>
        </record>
    </data>
</openerp>

Finally I now to fix this. This is OpenERP bug (ref: lp996816). You must add the new field in two model by inheriting stock.picking & stock.picking.out. See in sale_stock module > stock.py (on last line) there is FIXME comment. Add that new field in new inherit stock.view_picking_out_form with model stock.picking.out. Thx all...

Andre Leander
on 9/2/14, 12:25 AM
0
Andre Leander
On 9/1/14, 4:57 AM

I have same problem. My friend try deleting all .pyc file from folder addons and it success to display field value (before did not show). But I tried again in my module, it didn't work. I think there is a problem in .py file or osv file.

0
Narayanamurthy
On 9/1/14, 5:42 AM

 

need to create the field in both "stock_picking_out" and "stock_picking"

 

Hi rachid,

You Can try this.....

<?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="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_form"/>
            <field name="arch" type="xml">

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

                      <field name="test" placeholder="e.g. [0-9][a-zA-Z]"/>

              </xpath>

           </field>

</record>

</data>

</openerp>

I' ve tried your code. But still do not display the value. If I save, the value insert into database but do not show in view (I can see label but not the value). In my tree view, it also do not show up.

Andre Leander
on 9/1/14, 11:17 PM

Problem is you Have created field only in "stock.picking.out" u cannot save data in that, so need to create field in "stock.picking" also.... try this and it defnetly works

Narayanamurthy
on 9/2/14, 12:29 AM
0
Alcaline
On 10/14/14, 9:47 PM

put also your 'test': fields.char('Test Field', size=8, select=True, states={'done': [('readonly', True)]}, domain=[('type', '=', 'out')]), in stcok.picking inherited class.

0
Andre Leander
On 9/1/14, 4:57 AM

I have same problem. My friend try deleting all .pyc file from folder addons and it success to display field value (before did not show). But I tried again in my module, it didn't work. I think there is a problem in .py file or osv file.

0
le_dilem
On 3/28/14, 1:42 PM

I tested the code. like this

do not forget in your file __ openerp__.py add the 'depends' : ['stock'],

 from openerp.osv import fields, osv

    class stock_picking_out(osv.Model):
        _inherit = 'stock.picking.out'

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

    <?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">
                <field name="partner_id" position="after">
                    <field name="test" placeholder="e.g. [0-9][a-zA-Z]"/>
                </field>
            </field>
            </record>
      </data>
    </openerp>

same result, the field doesn't display the value :s

Qamar Soft
on 3/28/14, 2:07 PM

I think that ( view name: stock.picking.out.form) stock.view_picking_out_form (external ID) inherit from (view name name: stock.picking.form) stock.view_picking_form (external ID).

Med Said BARA
on 3/28/14, 2:35 PM

they're no deference. I want just the values to be displayed

Qamar Soft
on 3/28/14, 3:25 PM
0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 3/29/14, 7:05 AM

Hi,

Refer sale_stock module - stock.py line 147 - 152 - stock_view.xml line no 52 -61

Thanks

I didn't understand what do you mean ?

Qamar Soft
on 3/29/14, 7:23 AM

check module name sale_stock(see file stock.py line no 147 to 152 and in stock_view.xml line no 52 to 61) from addons. there is field added in stock.picking object

Jagdish Panchal
on 3/29/14, 7:29 AM

same as the code I used no deference, the view doesn't display the data

Qamar Soft
on 3/29/14, 8:57 AM
0

Med Said BARA

--Med Said BARA--
2664
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 3/28/14, 12:20 PM

Hi;

I think you should add field name="priority" eval="12" to your form according to this.

Maybe, you will have to change the eval value from 12 to another value.

Go under Settings ---> Technical ----> User Interface , open Views and filter by Stock, to see all views related to stock. There you can see the priority of the views.

Another question: did you checked if the field ' test' is created in the table stock_picking

Last, i think your class should inherit from stock.picking and not stock.picking.out

stock.view_picking_form

Try as follow to see if it works:

Don't use the xpath:

      field name="partner_id" position="after"

      field name="test" placeholder="e.g. [0-9][a-zA-Z]"

In your view you are using the object (Model) stock.picking.out, so i think you must inherit from stock.view_picking_out_form:

    <field name="inherit_id" ref="stock.view_picking_out_form"/>

Try with and without xpath.

Also, if you are using V7.0, Remove

       <field name="type">form</field>

from your form view.

I've tested on my side and it's working (without xpath).

put this in your __init__.py file: import test (in my case i've named the py file as test.py), and in your __openerp__.py file put

"data" : ['test_view.xml'], Of course! don't forget "depends" : ["stock"], as stated by le_dilem

test-rachid

Give it a try, and keep us informed.

Good luck.

Here after the files i used:

__init__.py

import test

__openerp__.py

{
"name" : "Test", "version" : "1.0", "category" : "", 'complexity' : "normal", "author" : "xxxxxx", "website" : "www.you.com", "depends" : ["stock"], "summary" : "Test", "description" : """ Test """,

"data" : ['test_view.xml'],
"application": False,
"installable": True

}

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')]),
}

test_view.xml

     <?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="model">stock.picking.out</field>
                            <field name="inherit_id" ref="stock.view_picking_out_form" />
                            <field name="arch" type="xml">
                               <field name="partner_id" position="after">
                                 <field name="test" placeholder="e.g. [0-9][a-zA-Z]" />
                               </field>
                            </field>
                        </record>
                    </data>
              </openerp>

no change, same problem , I tryed eval="10" and eval="15" too with no changes :(

Qamar Soft
on 3/28/14, 12:33 PM

What's the content of your openerp-server.log. Do you get any error message during the install process of the module? Did you restarted the server ?

Med Said BARA
on 3/28/14, 12:37 PM

yes I restarted the server with test modul as update there's no errors in log

Qamar Soft
on 3/28/14, 12:40 PM

the priority of pickin_out is 16 I tryed 15 & 17 with no result the values is stored in the database but not displayd

Qamar Soft
on 3/28/14, 2:17 PM

Is it stored in the stock_picking table?

Med Said BARA
on 3/28/14, 2:53 PM

yes, when I save the view the data is stored in the table stock_picking

Qamar Soft
on 3/28/14, 3:08 PM

I test that before & it doesnt work :'(

Qamar Soft
on 3/28/14, 3:50 PM

I copied all your code, & the problem doesn't resolved :s

Qamar Soft
on 3/29/14, 6:57 AM

med said did the value apear in the field ?

Qamar Soft
on 3/31/14, 8:39 AM

Yes, the value appears in the field. Rachid, if you still encounter a problem there is probably some details in your openerp-server.log or in your postgres.log !

Med Said BARA
on 4/1/14, 4:44 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/28/14, 9:18 AM
Seen: 4690 times
Last updated: 3/16/15, 8:10 AM