avanzosc team mailing list archive
-
avanzosc team
-
Mailing list archive
-
Message #00136
[Bug 829619] Re: total hour and total cycle is null in the MO view
** Also affects: avanzosc/manufacturing
Importance: Undecided
Status: New
** Changed in: avanzosc/manufacturing
Status: New => Confirmed
** Changed in: avanzosc/manufacturing
Assignee: (unassigned) => Urtzi Odriozola (urtzi-odriozola)
--
You received this bug notification because you are a member of Avanzosc
Developers, which is subscribed to Avanzosc developments.
https://bugs.launchpad.net/bugs/829619
Title:
total hour and total cycle is null in the MO view
Status in Avanzosc OpenERP modules:
Confirmed
Status in Avanzosc developments manufacturing series:
Confirmed
Bug description:
All description in the summary
Proposal solution, modify mrp_production.py in mrp_master_ext module
class mrp_production(osv.osv):
_inherit = "mrp.production"
###################### start modification i###################################
def _production_calc(self, cr, uid, ids, prop, unknow_none, context=None):
""" Calculates total hours and total no. of cycles for a production order.
@param prop: Name of field.
@param unknow_none:
@return: Dictionary of values.
"""
result = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = {
'hour_total': 0.0,
'cycle_total': 0.0,
}
for wc in prod.production_operation_ids:
result[prod.id]['hour_total'] += wc.hour
result[prod.id]['cycle_total'] += wc.cycle
print result
return result
######################################end modification #################################
_columns = {
'bom_id': fields.many2one('mrp.bom', 'Bill of Material', readonly=True, states={'draft': [('readonly', False)]}, domain=[('bom_id','=',False)]),
'routing_id': fields.many2one('mrp.routing', 'Routing', on_delete='set null', readonly=True, help="The list of operations (list of work centers) to produce the finished product. The routing is mainly used to compute work center costs during operations and to plan future loads on work centers based on production plannification."),
'production_operation_ids': fields.one2many('mrp.production.operation', 'production_id', 'Production Operations', readonly=True, states={'draft': [('readonly', False)]}),
'product_lines': fields.one2many('mrp.production.product.line', 'production_id', 'Scheduled goods', readonly=True, states={'draft': [('readonly', False)]}),
'production_final_product_ids': fields.one2many('mrp.production.final.product', 'production_id', 'Production Final Products', readonly=True, states={'draft': [('readonly', False)]}),
'user_ops': fields.one2many('mrp.production.users', 'prod', 'Users asignments', readonly=True, states={'draft': [('readonly', False)]}),
'product_def_loc': fields.many2one('stock.location', 'Default Location', required=True, readonly=True, states={'draft': [('readonly', False)]}, help='Default real location of the product'),
'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', required=False,),
'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', required=False,),
'fixed_costs':fields.one2many('mrp.fixed.cost','production_id','Fixed costs'),
###################### start modification i###################################
'hour_total': fields.function(_production_calc, method=True, type='float', string='Total Hours', multi='workorder',store=True),#bug temps
'cycle_total': fields.function(_production_calc, method=True, type='float', string='Total Cycles', multi='workorder', store=True),#bug temps
}
###################### end modification i###################################
To manage notifications about this bug go to:
https://bugs.launchpad.net/avanzosc/+bug/829619/+subscriptions
References