콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
4421 화면

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

베스트 답변

Hi Jean,

Did you mean this...

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

Image

아바타
취소
작성자 베스트 답변
아바타
취소