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

Custom module value of field stays zero

By
Maarten
on 8/4/14, 1:46 PM 565 views

I made this custom module for an extra field in the delivery order. Only the value flips back to 0 once you save the form. However I checked the value in the database with pgAdmin and it is saved. When I ad the field directly to the stock module it does show the value from the database. What am I doing wrong?

__init__.py

from openerp.modules import get_module_resource, get_module_path
import delivery_order_reference

__openerp__.py

from openerp.osv import fields, osv

class delivery_order_reference(osv.osv):
  _name = "stock.picking.out"
 
  _inherit = "stock.picking.out"

  _columns = {
    'delivery_order_reference': fields.integer('Klant referentie', size=64)
  }

delivery_order_reference()

delivery_order_reference.py

{
    'name': "Delivery order reference",
    'version': "1.0",
    'author': "M2tec",
    'category': "Warehouse Management",
    'depends': ['stock'],
    'data': ['delivery_order_reference.xml'],
    'demo': [],
    'installable': True,
}

delivery_order_reference.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <record model="ir.ui.view" id="delivery_order_reference_ui">
        <field name="name">stock.picking.out.form</field>
        <field name="model">stock.picking.out</field>
        <field name="inherit_id" ref="stock.view_picking_out_form" />
        <field name="arch" type="xml">
            <xpath expr="/form/sheet/group/group[1]/field[@name='stock_journal_id']" position="after">
                <field name="delivery_order_reference" placeholder="e.g. 1234" class="oe_inline" />
            </xpath>
        </field>
    </record>
  </data>
</openerp>

0

Ben Bernard

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 8/4/14, 5:35 PM

Remove the _name line in delivery_order_reference class.

0
Maarten
On 8/6/14, 2:35 AM

Thanks it didn't work. Actually this is my mistake. I was very much inpired by this article (see link). The tutorial works as expected, also on my system in the projects module. Here the file does not have the name field, which is correct. Sorry but not yet a solution :)

http://www.pixelite.co.nz/article/adding-additional-fields-using-custom-module-openerp-7

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: 8/4/14, 1:46 PM
Seen: 565 times
Last updated: 3/16/15, 8:10 AM