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

How to modify Delivery Order & Incoming Shipment view ?

By
nishad
on 8/13/13, 3:40 PM 4,513 views

Hi am a new bee to OpenERP , i would like to do few additions to my current Delivery Order & Incoming Shipment modules , but am confused (stock.move, stock.picking,stock.picking.in,stock.picking.out etc...etc...) with the structure of the view and the way it is inherited in several other modules.

  1. How to add new fields in to 'Additional Info' page of Incoming Shipment and Delivery Order modules?

  2. How to enable 'product description column in both Incoming Shipment & Delivery Order modules?

I had an attempt to do this by creating a separate module that depends on module 'stock' but no changes happens to my view . Can anyone please point out the issue in my .xml ,.py etc... files , any help is appreciated .

Here is my source for reference :

stock.py

from openerp.osv import fields, osv

class stock_picking(osv.osv):

_inherit = "stock.picking"

_columns = {
            'po_number': fields.char('Customer PO#', size=25),
            'po_date': fields.date('Customer PO Date')
            }

stock_view.xml

  <?xml version="1.0" encoding="utf-8"?>
  <openerp>
  <data>
    <record model="ir.ui.view" id="view_picking_form2">
        <field name="name">stock.picking.form2</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.view_picking_form"/>
        <field name="arch" type="xml">
                <xpath expr="//group/field[@name='move_type']" position='before'>
                <field name="po_number"/>
                <field name="po_date"/>
               </xpath>
        </field>
    </record>

    <record model="ir.ui.view" id="view_move_picking_tree2">
        <field name="name">stock.picking.tree2</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.view_move_picking_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='move_line']/tree/field[@name='product_id']" position="after">
                <field name="name"/>
            </xpath>
        </field>
    </record>
</data>

</openerp>

1

Hiral Patel (hip)

--Hiral Patel (hip)--
Tiny ERP Pvt Ltd
http://www.odoo.com
913
| 2 1 5
India
--Hiral Patel (hip)--


Hiral Patel (hip)
On 8/14/13, 5:07 AM

Hello nishad,

You have to inherit 'stock.picking.in' & 'stock.picking.out', As you want to display the fields in Incoming Shipment and Delivery Order.

  • 'stock.picking.in' used to display Incoming Shipment
  • 'stock.picking.out' used to display Delivery Order

Write following code in .py file:

 class stock_picking_in(osv.osv):

    _inherit = "stock.picking.in"
    _columns = {
        'po_number': fields.char('Customer PO#', size=25),
        'po_date': fields.date('Customer PO Date')
    }

class stock_picking_out(osv.osv):

    _inherit = "stock.picking.out"
    _columns = {
        'po_number': fields.char('Customer PO#', size=25),
        'po_date': fields.date('Customer PO Date')
    }

And in .xml file write:

    <record model="ir.ui.view" id="view_picking_form21">
            <field name="name">stock.picking.form21</field>
            <field name="model">stock.picking.in</field>
            <field name="inherit_id" ref="stock.view_picking_form"/>
            <field name="arch" type="xml">
                <field name="move_type" position='before'>
                    <field name="po_number"/>
                    <field name="po_date"/>
                </field>
            </field>
        </record>

        <record model="ir.ui.view" id="view_picking_form22">
            <field name="name">stock.picking.form22</field>
            <field name="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_form"/>
            <field name="arch" type="xml">
                <field name="move_type" position='before'>
                    <field name="po_number"/>
                    <field name="po_date"/>
                </field>
            </field>
        </record>

        <record id="view_stock_move_1" model="ir.ui.view">
            <field name="name">stock.move.tree.inherit5</field>
            <field name="model">stock.move</field>
            <field name="inherit_id" ref="stock.view_move_picking_tree"/>
            <field name="arch" type="xml">
                <field name="product_id" position="after">
                    <field name="name"/>
                </field>
            </field>
        </record>

Here to display the description of product we have to inherit the tree view of 'stock.move'.

Thank You.

Hello Sir, I've products with different attributes and when I place a purchase order for a product i need the product attributes to be displayed on the incoming shipments form. Please suggest me how can i do this

Sampath Kumar S
on 1/9/14, 4:31 AM

Hello Sampath, You can find a _prepare_order_picking() method in purchase.py, This function will be called when you confirm the purchase order. Here pass the value for your new field. Define this custom field in stock.picking object.

Hiral Patel (hip)
on 2/6/14, 1:37 AM
0
nishad
On 8/14/13, 5:56 AM

Thanks hiral for your effort to figure out exact way of inheriting the view , but a small change to the source . Instead of inheriting

field name="inherit_id" ref="stock.view_picking_form we need to inherit

field name="inherit_id"ref="stock.view_picking_in_form" for Incoming shipment &

field name="inherit_id" ref="stock.view_picking_out_form" for Delivery Order .

Thanks .....

We can use 'stock.view_picking_in_form' & 'stock.view_picking_out_form' as both inherit's the view 'view_picking_form'. Thanks for correction. :)

Hiral Patel (hip)
on 8/14/13, 7:00 AM

Hi Hiral , its works fine for adding columns , fields etc.... but it shown an attribute error while am using that field in report =>File "/home/nishad/Downloads/openerp-7.0-20130630-231044/openerp/osv/orm.py", line 487, in __getattr__ raise AttributeError(e) AttributeError: 'po_date'

nishad
on 8/14/13, 8:05 AM

Hi Nishad, did you got a solution for report print even i'm facing the same problem. If you have got a solution can you please help me out in getting the solution

Sam path
on 4/26/14, 1:29 PM

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: 8/13/13, 3:40 PM
Seen: 4513 times
Last updated: 3/16/15, 8:10 AM