如何使用日历活动获取通知?

时间:2015-12-03 12:27:57

标签: python openerp

我有日历和继承模块,我将创建一个事件:

    from openerp.osv import fields, osv
    from openerp import api

    class calendar_event(osv.osv):

        _inherit = "calendar.event"
        _rec_name = 'number'
        STATE_SELECTION = [
            ('1', 'Corrective'),
            ('2', 'Preventive'),
            ('3', 'Predictive'),
            ]

        _columns = {
                'number' : fields.char('Calendar Inspection ID',readonly=1),
                'tags' : fields.selection(STATE_SELECTION, 'Tags',),
                'user_id': fields.many2one('res.users','res_users_rel','Assigned', track_visibility='onchange',),

                'company_id11': fields.many2one('res.company', 'Substation', required=True),
                'assetmodelid_add' : fields.many2one('agile.portfolio1','Asset Model Code',),
                'folio_num1' : fields.many2one('asset.asset','Folio Num',),

                'inspection_name' : fields.many2many('asset1.inspection','asset1_inspection_rel','super_id','asset1_inspection_id','Inspection Type'),
                #'folio_num' : fields.related('folio_num','folio_num',string='Folio Num',relation='asset.asset', type='many2one')    
                }


        _defaults = {
                    'number' : lambda self,cr,uid,context={}:self.pool.get('ir.sequence').get(cr,uid,'calendar.event'),
                    }

我有一个反馈表:

from openerp.osv import fields, osv
from openerp import api
import logging

class feedback_form(osv.Model):
    _name = 'feedback.form'
    #_rec_name = 'inspec_type'
    _columns = {
        'company_id111': fields.many2one('res.company', 'Substation', required=True),


        'frequency' : fields.char('Frequency'),
        'shutdown' : fields.char('Shut Down'),
        #'insp_msr1' : fields.many2one('results.measure','Result',),

        'insp_rslt' : fields.one2many('feedback.tree','insp_rsltts','Inspection Result',),

    }
feedback_form()

class feedback_tree(osv.Model):
    _name = 'feedback.tree'

    _columns = {
        'folionum' : fields.many2one('calendar.event','Maintenance ID',),
        'folio_number' : fields.many2one('asset.asset','Folio number',),
        'inspec_type' : fields.many2one('asset1.inspection','Inspection Type',),
        'insp_msr1' : fields.many2one('results.measure','Attributes',),
        'valuess' : fields.char('Values'),
        'insp_rsltts': fields.many2one('feedback.form','Result Id'),


    }
    def onchange_insp(self, cr, uid, ids, folionum,context=None):
        dids = []
        res = {}
        for record in self.pool.get('calendar.event').browse(cr, uid, folionum, context=context):
            dids = [x.id for x in record.inspection_name]
        dids1 = []
        for record in self.pool.get('calendar.event').browse(cr, uid, folionum, context=context):
            dids1 = [x.id for x in record.folio_num1]
        res.update({'inspec_type':[('id','in',dids)]})
        res.update({'folio_number':[('id','in',dids1)]})
        return {'domain':res}

    def onchange_measure(self, cr, uid, ids, inspec_type, context=None):
        dids = []
        for record in self.pool.get('asset1.inspection').browse(cr, uid, inspec_type, context=context):
            dids = [x.id for x in record.msr_insp]
        return {'domain':{'insp_msr1':[('id','in',dids)]}}


feedback_tree()

在这里,我将使用会议对该事件做反馈:

'folionum':fields.many2one('calendar.event','维护ID',)

我想要以下功能或任务:

当我在calendar.event创建Event时,我可以选择开始和结束日期。那天之后我应该

'folionum':fields.many2one('calendar.event','维护ID',)

仅适用于当天的选项。

之后,我希望在日历表单中使用groupby使用feedback.form来挂起任务详细信息。

0 个答案:

没有答案