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 can get the same data in Cost Structure with different menu's??

By
Ahnne Lee
on 5/30/14, 4:39 AM 670 views

Can someone help me regarding my problem..

Here's my codes:

Fields Function:

 def _get_cost_structure_object(self, cr, uid, ids, field_name, field_value, arg, context=None):
        j= {}
        mrp_cost_structure_id =0
        setup_labor_cost = 0.00
        running_labor_cost = 0.00
        teardown_labor_cost = 0.00
        indirect_labor_cost = 0.00
        variable_overhead_cost = 0.00
        amortization= 0.00
        
        for prod_cost_structure in self.browse(cr,uid,ids):
            if prod_cost_structure.workcenter_id:
                cs_line_ids= self.pool.get('mrp.routing.workcenter').search(cr,uid,[('workcenter_id','=', prod_cost_structure.id )])
                for cs_line in self.pool.get('mrp.routing.workcenter').browse(cr,uid,cs_line_ids):
                    mrp_cost_structure_id = cs_line.id
                    setup_labor_cost= cs_line.setup_labor_cost
                    running_labor_cost = cs_line.running_labor_cost
                    teardown_labor_cost = cs_line.teardown_labor_cost
                    indirect_labor_cost = cs_line.indirect_labor_cost
                    variable_overhead_cost = cs_line.variable_overhead_cost
                    amortization= cs_line.amortization
                    
                j[prod_cost_structure.id] = { 'setup_labor_cost' :setup_labor_cost,
                                                    'running_labor_cost' : running_labor_cost,
                                                    'teardown_labor_cost' : teardown_labor_cost,
                                                    'indirect_labor_cost' : indirect_labor_cost,
                                                    'variable_overhead_cost' : variable_overhead_cost,
                                                    'amortization': amortization}
            else:
                j[prod_cost_structure.id] = { 'setup_labor_cost' : setup_labor_cost,
                                                    'running_labor_cost' : running_labor_cost,
                                                    'teardown_labor_cost' : teardown_labor_cost,
                                                    'indirect_labor_cost' : indirect_labor_cost,
                                                    'variable_overhead_cost' : variable_overhead_cost,
                                                    'amortization': amortization}
                
        return  j

 'setup_labor_cost':fields.function(_get_cost_structure_object, type='float',method=True,store=False, multi='mrp_cost_structure_id_setup', string='Setup Labor Cost', required = False),
        'running_labor_cost':fields.function(_get_cost_structure_object, type='float',method=True,store=False, multi='mrp_cost_structure_id_running', string='Running Labor Cost', required = False),
        'teardown_labor_cost':fields.function(_get_cost_structure_object, type='float',method=True,store=False, multi='mrp_cost_structure_id_teardown', string='Teardown Labor Cost', required = False),
        'indirect_labor_cost':fields.function(_get_cost_structure_object, type='float',method=True,store=False, multi='mrp_cost_structure_id_indirect', string='Indirect Labor Cost', required = False),          
        'variable_overhead_cost':fields.function(_get_cost_structure_object, type='float',method=True,store=False, multi='mrp_cost_structure_id_variable', string='Variable Overhead Cost', required = False),
        'fixed_overhead_cost':fields.function(_get_cost_structure_object, type='float',method=True,store=False, multi='mrp_cost_structure_id_fixed', string='Fixed Overhead Cost', required = False),         
        'amortization':fields.function(_get_cost_structure_object, type='float',method=True,store=False, multi='mrp_cost_structure_id_amortization', string='Amortization', required = False),         

 

   

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: 5/30/14, 4:39 AM
Seen: 670 times
Last updated: 3/16/15, 8:10 AM