添加功能
This commit is contained in:
@@ -8,7 +8,7 @@ class PropertyReconciliationWizard(models.Model):
|
||||
_name = 'property.reconciliation.wizard'
|
||||
_description = '对账弹窗'
|
||||
|
||||
receivable_total = fields.Float(string='应收金额')
|
||||
receivable_total = fields.Float(string='应收金额', compute="_compute_receivable_total", store=True)
|
||||
bank_id = fields.Many2one('property.bank.statements', string='银行流水')
|
||||
account = fields.Char(string='账号')
|
||||
amount_been_reconciled = fields.Float(string='已对金额', store=True)
|
||||
@@ -18,6 +18,11 @@ class PropertyReconciliationWizard(models.Model):
|
||||
initial_total = fields.Float(string='初始金额', default=0.0)
|
||||
reconciliation_line_ids = fields.One2many('property.reconciliation.line', 'reconciliation_id', string='对账明细')
|
||||
|
||||
@api.depends('reconciliation_line_ids')
|
||||
def _compute_receivable_total(self):
|
||||
for rec in self:
|
||||
rec.receivable_total = sum(line.rent for line in rec.reconciliation_line_ids)
|
||||
|
||||
# @api.depends('reconciliation_line_ids')
|
||||
# def _compute_amount(self):
|
||||
# pass
|
||||
@@ -157,12 +162,12 @@ class PropertyReconciliationWizard(models.Model):
|
||||
('tenant_id.name', '!=', False)
|
||||
])
|
||||
if bank_lines:
|
||||
if rec.actual_total == rec.receivable_total:
|
||||
if rec.actual_total > rec.receivable_total:
|
||||
rec.bank_id.registered = rec.actual_total - rec.receivable_total
|
||||
rec.bank_id.bank_state = 'registered'
|
||||
else:
|
||||
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'
|
||||
|
||||
first_line = bank_lines[0]
|
||||
for line in rec.reconciliation_line_ids:
|
||||
|
||||
Reference in New Issue
Block a user