添加功能
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
from odoo import models, fields, api, exceptions, _
|
||||
from datetime import datetime, timedelta, date
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class PropertyLeaseRenewal(models.Model):
|
||||
@@ -176,6 +177,13 @@ class PropertyLeaseRenewal(models.Model):
|
||||
'contract_id': new_contract.id
|
||||
})
|
||||
else:
|
||||
receivable_ids = self.env['property.accounts.receivable'].search([
|
||||
('due_date', '<=', self.early_quitting_date),
|
||||
('contract_id', '=', self.contract_id.id),
|
||||
])
|
||||
if any(not receivable.is_reconciliation for receivable in receivable_ids):
|
||||
raise UserError("该合同下存在未对账的应收单,无法提前退押金")
|
||||
|
||||
rec.contract_id.write({
|
||||
'actual_end_time': rec.early_quitting_date
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
class PropertyBillsWizard(models.TransientModel):
|
||||
@@ -9,6 +10,13 @@ class PropertyBillsWizard(models.TransientModel):
|
||||
actual_date = fields.Date(string='实付日期', default=fields.Date.today)
|
||||
|
||||
def confirm(self):
|
||||
receivable_ids = self.env['property.accounts.receivable'].search([
|
||||
('due_date', '<=', self.bills_list_id.due_date),
|
||||
('contract_id', '=', self.bills_list_id.contract_id.id),
|
||||
])
|
||||
if any(not receivable.is_reconciliation for receivable in receivable_ids):
|
||||
raise UserError("该合同下存在未对账的应收单,无法退押金")
|
||||
|
||||
if self.actual_date:
|
||||
self.bills_list_id.actual_date = self.actual_date
|
||||
receivable = self.env['property.accounts.receivable'].search([('contract_id', '=', self.bills_list_id.contract_id.id),
|
||||
|
||||
Reference in New Issue
Block a user