Odoo Help

1

1
2 Answers
1
Avatar

Hiral Patel (hip)

--Hiral Patel (hip)--
973
| 2 1 7
India
--Hiral Patel (hip)--


Hiral Patel (hip)
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.

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

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

Hiral Patel (hip)
2/6/14, 1:37 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.

0
nishad
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 .....

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

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. :)

nishad
8/14/13, 8:05 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'

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

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

Ask a Question
Writer
Keep Informed
0 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now