当前位置: 首页>>代码示例>>Python>>正文


Python tools.DEFAULT_SERVER_DATETIME_FORMAT属性代码示例

本文整理汇总了Python中openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT属性的典型用法代码示例。如果您正苦于以下问题:Python tools.DEFAULT_SERVER_DATETIME_FORMAT属性的具体用法?Python tools.DEFAULT_SERVER_DATETIME_FORMAT怎么用?Python tools.DEFAULT_SERVER_DATETIME_FORMAT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在openerp.tools的用法示例。


在下文中一共展示了tools.DEFAULT_SERVER_DATETIME_FORMAT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _compute_name

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def _compute_name(self):
        comp_name = '/'
        for hc_res_clinical_impression in self:
            if hc_res_clinical_impression.subject_type == 'patient':
                comp_name = hc_res_clinical_impression.subject_patient_id.name
                if hc_res_clinical_impression.subject_patient_id.birth_date:
                    subject_patient_birth_date = datetime.strftime(datetime.strptime(hc_res_clinical_impression.subject_patient_id.birth_date, DF), "%Y-%m-%d")
                    comp_name = comp_name + "("+ subject_patient_birth_date + "),"
            if hc_res_clinical_impression.subject_type == 'group':
                comp_name = hc_res_clinical_impression.subject_group_id.name + ","
            if hc_res_clinical_impression.code_id:
                comp_name = comp_name + " " + hc_res_clinical_impression.code_id.name + "," or ''
            if hc_res_clinical_impression.date:
                patient_date = datetime.strftime(datetime.strptime(hc_res_clinical_impression.date, DTF), "%Y-%m-%d")
                comp_name = comp_name + " " + patient_date
            hc_res_clinical_impression.name = comp_name 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:18,代码来源:hc_res_clinical_impression.py

示例2: _compute_name

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def _compute_name(self):            
        comp_name = '/'     
        for hc_res_encounter in self:
            if hc_res_encounter.subject_type == 'patient':
                comp_name = hc_res_encounter.subject_patient_id.name
                if hc_res_encounter.subject_patient_id.birth_date:
                    subject_patient_birth_date = datetime.strftime(datetime.strptime(hc_res_encounter.subject_patient_id.birth_date, DF), "%Y-%m-%d")
                    comp_name = comp_name + "("+ subject_patient_birth_date + ")"
            if hc_res_encounter.subject_type == 'group':
                    comp_name = hc_res_encounter.subject_group_id.name
            # if hc_res_encounter.type_id:   
            #     comp_name = comp_name + ", " + hc_res_encounter.type_id.name or ''
            if hc_res_encounter.start_date:
                subject_start_date =  datetime.strftime(datetime.strptime(hc_res_encounter.start_date, DTF), "%Y-%m-%d")
                comp_name = comp_name + ", " + subject_start_date
            hc_res_encounter.name = comp_name 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:18,代码来源:hc_res_encounter.py

示例3: _compute_name

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def _compute_name(self):            
        comp_name = '/'     
        for hc_coverage in self:        
            if hc_coverage.network_id:  
                comp_name = hc_coverage.network_id.name or ''
            if hc_coverage.policy_holder_name:  
                comp_name = comp_name + ", " + hc_coverage.policy_holder_name or ''
            if hc_coverage.subscriber_name: 
                comp_name = comp_name + ", " + hc_coverage.subscriber_name or ''
            if hc_coverage.beneficiary_id:  
                comp_name = comp_name + ", " + hc_coverage.beneficiary_id.name or ''
            if hc_coverage.type_id: 
                comp_name = comp_name + ", " + hc_coverage.type_id.name or ''
            if hc_coverage.start_date:  
                comp_name = comp_name + ", " + datetime.strftime(datetime.strptime(hc_coverage.start_date, DTF), "%Y-%m-%d")
            hc_coverage.name = comp_name 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:18,代码来源:hc_res_coverage.py

示例4: attributes

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def attributes(self, cr, uid, field_name, record, options,
                   source_element, g_att, t_att, qweb_context,
                   context=None):
        value = record[field_name]
        if isinstance(value, basestring):
            value = datetime.datetime.strptime(
                value, DEFAULT_SERVER_DATETIME_FORMAT)
        if value:
            # convert from UTC (server timezone) to user timezone
            value = fields.datetime.context_timestamp(
                cr, uid, timestamp=value, context=context)
            value = value.strftime(DEFAULT_SERVER_DATETIME_FORMAT)

        attrs = super(DateTime, self).attributes(
            cr, uid, field_name, record, options, source_element, g_att, t_att,
            qweb_context, context=None)
        return itertools.chain(attrs, [
            ('data-oe-original', value)
        ]) 
开发者ID:osbzr,项目名称:gooderp_org,代码行数:21,代码来源:ir_qweb.py

示例5: close

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def close(self, cr, uid, ids, reason_id, context=None):
        if any(post.parent_id for post in self.browse(cr, uid, ids, context=context)):
            return False

        reason_offensive = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'website_forum.reason_7')
        reason_spam = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'website_forum.reason_8')
        if reason_id in (reason_offensive, reason_spam):
            for post in self.browse(cr, uid, ids, context=context):
                _logger.info('Downvoting user <%s> for posting spam/offensive contents',
                             post.create_uid)
                # TODO: in master, consider making this a tunable karma parameter
                self.pool['res.users'].add_karma(cr, SUPERUSER_ID, [post.create_uid.id],
                                                 post.forum_id.karma_gen_question_downvote * 5,
                                                 context=context)

        self.pool['forum.post'].write(cr, uid, ids, {
            'state': 'close',
            'closed_uid': uid,
            'closed_date': datetime.today().strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT),
            'closed_reason_id': reason_id,
        }, context=context) 
开发者ID:osbzr,项目名称:gooderp_org,代码行数:23,代码来源:forum.py

示例6: token

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def token(self):

        if self.token_expires_at > 0:
            now = time.time()
            if self.token_expires_at - now > 60:
                return self._token

        obj = self.weixin.pool.get('cm.ex.weixin.appconnect')

        json = self.grant_token()
        self._token = json["access_token"]
        self.token_expires_at = int(time.time()) + json["expires_in"]

        parm = {
            'access_token': self._token,
            'token_expires_at': self.token_expires_at,
            'date_token': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
        }
        obj.write(self.cr, SUPERUSER_ID, self.publi_account_id, parm)

        return self._token 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:23,代码来源:client.py

示例7: write

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def write(self, vals):
        status_history_obj = self.env['hc.care.plan.activity.detail.status.history']
        res = super(CarePlanActivityDetail, self).write(vals)
        status_history_record_ids = status_history_obj.search([('end_date','=', False)])
        if status_history_record_ids:
            if vals.get('status') and status_history_record_ids[0].status != vals.get('status'):
                for status_history in status_history_record_ids:
                    status_history.end_date = datetime.strftime(datetime.today(), DTF)
                    time_diff = datetime.today() - datetime.strptime(status_history.start_date, DTF)
                    if time_diff:
                        days = str(time_diff).split(',')
                        if days and len(days) > 1:
                            status_history.time_diff_day = str(days[0])
                            times = str(days[1]).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                        else:
                            times = str(time_diff).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                status_history_vals = {
                    'detail_id': self.id,
                    'status': vals.get('status'),
                    'start_date': datetime.today()
                    }
                status_history_obj.create(status_history_vals)
        return res 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:33,代码来源:hc_res_care_plan.py

示例8: write

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def write(self, vals):                          
        status_history_obj = self.env['hc.compartment.definition.status.history']                       
        publication_status_obj = self.env['hc.vs.publication.status']                       
        res = super(CompartmentDefinition, self).write(vals)                        
        status_history_record_ids = status_history_obj.search([('end_date','=', False)])                        
        if status_history_record_ids:                       
            if vals.get('status_id') and status_history_record_ids[0].status != vals.get('status_id'):                  
                for status_history in status_history_record_ids:                
                    status_history.end_date = datetime.strftime(datetime.today(), DTF)          
                    time_diff = datetime.today() - datetime.strptime(status_history.start_date, DTF)            
                    if time_diff:           
                        days = str(time_diff).split(',')        
                        if days and len(days) > 1:      
                            status_history.time_diff_day = str(days[0]) 
                            times = str(days[1]).split(':') 
                            if times and times > 1: 
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                        else:       
                            times = str(time_diff).split(':')   
                            if times and times > 1: 
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                publication_status = publication_status_obj.browse(vals.get('status_id'))               
                status_history_vals = {             
                    'compartment_definition_id': self.id,           
                    'status': publication_status.name,          
                    'start_date': datetime.today()          
                    }           
                status_history_obj.create(status_history_vals)              
        return res 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:35,代码来源:hc_res_compartment_definition.py

示例9: write

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def write(self, vals):
        status_history_obj = self.env['hc.code.system.status.history']
        publication_status_obj = self.env['hc.vs.publication.status']
        res = super(CodeSystem, self).write(vals)
        status_history_record_ids = status_history_obj.search([('end_date','=', False)])
        if status_history_record_ids:
            if vals.get('status_id') and status_history_record_ids[0].status != vals.get('status_id'):
                for status_history in status_history_record_ids:
                    status_history.end_date = datetime.strftime(datetime.today(), DTF)
                    time_diff = datetime.today() - datetime.strptime(status_history.start_date, DTF)
                    if time_diff:
                        days = str(time_diff).split(',')
                        if days and len(days) > 1:
                            status_history.time_diff_day = str(days[0])
                            times = str(days[1]).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                        else:
                            times = str(time_diff).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                publication_status = publication_status_obj.browse(vals.get('status_id'))
                status_history_vals = {
                    'code_system_id': self.id,
                    'status': publication_status.name,
                    'start_date': datetime.today()
                    }
                status_history_obj.create(status_history_vals)
        return res 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:35,代码来源:hc_res_code_system.py

示例10: _compute_name

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def _compute_name(self):
        comp_name = '/'
        for hc_res_research_subject in self:
            if hc_res_research_subject.identifier_id:
                comp_name = hc_res_research_subject.identifier_id.name or ''
            if hc_res_research_subject.individual_id:
                comp_name = comp_name + ", " + hc_res_research_subject.individual_id.name or ''
            if hc_res_research_subject.study_id:
                comp_name = comp_name + ", " + hc_res_research_subject.study_id.name or ''
            if hc_res_research_subject.period_start_date:
                comp_name = comp_name + ", " + datetime.strftime(datetime.strptime(hc_res_research_subject.period_start_date, DTF), "%Y-%m-%d")
            hc_res_research_subject.name = comp_name 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:14,代码来源:hc_res_research_subject.py

示例11: write

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def write(self, vals):
        status_history_obj = self.env['hc.research.subject.status.history']
        res = super(ResearchSubject, self).write(vals)
        status_history_record_ids = status_history_obj.search([('end_date','=', False)])
        if status_history_record_ids:
            if vals.get('status') and status_history_record_ids[0].status != vals.get('status'):
                for status_history in status_history_record_ids:
                    status_history.end_date = datetime.strftime(datetime.today(), DTF)
                    time_diff = datetime.today() - datetime.strptime(status_history.start_date, DTF)
                    if time_diff:
                        days = str(time_diff).split(',')
                        if days and len(days) > 1:
                            status_history.time_diff_day = str(days[0])
                            times = str(days[1]).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                        else:
                            times = str(time_diff).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                status_history_vals = {
                    'research_subject_id': self.id,
                    'status': vals.get('status'),
                    'start_date': datetime.today()
                    }
                status_history_obj.create(status_history_vals)
        return res 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:33,代码来源:hc_res_research_subject.py

示例12: write

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def write(self, vals):
        status_history_obj = self.env['hc.appointment.participant.status.history']
        res = super(AppointmentParticipant, self).write(vals)
        status_history_record_ids = status_history_obj.search([('end_date','=', False)])
        if status_history_record_ids:
            if vals.get('status') and status_history_record_ids[0].status != vals.get('status'):
                for status_history in status_history_record_ids:
                    status_history.end_date = datetime.strftime(datetime.today(), DTF)
                    time_diff = datetime.today() - datetime.strptime(status_history.start_date, DTF)
                    if time_diff:
                        days = str(time_diff).split(',')
                        if days and len(days) > 1:
                            status_history.time_diff_day = str(days[0])
                            times = str(days[1]).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                        else:
                            times = str(time_diff).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                status_history_vals = {
                    'participant_id': self.id,
                    'status': vals.get('status'),
                    'start_date': datetime.today()
                    }
                status_history_obj.create(status_history_vals)
        return res 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:33,代码来源:hc_res_appointment.py

示例13: write

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def write(self, vals):                          
        status_history_obj = self.env['hc.eligibility.request.status.history']                      
        fm_status_obj = self.env['hc.vs.fm.status']                     
        res = super(EligibilityRequest, self).write(vals)                       
        status_history_record_ids = status_history_obj.search([('end_date','=', False)])                        
        if status_history_record_ids:                       
            if vals.get('status_id') and status_history_record_ids[0].status != vals.get('status_id'):                  
                for status_history in status_history_record_ids:                
                    status_history.end_date = datetime.strftime(datetime.today(), DTF)          
                    time_diff = datetime.today() - datetime.strptime(status_history.start_date, DTF)            
                    if time_diff:           
                        days = str(time_diff).split(',')        
                        if days and len(days) > 1:      
                            status_history.time_diff_day = str(days[0]) 
                            times = str(days[1]).split(':') 
                            if times and times > 1: 
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                        else:       
                            times = str(time_diff).split(':')   
                            if times and times > 1: 
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                fm_status = fm_status_obj.browse(vals.get('status_id'))             
                status_history_vals = {             
                    'eligibility_request_id': self.id,          
                    'status': fm_status.name,           
                    'start_date': datetime.today()          
                    }           
                if vals.get('status_id') == 'entered-in-error':             
                    status_id_history_vals.update({'end_date': datetime.today()})           
                status_history_obj.create(status_history_vals)              
        return res 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:37,代码来源:hc_res_eligibility_request.py

示例14: _compute_name

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def _compute_name(self):                
        comp_name = '/'         
        for hc_res_detected_issue in self:          
            if hc_res_detected_issue.patient_id:       
                comp_name = hc_res_detected_issue.patient_id.name  
                if hc_res_detected_issue.patient_id.birth_date:    
                    patient_birth_date = datetime.strftime(datetime.strptime(hc_res_detected_issue.patient_id.birth_date, DF), "%Y-%m-%d")
                    comp_name = comp_name + "("+ patient_birth_date + "),"
            if hc_res_detected_issue.category_id:       
                comp_name = comp_name + " " + hc_res_detected_issue.category_id.name + "," or ''  
            if hc_res_detected_issue.date:      
                patient_date = datetime.strftime(datetime.strptime(hc_res_detected_issue.date, DTF), "%Y-%m-%d")    
                comp_name = comp_name + " " + patient_date  
            hc_res_detected_issue.name = comp_name 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:16,代码来源:hc_res_detected_issue.py

示例15: write

# 需要导入模块: from openerp import tools [as 别名]
# 或者: from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT [as 别名]
def write(self, vals):
        status_history_obj = self.env['hc.activity.definition.status.history']
        publication_status_obj = self.env['hc.vs.publication.status']
        res = super(ActivityDefinition, self).write(vals)
        status_history_record_ids = status_history_obj.search([('end_date','=', False)])
        if status_history_record_ids:
            if vals.get('status_id') and status_history_record_ids[0].status != vals.get('status_id'):
                for status_history in status_history_record_ids:
                    status_history.end_date = datetime.strftime(datetime.today(), DTF)
                    time_diff = datetime.today() - datetime.strptime(status_history.start_date, DTF)
                    if time_diff:
                        days = str(time_diff).split(',')
                        if days and len(days) > 1:
                            status_history.time_diff_day = str(days[0])
                            times = str(days[1]).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                        else:
                            times = str(time_diff).split(':')
                            if times and times > 1:
                                status_history.time_diff_hour = str(times[0])
                                status_history.time_diff_min = str(times[1])
                                status_history.time_diff_sec = str(times[2])
                publication_status = publication_status_obj.browse(vals.get('status_id'))
                status_history_vals = {
                    'activity_definition_id': self.id,
                    'status': publication_status.name,
                    'start_date': datetime.today()
                    }
                status_history_obj.create(status_history_vals)
        return res 
开发者ID:luigisison,项目名称:odoo-fhir,代码行数:35,代码来源:hc_res_activity_definition.py


注:本文中的openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。