Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -1312,6 +1312,8 @@ class HrAttendance(models.Model):
|
|||||||
pass #todo 待过
|
pass #todo 待过
|
||||||
|
|
||||||
def update_attendance(self, employee, current_date):
|
def update_attendance(self, employee, current_date):
|
||||||
|
if self.shift_name == '外派':
|
||||||
|
return
|
||||||
# 判断当天入职:
|
# 判断当天入职:
|
||||||
if employee.entry_date:
|
if employee.entry_date:
|
||||||
if current_date <= employee.entry_date:
|
if current_date <= employee.entry_date:
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
import xlwt
|
import xlwt
|
||||||
import base64
|
import base64
|
||||||
@@ -21,6 +23,7 @@ class PropertyAccountsReceivable(models.Model):
|
|||||||
title_certificate = fields.Char(sting="产权证号")
|
title_certificate = fields.Char(sting="产权证号")
|
||||||
due_date = fields.Date(string='应收开始')
|
due_date = fields.Date(string='应收开始')
|
||||||
due_date_end = fields.Date(string='应收结束')
|
due_date_end = fields.Date(string='应收结束')
|
||||||
|
is_batch = fields.Boolean(string='标记') # 修复违约金数据标记
|
||||||
reconciliation_time = fields.Datetime('对账时间')
|
reconciliation_time = fields.Datetime('对账时间')
|
||||||
month_id = fields.Many2one('base.month', string='月份', compute="_compute_display_date", store=True)
|
month_id = fields.Many2one('base.month', string='月份', compute="_compute_display_date", store=True)
|
||||||
year_id = fields.Many2one('base.year', string='年份', compute="_compute_display_date", store=True)
|
year_id = fields.Many2one('base.year', string='年份', compute="_compute_display_date", store=True)
|
||||||
@@ -46,8 +49,8 @@ class PropertyAccountsReceivable(models.Model):
|
|||||||
rec.is_overdue = (
|
rec.is_overdue = (
|
||||||
rec.is_reconciliation
|
rec.is_reconciliation
|
||||||
and rec.payout_date
|
and rec.payout_date
|
||||||
and (rec.due_date_end or rec.due_date)
|
and rec.due_date
|
||||||
and rec.payout_date > (rec.due_date_end or rec.due_date)
|
and rec.payout_date > (rec.due_date + relativedelta(months=1)).replace(day=1)
|
||||||
and not has_penalty)
|
and not has_penalty)
|
||||||
|
|
||||||
difference_amount = fields.Float(string='差额')
|
difference_amount = fields.Float(string='差额')
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<field name="is_suspend" optional="hide"/>
|
<field name="is_suspend" optional="hide"/>
|
||||||
<field name="is_write" column_invisible="1"/>
|
<field name="is_write" column_invisible="1"/>
|
||||||
<field name="bank_id" column_invisible="1"/>
|
<field name="bank_id" column_invisible="1"/>
|
||||||
|
<field name="is_batch" column_invisible="1"/>
|
||||||
<field name="print_number"/>
|
<field name="print_number"/>
|
||||||
<field name="print_date"/>
|
<field name="print_date"/>
|
||||||
<field name="discount_date"/>
|
<field name="discount_date"/>
|
||||||
|
|||||||
@@ -1020,6 +1020,63 @@ class PropertyAccountsReceivable(models.Model):
|
|||||||
"""根据选中的租金应收生成违约金应收(仅对已对账部分,逾期判定 + 去重)"""
|
"""根据选中的租金应收生成违约金应收(仅对已对账部分,逾期判定 + 去重)"""
|
||||||
for receivable in self:
|
for receivable in self:
|
||||||
receivable._compute_is_overdue()
|
receivable._compute_is_overdue()
|
||||||
|
if receivable.management_type_id.name != '租金':
|
||||||
|
continue
|
||||||
|
if not receivable.is_liquidated_damages:
|
||||||
|
continue
|
||||||
|
if not receivable.is_overdue:
|
||||||
|
continue
|
||||||
|
if not receivable.contract_id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
percentage = receivable.contract_id.percentage_liquidated_damages
|
||||||
|
if not percentage or not percentage.name:
|
||||||
|
continue
|
||||||
|
|
||||||
|
original_amount = receivable.original_amount
|
||||||
|
first_day = (receivable.due_date + relativedelta(months=1)).replace(day=1)
|
||||||
|
penalty_days = (receivable.payout_date - first_day).days + 1
|
||||||
|
modify_line = self.env['receivable.modify.line'].search([
|
||||||
|
('receivable_id', '=', receivable.id),
|
||||||
|
('reconciliation_date', '!=', False),
|
||||||
|
('is_penalty', '=', False)
|
||||||
|
], order='reconciliation_date asc', limit=1)
|
||||||
|
if receivable.number_of_payments == 1:
|
||||||
|
original_amount = receivable.original_amount
|
||||||
|
elif modify_line:
|
||||||
|
original_amount = receivable.original_amount - modify_line.amount
|
||||||
|
penalty_amount = round(penalty_days * original_amount * float(percentage.name), 2)
|
||||||
|
if penalty_amount <= 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
existing = self.env['property.accounts.receivable'].search([
|
||||||
|
('contract_id', '=', receivable.contract_id.id),
|
||||||
|
('management_type_id.name', '=', '违约金'),
|
||||||
|
('original_amount', '=', penalty_amount),
|
||||||
|
('source_receivable_id', '=', receivable.id),
|
||||||
|
('is_invalid', '=', False),
|
||||||
|
], limit=1)
|
||||||
|
if existing:
|
||||||
|
existing.write({
|
||||||
|
"due_date": receivable.payout_date,
|
||||||
|
"due_date_end": None,
|
||||||
|
'is_batch': True,
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
acc_receivable = self.env['property.accounts.receivable'].create({
|
||||||
|
'contract_id': receivable.contract_id.id,
|
||||||
|
'management_type_id': self.env['yuthon.management.type'].search(
|
||||||
|
[('name', '=', '违约金')], limit=1).id,
|
||||||
|
'due_date': receivable.payout_date,
|
||||||
|
'due_date_end': None,
|
||||||
|
'is_batch': True,
|
||||||
|
'original_amount': penalty_amount,
|
||||||
|
'remark': f'违约金({first_day}至{receivable.payout_date},共{penalty_days}天)',
|
||||||
|
'source_receivable_id': receivable.id,
|
||||||
|
'charging_range': f'{first_day}到{receivable.payout_date}',
|
||||||
|
'deposit_state': 'unpaid',
|
||||||
|
})
|
||||||
|
acc_receivable.update_property_ids()
|
||||||
|
|
||||||
@api.depends('contract_id')
|
@api.depends('contract_id')
|
||||||
def _compute_property_name(self):
|
def _compute_property_name(self):
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class PropertyLeaseContract(models.Model):
|
|||||||
_name = 'property.lease.contract'
|
_name = 'property.lease.contract'
|
||||||
_description = '租赁合同审批'
|
_description = '租赁合同审批'
|
||||||
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
|
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
|
||||||
_rec_name = 'display_name'
|
_rec_name = 'contract_code'
|
||||||
|
|
||||||
property_name = fields.Char(string='物业信息')
|
property_name = fields.Char(string='物业信息')
|
||||||
confirm_id = fields.Many2one('property.confirm', string="关联成交确认审批")
|
confirm_id = fields.Many2one('property.confirm', string="关联成交确认审批")
|
||||||
@@ -137,7 +137,6 @@ class PropertyLeaseContract(models.Model):
|
|||||||
admin_id = fields.Many2one('res.users', string="管理员", compute="_compute_admin_id", store=True)
|
admin_id = fields.Many2one('res.users', string="管理员", compute="_compute_admin_id", store=True)
|
||||||
tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型', compute="_compute_admin_id", store=True)
|
tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型', compute="_compute_admin_id", store=True)
|
||||||
contract_code = fields.Char(string="合同编号")
|
contract_code = fields.Char(string="合同编号")
|
||||||
display_name = fields.Char(string="合同编号", compute="_compute_display_name", store=True)
|
|
||||||
is_chapter = fields.Selection([('yes', '是'), ('no', '否')], string="是否用章")
|
is_chapter = fields.Selection([('yes', '是'), ('no', '否')], string="是否用章")
|
||||||
type_stamp_ids = fields.Many2many('seals.type.setting', string='用章类型')
|
type_stamp_ids = fields.Many2many('seals.type.setting', string='用章类型')
|
||||||
scope_chapter_ids = fields.Many2many('seals.scope.setting', string='用章范围')
|
scope_chapter_ids = fields.Many2many('seals.scope.setting', string='用章范围')
|
||||||
@@ -518,16 +517,6 @@ class PropertyLeaseContract(models.Model):
|
|||||||
contract.betweene_tubes
|
contract.betweene_tubes
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends('contract_code', 'version')
|
|
||||||
def _compute_display_name(self):
|
|
||||||
for rec in self:
|
|
||||||
if rec.version and rec.contract_code:
|
|
||||||
rec.display_name = f"{rec.contract_code}({rec.version})"
|
|
||||||
elif rec.contract_code:
|
|
||||||
rec.display_name = f"{rec.contract_code}"
|
|
||||||
else:
|
|
||||||
rec.display_name = False
|
|
||||||
|
|
||||||
def name_get(self):
|
def name_get(self):
|
||||||
"""
|
"""
|
||||||
默认保持原来的显示(各处仍然用 display_name,例如 含版本号);
|
默认保持原来的显示(各处仍然用 display_name,例如 含版本号);
|
||||||
|
|||||||
Reference in New Issue
Block a user