Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -2,7 +2,7 @@ from odoo import api, fields, models, tools, _
|
||||
from datetime import datetime, time, timedelta
|
||||
from odoo.exceptions import UserError
|
||||
from datetime import date, timedelta
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
class YuthonOvertimeLine(models.Model):
|
||||
@@ -36,7 +36,7 @@ class YuthonOvertimeLine(models.Model):
|
||||
self.ensure_one()
|
||||
current_year = int(self.select_year)
|
||||
current_month = int(self.select_month)
|
||||
cutoff_date = date(current_year, current_month, 1)
|
||||
cutoff_date = date(current_year, current_month, 1) + relativedelta(months=1) - timedelta(days=1)
|
||||
cutoff_dt = datetime.combine(cutoff_date, datetime.min.time())
|
||||
domain = [
|
||||
('start_time', '<', cutoff_dt),
|
||||
|
||||
@@ -1403,7 +1403,7 @@ class VacationOverline(models.Model):
|
||||
],string='结转状态',
|
||||
default='pending',
|
||||
)
|
||||
remaining_quantity = fields.Float(string='剩余数', compute="_compute_last_balance", store=True)
|
||||
remaining_quantity = fields.Float(string='剩余数', compute="_compute_last_balance")
|
||||
|
||||
def open_record1(self):
|
||||
tree_id = self.env.ref("yuthon_hr_attendance.view_yuthon_vacation_overtime_tree").id
|
||||
@@ -1486,12 +1486,12 @@ class VacationOverline(models.Model):
|
||||
rec._compute_employee_id()
|
||||
rec._compute_last_balance()
|
||||
|
||||
@api.depends('vacation_id', 'carry_forward_quantity')
|
||||
@api.depends('vacation_id', 'carry_forward_quantity', 'duration')
|
||||
def _compute_last_balance(self):
|
||||
for rec in self:
|
||||
if rec.vacation_id:
|
||||
rec.last_balance = rec.vacation_id.last_holiday + rec.vacation_id.last_workday
|
||||
rec.remaining_quantity = rec.public_holidays + rec.workday - rec.carry_forward_quantity
|
||||
rec.remaining_quantity = rec.duration - rec.carry_forward_quantity
|
||||
else:
|
||||
rec.last_balance = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user