diff --git a/tianhe_approvals/data/approval_category_type_data.xml b/tianhe_approvals/data/approval_category_type_data.xml index 012d6fb42..7fce8e0a6 100644 --- a/tianhe_approvals/data/approval_category_type_data.xml +++ b/tianhe_approvals/data/approval_category_type_data.xml @@ -4,9 +4,7 @@ 采购办公用品 - purchase_work_approval - approval.request - + purchase_work 1 no no diff --git a/tianhe_approvals/models/inherit_approval_category.py b/tianhe_approvals/models/inherit_approval_category.py index 793c602bd..eb31e5a2b 100644 --- a/tianhe_approvals/models/inherit_approval_category.py +++ b/tianhe_approvals/models/inherit_approval_category.py @@ -6,31 +6,7 @@ class ApprovalCategory(models.Model): _inherit = 'approval.category' _description = 'tian he 审批框架拓展' - def create_request(self): - self.ensure_one() - if not self.category_type_number: - return { - "type": "ir.actions.act_window", - "res_model": "approval.request", - "views": [[False, "form"]], - "context": { - 'default_name': _('New') if self.automated_sequence else self.name, - 'default_category_id': self.id, - 'default_request_owner_id': self.env.user.id, - 'default_request_status': 'new' - }, - } - else: - form_str = 'tianhe_approvals.approvals_category_type_code_%s' % self.category_type_number - approvals_form_id = self.env.ref(form_str).id or '' - return { - "type": "ir.actions.act_window", - "res_model": self.model_name, - "views": [[approvals_form_id, "form"]], - "context": { - 'default_name': _('New') if self.automated_sequence else self.name, - 'default_category_id': self.id, - 'default_request_owner_id': self.env.user.id, - 'default_request_status': 'new' - }, - } \ No newline at end of file + approval_category_type = fields.Selection([ + ('demo', 'demo测试'), + ('purchase_work', '采购审批单'), + ]) \ No newline at end of file diff --git a/tianhe_approvals/models/tianhe_purchase_work_approval.py b/tianhe_approvals/models/tianhe_purchase_work_approval.py index fc9e4041a..f26816ebe 100644 --- a/tianhe_approvals/models/tianhe_purchase_work_approval.py +++ b/tianhe_approvals/models/tianhe_purchase_work_approval.py @@ -7,9 +7,6 @@ class TianHePurchaseApproval(models.Model): _inherit = "approval.request" _description = '天河采购审批单' - # approvals_department_id 部门 - # date_confirm 确认日期 - # purchase_work_notice = fields.Text(string="采购原由") - # 产品明细,设备名称,型号,单价,数量,小计,库存,备注 + purchase_work_notice = fields.Text(string="采购原由") diff --git a/tianhe_approvals/views/tianhe_purchase_work_approval.xml b/tianhe_approvals/views/tianhe_purchase_work_approval.xml index bf621c65e..3f97e6e6f 100644 --- a/tianhe_approvals/views/tianhe_purchase_work_approval.xml +++ b/tianhe_approvals/views/tianhe_purchase_work_approval.xml @@ -8,13 +8,10 @@ - - 采购原由 - - - + + diff --git a/yuthon_approval/__manifest__.py b/yuthon_approval/__manifest__.py index 1f1834c0a..e71df5fab 100644 --- a/yuthon_approval/__manifest__.py +++ b/yuthon_approval/__manifest__.py @@ -13,13 +13,13 @@ 'depends': ['approvals'], 'data': [ 'security/ir.model.access.csv', - 'data/approval_category_type_data.xml', 'wizard/approval_notice_wizard_views.xml', 'wizard/approval_refuse_wizard_views.xml', 'views/inherit_approval_category_views.xml', 'views/inherit_approval_request_views.xml', 'views/approval_process_views.xml', 'views/demo_approval_request.xml', + 'data/approval_category_type_data.xml', 'report/all_demo_report.xml', ], 'installable': True, diff --git a/yuthon_approval/data/approval_category_type_data.xml b/yuthon_approval/data/approval_category_type_data.xml index 3f9e32df6..67672bfe3 100644 --- a/yuthon_approval/data/approval_category_type_data.xml +++ b/yuthon_approval/data/approval_category_type_data.xml @@ -2,11 +2,10 @@ - + demo测试 - demo_request - demo.request - + demo + 1 no required diff --git a/yuthon_approval/models/demo_approval_request.py b/yuthon_approval/models/demo_approval_request.py index fc64de44b..0fbbee7b2 100644 --- a/yuthon_approval/models/demo_approval_request.py +++ b/yuthon_approval/models/demo_approval_request.py @@ -5,7 +5,7 @@ from odoo.exceptions import ValidationError class DemoApprovalRequest(models.Model): _inherit = "approval.request" - _description = '默认审批' + _description = '默认测试审批' demo1 = fields.Char(string="demo1") demo2 = fields.Char(string="demo2") diff --git a/yuthon_approval/models/inherit_approval_category.py b/yuthon_approval/models/inherit_approval_category.py index e25685daf..424b07c14 100644 --- a/yuthon_approval/models/inherit_approval_category.py +++ b/yuthon_approval/models/inherit_approval_category.py @@ -6,10 +6,11 @@ class ApprovalCategory(models.Model): _inherit = 'approval.category' _description = '审批框架拓展' - model_name = fields.Char(string="模型名称") - category_type_number = fields.Char(string='审批视图编号') approval_department_ids = fields.Many2many('hr.department', string="审批所属部门") approval_process_id = fields.Many2one('approval.process', string="审批流程") + approval_category_type = fields.Selection([ + ('demo', 'demo测试') + ], string="审批类别", help="后台计算") is_enable = fields.Boolean(string="启用", default=True) category_start_date = fields.Date(string="开始日期", default=fields.Date.today()) category_end_date = fields.Date(string="结束日期") @@ -24,33 +25,4 @@ class ApprovalCategory(models.Model): 'user_id': user, 'category_id': record.id })) - record.approver_ids = category_approver - - def create_request(self): - self.ensure_one() - if not self.category_type_number: - return { - "type": "ir.actions.act_window", - "res_model": "approval.request", - "views": [[False, "form"]], - "context": { - 'default_name': _('New') if self.automated_sequence else self.name, - 'default_category_id': self.id, - 'default_request_owner_id': self.env.user.id, - 'default_request_status': 'new' - }, - } - else: - form_str = 'yuthon_approval.approvals_category_type_code_%s' % self.category_type_number - approvals_form_id = self.env.ref(form_str).id or '' - return { - "type": "ir.actions.act_window", - "res_model": self.model_name, - "views": [[approvals_form_id, "form"]], - "context": { - 'default_name': _('New') if self.automated_sequence else self.name, - 'default_category_id': self.id, - 'default_request_owner_id': self.env.user.id, - 'default_request_status': 'new' - }, - } \ No newline at end of file + record.approver_ids = category_approver \ No newline at end of file diff --git a/yuthon_approval/models/inherit_approval_request.py b/yuthon_approval/models/inherit_approval_request.py index 9117ce99a..029b8d757 100644 --- a/yuthon_approval/models/inherit_approval_request.py +++ b/yuthon_approval/models/inherit_approval_request.py @@ -6,6 +6,8 @@ from odoo.exceptions import ValidationError class ApprovalRequest(models.Model): _inherit = "approval.request" + approval_category_name = fields.Selection(string="类别名称", related='category_id.approval_category_type') + def print_approval_report(self): return self.env.ref('yuthon_approval.all_demo_report_actions').report_action(self) diff --git a/yuthon_approval/views/demo_approval_request.xml b/yuthon_approval/views/demo_approval_request.xml index 432b9bbdb..11ff55e2c 100644 --- a/yuthon_approval/views/demo_approval_request.xml +++ b/yuthon_approval/views/demo_approval_request.xml @@ -6,9 +6,9 @@ - - - + + + diff --git a/yuthon_approval/views/inherit_approval_category_views.xml b/yuthon_approval/views/inherit_approval_category_views.xml index 373fe639d..10664cf01 100644 --- a/yuthon_approval/views/inherit_approval_category_views.xml +++ b/yuthon_approval/views/inherit_approval_category_views.xml @@ -6,7 +6,6 @@ - @@ -20,9 +19,8 @@ - - + diff --git a/yuthon_approval/views/inherit_approval_request_views.xml b/yuthon_approval/views/inherit_approval_request_views.xml index cae08987a..191d9b90c 100644 --- a/yuthon_approval/views/inherit_approval_request_views.xml +++ b/yuthon_approval/views/inherit_approval_request_views.xml @@ -7,25 +7,30 @@ - +