!5758 添加功能

Merge pull request !5758 from dev_zhou
This commit is contained in:
李鹏宇
2025-10-17 07:41:43 +00:00
committed by Gitee
4 changed files with 21 additions and 6 deletions
@@ -39,6 +39,7 @@ class PropertyAccountsReceivable(models.Model):
management_type_id = fields.Many2one('yuthon.management.type', string='应收类型')
last_update_time = fields.Datetime(string='最后修改时间')
is_write = fields.Boolean(string='是否修改')
acc_type = fields.Selection([('new', '新租'), ('done', '到期')], string='类型')
bank_id = fields.Many2one('property.bank.statements', string='流水记录')
receivable_log = fields.Text(string='应收日志')
@@ -4,6 +4,7 @@
<field name="model">property.accounts.receivable</field>
<field name="arch" type="xml">
<tree editable="bottom" string="应收账单" decoration-success="is_reconciliation == True" limit="15">
<field name="acc_type" string=" "/>
<field name="due_date" readonly="1" width="300px"/>
<field name="due_date_end" readonly="1"/>
<field name="payout_date" readonly="1"/>
@@ -879,6 +879,17 @@ class PropertyRentList(models.Model):
due_date_end = False
theoretical_end = False
contract = rec.contract_id
existing_receivable = self.env['property.accounts.receivable'].search([
('lessee_id', '=', rec.lessee_id.id),
('management_type_id.name', '=', '租金'),
('contract_id', '=', contract),
], limit=1)
if not existing_receivable:
acc_type = 'new'
else:
acc_type = None
if contract and contract.cycle_mode and due_date:
due_date_obj = fields.Date.from_string(due_date)
contract_actual_end = fields.Date.from_string(
@@ -916,6 +927,7 @@ class PropertyRentList(models.Model):
'lessee_id': contract.lessee_id.id if contract and contract.lessee_id else None,
'original_amount': rec.original_amount,
'due_date': due_date,
'acc_type': acc_type,
'due_date_end': due_date_end,
'create_time': datetime.now(),
'management_type_id': management_type.id,
@@ -99,13 +99,12 @@ class PropertyRentalWizard(models.Model):
for lease_id in record.lease_ids:
property_id = lease_id.address_id
management_id = self.env['property.management.list'].search([
('property_id', '=', property_id.id),
('contract_id', '=', record.id),
('due_date', '>=', first_day_of_month),
('due_date', '<=', last_day_of_month)
])
matched_info = self.env['manage.information.line']
if record.contract_sort in ['guanggao','guanzi']:
if record.contract_sort in ['guanggao','guanzi', 'room']:
original_amount = rent_amount
else:
original_amount = 0
@@ -124,7 +123,7 @@ class PropertyRentalWizard(models.Model):
if matched_info:
original_amount = int(round(matched_info.management_area * standard_id.amount))
is_special_contract = record.contract_sort in ['guanggao', 'guanzi']
is_special_contract = record.contract_sort in ['guanggao', 'guanzi', 'room']
has_valid_property_info = property_id.manage_information_ids and property_id.message_standard_id
if (not is_special_contract and has_valid_property_info) or is_special_contract:
area_value = matched_info.management_area if matched_info else 0
@@ -163,7 +162,8 @@ class PropertyRentalWizard(models.Model):
# 当期应收日期
if not record.is_contract:
if start_year_month <= date_field_year_month <= end_year_month:
self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier)
if rent_id.period_rent != 0 and record.contract_sort not in ['guanggao', 'guanzi', 'room']:
self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier)
self.create_management_list(record, start_date, rent_amount)
def get_multiplier(self, cycle_dict):
@@ -183,8 +183,9 @@ class PropertyRentalWizard(models.Model):
first_day = datetime.strptime(date_field_year_month, '%Y-%m').date()
next_month_first_day = first_day + relativedelta(months=1)
records = self.env['property.lease.contract'].search([
('actual_start_time', '<', next_month_first_day),
('actual_end_time', '>=', first_day),
# ('actual_start_time', '<', next_month_first_day),
# ('actual_end_time', '>=', first_day),
('contract_code', '=', '管(2025)001')
])
for record in records:
# 获取租金乘数(1 表示按月,3 表示季租金,6 表示半年租金,年后面赋值)