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

Challenge: Show quantity on hand for specific store in BOM tree view

By
Jean-Claude Malengret
on 2/24/15, 5:12 PM 1,342 views

I need to get the quantity for each product for a specific location in the BOM structure tree view. My location name is "Raw Materials". 

 

class mrp_bom(osv.osv):
    _inherit = "mrp.bom"
             

    def _get_raw_qty(self, cr, uid, ids, field_name, args, context=None):
        
        res = {}

        for record in self.browse(cr, uid, ids,context=context):
        

            qty=<<<<<need quantity for product at specific location>>>>>>
            res[record.id] = qty
        return res
        
    _columns = {
        'qty_available': fields.related('product_id', 'qty_available', type="float", relation="product.product", string="Qty FG"),
        'cost_price': fields.related('product_id', 'cost_price', type="float", relation="product.product", string="Cost"),
        'standard_price': fields.related('product_id', 'standard_price', type="float", relation="product", string="Std Price"),
        'qty_raw': fields.char('Qty Raw', select=True, help='HELP text when hovering over the label in openERP'),
        'qty_raw': fields.function( _get_raw_qty, method=True, type='float', string='Raw Qty', store=False)}

            


        
mrp_bom()

I see the quantity on hand field you have there. By default it points to the stock location quantity. I need it to point to my raw materials location. I therefore cannot use a relative field but need a function field that can access the stock at location "Raw Materials" (ID:13). I just need the last step in retrieving the qty_on_hand in "Raw Materials" per product in the record list of the TREE VIEW for the BOM. Thanks in advance

Jean-Claude Malengret
on 2/25/15, 3:29 AM
0

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 2/25/15, 12:06 AM

Hi Jean,

Did you mean this...

Can you please confirm this.. ?? So that i can give guidance...

Image

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: 2/24/15, 5:12 PM
Seen: 1342 times
Last updated: 3/16/15, 8:10 AM