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

Why is my new selection not saving?

By
AJ Schrafel Paper Corp
on 9/27/13, 7:45 PM 779 views

I want to add a new selection option above the supplier in the stock_picking_in form. It shows up and can be selected but it is not writing to the database, what am i doing wrong?

My Python:

class stock_picking_in(osv.osv):
    _inherit = "stock.picking.in"
    _table = "stock_picking"

    _columns = {
        'prod_type': fields.selection([('itemized','Itemized Product'),('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Itemized: Every unit of this product is assigned a unique item number and can have unique attributes. \nConsumable: Will not imply stock management for this product. \nStockable product: Will imply stock management for this product."),        
    }

    _defaults = {
        'prod_type': 'itemized',
    }
stock_picking_in()

My XML:

<record id="view_picking_in_form_items" model="ir.ui.view">
        <field name="name">stock.picking.in.form</field>
        <field name="model">stock.picking.in</field>
        <field name="inherit_id" ref="stock.view_picking_in_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='partner_id']" position="replace">
                    <field name="prod_type" string="Inventory Type"/>
                <field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Supplier" domain="[('supplier','=',True)]" />
            </xpath>
                <xpath expr="//field[@name='move_lines']" position="replace">
                <field name="move_lines" attrs="{'invisible': [('prod_type','=','itemized')]}" context="{'address_in_id': partner_id, 'picking_type': 'in', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}" options='{"reload_on_button": true}'/>
                    <field name="move_lines" string="Itemized" attrs="{'invisible': [('prod_type','&lt;&gt;','itemized')]}" context="{'address_in_id': partner_id, 'picking_type': 'in', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}" options='{"reload_on_button": true}'/>
            </xpath>
        </field>
    </record>

Does the new field exist in table stock_picking? Are there any error messages?

Andreas Brueckl
on 9/28/13, 7:38 AM
0

AJ Schrafel Paper Corp

--AJ Schrafel Paper Corp--
2050
| 4 5 8
Bronx, United States
--AJ Schrafel Paper Corp--

Exploring OpenERP for business

AJ Schrafel Paper Corp
On 9/30/13, 12:19 PM

The answer was I needed to create the field in both stock.picking and stock.picking.in.

class stock_picking(osv.osv):
    _inherit = "stock.picking"

    _columns = {
        'prod_type': fields.selection([('itemized','Itemized Product'),('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help=""),        
    }

stock_picking()

class stock_picking_in(osv.osv):
    _inherit = "stock.picking.in"

    _columns = {
        'prod_type': fields.selection([('itemized','Itemized Product'),('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help=""),        
    }

    _defaults = {
        'prod_type': 'itemized',
    }
stock_picking_in()
0
laribi
On 9/29/13, 7:41 AM

Hello ,

make you sure that you didn't change the write function of the stock.picking.in class . Try to use store="True" in your field definition.

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

0 follower(s)

Stats

Asked: 9/27/13, 7:45 PM
Seen: 779 times
Last updated: 3/16/15, 8:10 AM