How to update/edit the Stock_partial_picking module/pluggin

Asked by John Chen on 2011-07-05

Hi,

I want to change the content of stock_partial_picking using import method (.py)
i would like to hidden or delete the "cost" and "currency" fields in the menu so that user won't be able to see the cost when receiving product in incoming shipment.

Note: Cost only appear in average price mode (when we edited the product from standard price to average price.)

My Code :
======
# -*- encoding: utf-8 -*-
from osv import osv, fields
import os

class stock_partial_picking(osv.osv):
    _name = "stock.partial.picking"

    def __create_partial_picking_memory(self, picking, pick_type):
        move_memory = {
            'product_id' : picking.product_id.id,
            'quantity' : picking.product_qty,
            'product_uom' : picking.product_uom.id,
            'prodlot_id' : picking.prodlot_id.id,
            'move_id' : picking.id,
        }

        if pick_type == 'in':
            move_memory.update({
                'cost' : picking.product_id.standard_price, <------- delete / hidden
                'currency' : picking.product_id.company_id.currency_id.id, <------- delete / hidden
            })
        return move_memory
stock_partial_picking()
=====

i use this method in other place it worked fine but using for this stock_partial_picking is not working well.

Question information

Language:
English Edit question
Status:
Solved
For:
OpenERP Web Client Edit question
Assignee:
No assignee Edit question
Solved by:
John Chen
Solved:
2011-07-06
Last query:
2011-07-06
Last reply:
2011-07-05
OpenBMS JSC (openbmsjsc) said : #1

Isn't it better to hide the field in the views (XML files) using ACL to a certain group. That's way you can restrict people to view certain field, and do not have to code.

John Chen (john-chen2011) said : #2

Thanks Mr. Phong Nguyen-Thanh

I solved the problems already by adding position="replace" and invisible="1" in cost and currency fields XML.