@@ -87,8 +87,7 @@ class PropertyReconciliationWizard(models.Model):
|
||||
])
|
||||
|
||||
for penalty in receivable_penalties:
|
||||
exists = any(p['rent'] == penalty.submitted and
|
||||
p['due_date'] == penalty.due_date and
|
||||
exists = any(p['due_date'] == penalty.due_date and
|
||||
p['contract_id'] == penalty.contract_id.id
|
||||
for p in contract_penalties)
|
||||
if not exists:
|
||||
@@ -115,6 +114,11 @@ class PropertyReconciliationWizard(models.Model):
|
||||
if self.reconciliation_line_ids:
|
||||
self.reconciliation_line_ids.sorted(key=lambda r: r.sequence)
|
||||
|
||||
all_penalties = all(line.collection_type == 'penalty' for line in self.reconciliation_line_ids)
|
||||
if all_penalties and self.reconciliation_line_ids:
|
||||
total = sum(line.rent for line in self.reconciliation_line_ids)
|
||||
self.receivable_total = total
|
||||
|
||||
remaining_amount = self.actual_total
|
||||
|
||||
# 检查是否有单行的rent等于实际金额
|
||||
@@ -167,12 +171,12 @@ class PropertyReconciliationWizard(models.Model):
|
||||
('tenant_id.name', '!=', False)
|
||||
])
|
||||
if bank_lines:
|
||||
if rec.actual_total > rec.receivable_total:
|
||||
rec.bank_id.registered = rec.actual_total - rec.receivable_total
|
||||
rec.bank_id.bank_state = 'registered'
|
||||
else:
|
||||
if rec.actual_total == rec.receivable_total:
|
||||
rec.bank_id.registered = 0
|
||||
rec.bank_id.bank_state = 'reconciled'
|
||||
else:
|
||||
rec.bank_id.registered = abs(rec.actual_total - rec.receivable_total)
|
||||
rec.bank_id.bank_state = 'registered'
|
||||
|
||||
rec.bank_id.yes_amount = rec.amount_been_reconciled
|
||||
rec.bank_id.no_amount = rec.amount_reconciled
|
||||
@@ -234,7 +238,8 @@ class PropertyReconciliationWizard(models.Model):
|
||||
('lessee_id', '=', first_line.tenant_id.id),
|
||||
]
|
||||
# 检查是否已有相同记录
|
||||
existing_record = self.env['property.accounts.receivable'].search(check_domain, limit=1)
|
||||
existing_record = self.env['property.accounts.receivable'].search(check_domain)
|
||||
is_reconciliation = line.amount == line.rent
|
||||
if not existing_record:
|
||||
domain2 = [
|
||||
('due_date', '=', line.due_date),
|
||||
@@ -242,7 +247,6 @@ class PropertyReconciliationWizard(models.Model):
|
||||
('contract_id', '=', line.contract_id.id),
|
||||
('collection_type', '=', 'rent'),
|
||||
]
|
||||
is_reconciliation = line.amount
|
||||
reconciliation_id = self.env['property.reconciliation.line'].search(domain2, limit=1)
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'is_reconciliation': is_reconciliation,
|
||||
@@ -259,6 +263,16 @@ class PropertyReconciliationWizard(models.Model):
|
||||
'remark': line.remake,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
})
|
||||
else:
|
||||
existing_record.write({
|
||||
'delivered1': line.amount,
|
||||
'due_date_end': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None,
|
||||
'is_reconciliation': is_reconciliation,
|
||||
'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None,
|
||||
'remark': line.remake,
|
||||
'reconciliation_time': fields.Datetime.now(),
|
||||
})
|
||||
|
||||
|
||||
|
||||
class PropertyReconciliationLine(models.Model):
|
||||
|
||||
@@ -151,7 +151,7 @@ class PurchaseLowLine(models.Model):
|
||||
product_id = fields.Many2one('product.product', string="物品名称")
|
||||
brand = fields.Char(string="品牌")
|
||||
specs = fields.Char(string="规格")
|
||||
name = fields.Text(string="描述", default=lambda self: self.product_id.display_name if self.product_id else False )
|
||||
name = fields.Text(string="描述")
|
||||
product_packaging_id = fields.Many2one('product.packaging', string="包装")
|
||||
taxes_id = fields.Many2one('account.tax', string='税项')
|
||||
number = fields.Integer(string="数量")
|
||||
|
||||
Reference in New Issue
Block a user