diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index 41be3fe6d..502e86212 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -674,9 +674,19 @@ class YuthonVacationReports(models.Model): 'vacation_date': current_month_first, }) - def _update_leave_lines(self, report, allocations, number_of_hours_display): for alloc in allocations: + existing_line = self.env['vacation.leave.line'].search([ + ('workflow_record_id', '=', False), + ('vacation_id', '=', report.id), + ('employee_id', '=', report.employee_id.id), + ('update_type', '=', 'add'), + ('allocation_type', '=', 'allocation'), + ('update_lines', '=', number_of_hours_display), + ('is_void', '=', False) + ], limit=1) + if existing_line: + continue self.env['vacation.leave.line'].create({ 'vacation_id': report.id, 'employee_id': report.employee_id.id, @@ -691,6 +701,19 @@ class YuthonVacationReports(models.Model): def _update_over_lines(self, report, allocations, number_of_hours_display): """更新补休明细行""" for alloc in allocations: + existing_line = self.env['vacation.leave.line'].search([ + ('workflow_record_id', '=', False), + ('vacation_id', '=', report.id), + ('employee_id', '=', report.employee_id.id), + ('update_type', '=', 'add'), + ('allocation_type', '=', 'allocation'), + ('workday', '=', number_of_hours_display), + ('legal_day', '=', 0), + ('public_holidays', '=', 0), + ('meal_number', '=', 0), + ], limit=1) + if existing_line: + continue self.env['vacation.over.line'].create({ 'vacation_id': report.id, 'employee_id': report.employee_id.id, diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py index 2c31af2ce..e2d67aab7 100644 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -7,13 +7,14 @@ from odoo.exceptions import UserError, ValidationError class InheritPurchaseOrder(models.Model): # _inherit = 'purchase.order' _name = 'purchase.order' - _inherit = ['purchase.order','sun.badge.menu.mixin'] + _inherit = ['purchase.order', 'soong.workflow.mixin'] json_display = fields.Char( string="物品详情", compute='_compute_json_display', store=True ) + work_end = fields.Boolean(string="结束") document_ids = fields.Many2many('ir.attachment', string="附件") diff --git a/yuthon_purchase/views/inherit_purchase_order_views.xml b/yuthon_purchase/views/inherit_purchase_order_views.xml index 7db1929f8..4245824ab 100644 --- a/yuthon_purchase/views/inherit_purchase_order_views.xml +++ b/yuthon_purchase/views/inherit_purchase_order_views.xml @@ -29,6 +29,8 @@ + + [('is_employee', '=', False)]