添加功能
This commit is contained in:
@@ -18,25 +18,25 @@ class ContractAccountsReceivable(models.Model):
|
||||
store=True
|
||||
)
|
||||
|
||||
@api.onchange('contract_id')
|
||||
def onchange_contract_id(self):
|
||||
accounts = self.env['property.accounts.receivable'].search([('contract_id', '=', self.contract_id.id)])
|
||||
receivable_list = []
|
||||
for account in accounts:
|
||||
receivable_list.append([0, 0, {
|
||||
'contract_accounts_id': account.id,
|
||||
'management_type_id': account.management_type_id.id,
|
||||
'last_month_table': account.last_month_table,
|
||||
'this_month_table': account.this_month_table,
|
||||
'ratio': account.ratio,
|
||||
'billable_quantity': account.billable_quantity,
|
||||
'due_date': account.due_date,
|
||||
'due_date_end': account.due_date_end,
|
||||
'original_amount': account.original_amount,
|
||||
'pre_collection': account.pre_collection,
|
||||
'remark': account.remark,
|
||||
}])
|
||||
self.contract_accounts_ids = receivable_list
|
||||
# @api.onchange('contract_id')
|
||||
# def onchange_contract_id(self):
|
||||
# accounts = self.env['property.accounts.receivable'].search([('contract_id', '=', self.contract_id.id)])
|
||||
# receivable_list = []
|
||||
# for account in accounts:
|
||||
# receivable_list.append([0, 0, {
|
||||
# 'contract_accounts_id': account.id,
|
||||
# 'management_type_id': account.management_type_id.id,
|
||||
# 'last_month_table': account.last_month_table,
|
||||
# 'this_month_table': account.this_month_table,
|
||||
# 'ratio': account.ratio,
|
||||
# 'billable_quantity': account.billable_quantity,
|
||||
# 'due_date': account.due_date,
|
||||
# 'due_date_end': account.due_date_end,
|
||||
# 'original_amount': account.original_amount,
|
||||
# 'pre_collection': account.pre_collection,
|
||||
# 'remark': account.remark,
|
||||
# }])
|
||||
# self.contract_accounts_ids = receivable_list
|
||||
|
||||
|
||||
@api.depends(
|
||||
|
||||
@@ -615,19 +615,19 @@ class PropertyAccountsReceivable(models.Model):
|
||||
'contract_ids': contract_id_value,
|
||||
})
|
||||
|
||||
contract_account_map = {}
|
||||
for vals in vals_list:
|
||||
if 'contract_id' in vals and vals['contract_id']:
|
||||
contract_id = vals['contract_id']
|
||||
if contract_id not in contract_account_map:
|
||||
contract_account = self.env['contract.accounts.receivable'].search([
|
||||
('contract_id', '=', contract_id)
|
||||
], limit=1)
|
||||
if not contract_account:
|
||||
contract_account = self.env['contract.accounts.receivable'].create({
|
||||
'contract_id': contract_id
|
||||
})
|
||||
contract_account.onchange_contract_id()
|
||||
# contract_account_map = {}
|
||||
# for vals in vals_list:
|
||||
# if 'contract_id' in vals and vals['contract_id']:
|
||||
# contract_id = vals['contract_id']
|
||||
# if contract_id not in contract_account_map:
|
||||
# contract_account = self.env['contract.accounts.receivable'].search([
|
||||
# ('contract_id', '=', contract_id)
|
||||
# ], limit=1)
|
||||
# if not contract_account:
|
||||
# contract_account = self.env['contract.accounts.receivable'].create({
|
||||
# 'contract_id': contract_id
|
||||
# })
|
||||
# contract_account.onchange_contract_id()
|
||||
|
||||
return records
|
||||
|
||||
|
||||
Reference in New Issue
Block a user