添加功能

This commit is contained in:
zhou
2025-03-03 18:05:30 +08:00
parent 72b52f89ee
commit 595a2b82f5
4 changed files with 39 additions and 23 deletions
@@ -26,7 +26,7 @@ class YuthonOnboardApproval(models.Model):
employee_name = fields.Char(string='姓名')
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('ttcj','天投城建'),
('thlc', '天河粮储')], string="甲方")
account = fields.Char(string='账号')
reason = fields.Html(string="正文")
@@ -21,10 +21,21 @@ class PropertyBankStatements(models.Model):
def button_reconciliation(self):
pass
for rec in self:
receivable_id = self.env['property.accounts.receivable'].search([('property_id', '=', rec.property_id.id)])
if receivable_id:
difference_amount = receivable_id.original_amount - rec.original_amount
receivable_id.write({'is_reconciliation': True,
'difference_amount': difference_amount})
def button_all_reconciliation(self):
pass
statements_ids = self.env["property.bank.statements"].browse(self._context.get('active_ids', self._context.get('active_id')))
for statements_id in statements_ids:
receivable_id = self.env['property.accounts.receivable'].search([('property_id', '=', statements_id.property_id.id)])
if receivable_id:
difference_amount = receivable_id.original_amount - statements_id.original_amount
receivable_id.write({'is_reconciliation': True,
'difference_amount': difference_amount})
def unlink(self):
return super().unlink()
@@ -27,33 +27,38 @@ class PropertyStatementsWizard(models.Model):
self.property_bank_statements_data(row)
def property_bank_statements_data(self, row):
if row[0].value:
start_time = pd.to_datetime(row[0].value, unit='d', origin='1899-12-30')
if row[2].value:
start_time = pd.to_datetime(row[2].value, unit='d', origin='1899-12-30')
else:
start_time = None
name = row[0].value
company_id = self.env['yuthon.property.company'].search([('name', '=', row[1].value)])
name = row[2].value
name_account = row[3].value
remake = row[4].value
original_amount = row[5].value
contract_id = self.env['property.lease.contract'].search([('name', '=', row[6].value)])
property_id = self.env['yuthon.property'].search([('name', '=', row[7].value)])
contract_account = row[8].value
contract_penalty = row[9].value
voucher_type = row[10].value
name_account = row[7].value
voucher_type = row[15].value
voucher_type_dict = {'电子转账凭证': 'electronic_transfer', '电汇凭证': 'telegraphic_transfer'}
voucher_type = voucher_type_dict.get(voucher_type)
if name:
bank_id = self.env['property.bank.line'].search([('bank', '=', name)])
if bank_id:
contract_id = self.env['property.lease.contract'].search([('lessee_id', '=', bank_id.tenant_id.id)])
if contract_id:
lease_id = contract_id.lease_ids[0].address_id
else:
lease_id = None
else:
contract_id = None
lease_id = None
else:
contract_id = None
lease_id = None
bank_data = {
'name':name,
'start_time':start_time,
'name': name,
'contract_id':contract_id.id if contract_id else None,
'property_id':lease_id.id if lease_id else None,
'company_id': company_id.id,
'start_time': start_time,
'name_account': name_account,
'remake': remake,
'original_amount': original_amount,
'contract_id': contract_id.id,
'property_id': property_id.id,
'contract_account': contract_account,
'contract_penalty': contract_penalty,
'voucher_type': voucher_type
}
self.env['property.bank.statements'].create(bank_data)
@@ -335,7 +335,7 @@
<field name="contract_id" string="合同编号"/>
</xpath>
<xpath expr="//field[@name='voucher_type']" position="after">
<button name="button_manage" type="object" string="绑定管理" class="btn btn-primary" invisible="not contract_id"/>
<button name="button_manage" type="object" string="绑定管理" class="btn btn-primary" invisible="contract_id"/>
</xpath>
</field>
</record>