當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。