hc_res_care_plan.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:odoo-fhir 作者: luigisison 项目源码 文件源码
def create(self, vals):
        status_history_obj = self.env['hc.care.plan.status.history']
        intent_history_obj = self.env['hc.care.plan.intent.history']
        res = super(CarePlan, self).create(vals)

        # For Status
        if vals and vals.get('status'):
            status_history_vals = {
                'care_plan_id': res.id,
                'status': res.status,
                'start_date': datetime.today()
                }
            if vals.get('status') == 'entered-in-error':
                status_history_vals.update({'end_date': datetime.today()})
            status_history_obj.create(status_history_vals)

        # For Intent
        if vals.get('status') != 'entered-in-error':
            if vals and vals.get('intent'):
                intent_history_vals = {
                    'care_plan_id': res.id,
                    'intent': res.intent,
                    'start_date': datetime.today()
                    }
                intent_history_obj.create(intent_history_vals)

        return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号