From 01b074b94974b65e23672f9ca0d9bd1b0a6fef85 Mon Sep 17 00:00:00 2001 From: Naresh Choksy Date: Mon, 1 Sep 2008 14:05:16 +0530 Subject: [PATCH] Added Calendar view on mrp.operation bzr revid: nch@tinyerp.com-20080901083516-cdoofu030jidojpn --- addons/mrp_operations/mrp_operations.py | 15 +++++++++++++++ addons/mrp_operations/mrp_operations_view.xml | 21 +++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index d654e33..ff01528 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -133,6 +133,18 @@ mrp_operations_operation_code() class mrp_operations_operation(osv.osv): _name="mrp_operations.operation" + + def _order_date_search_production(self,cr,uid,ids): + operation_ids=self.pool.get('mrp_operations.operation').search(cr,uid,[('production_id','=',ids[0])]) + return operation_ids + + def _get_order_date(self, cr, uid, ids, field_name, arg, context): + res={} + operation_obj=self.browse(cr, uid, ids, context=context) + for operation in operation_obj: + res[operation.id]=operation.production_id.date_planned + return res + def create(self, cr, uid, vals, context=None): wf_service = netsvc.LocalService('workflow') code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])]) @@ -154,6 +166,9 @@ class mrp_operations_operation(osv.osv): 'production_id':fields.many2one('mrp.production','Production',required=True), 'workcenter_id':fields.many2one('mrp.workcenter','Workcenter',required=True), 'code_id':fields.many2one('mrp_operations.operation.code','Code',required=True), + 'date_start': fields.datetime('Start Date'), + 'date_finished': fields.datetime('End Date'), + 'order_date': fields.function(_get_order_date,method=True,string='Order Date',type='date',store={'mrp.production':(['date_planned'],_order_date_search_production)}), } mrp_operations_operation() diff --git a/addons/mrp_operations/mrp_operations_view.xml b/addons/mrp_operations/mrp_operations_view.xml index 9cd3ae9..d1aade9 100644 --- a/addons/mrp_operations/mrp_operations_view.xml +++ b/addons/mrp_operations/mrp_operations_view.xml @@ -145,6 +145,9 @@ + + + @@ -167,11 +170,25 @@ ir.actions.act_window mrp_operations.operation form + tree,calendar,form - - + + + mrp.perations.calendar + mrp_operations.operation + calendar + + + + + + + + + + -- 1.7.10.4