From 36153e5ca1c3547c33347080292c70d3aa68b477 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Thu, 2 Jan 2025 18:30:39 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../models/property_lease_contract.py | 2 +-
.../views/property_lease_contract.xml | 2 +-
.../wizard/property_contract_wizard.py | 39 +++++++++++++++++--
3 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index 69ae1b451..65809ebf6 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -72,7 +72,7 @@ class PropertyLeaseContract(models.Model):
rent_free_period_month = fields.Integer(string="免租期")
rent_free_period_days = fields.Integer(string="免租期")
- breach_time = fields.Date(string="违约计算时点")
+ breach = fields.Integer(string="违约计算时点")
percentage_liquidated_damages = fields.Many2one('yuthon.penalty.setting', string="违约金比例")
date_payment_moth = fields.Integer(string="每月支付日期")
date_payment_day = fields.Integer(string="每日支付日期")
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index 5678773ef..e919bcfb5 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -191,7 +191,7 @@
-
+
diff --git a/yuthon_property_approval/wizard/property_contract_wizard.py b/yuthon_property_approval/wizard/property_contract_wizard.py
index cc5ef2de3..3f58da61a 100644
--- a/yuthon_property_approval/wizard/property_contract_wizard.py
+++ b/yuthon_property_approval/wizard/property_contract_wizard.py
@@ -4,7 +4,7 @@ import xlrd
import base64
import datetime
from datetime import datetime
-
+import pandas as pd
class PropertyContractWizard(models.Model):
_name = 'property.contract.wizard'
@@ -22,7 +22,7 @@ class PropertyContractWizard(models.Model):
sh = book.sheet_by_index(0)
for rx in range(1, sh.nrows):
row = sh.row(rx)
- self.yuthon_contract_data(row)
+ self.yuthon_contract_update(row)
def yuthon_contract_data(self, row):
admin_id = self.env['res.users'].search([('name', '=', row[0].value)])
@@ -98,4 +98,37 @@ class PropertyContractWizard(models.Model):
'lease_id': property_contract_id.id,
'address_id': address_id.id,
}))
- property_contract_id.lease_ids = management_list
\ No newline at end of file
+ property_contract_id.lease_ids = management_list
+
+ def yuthon_contract_update(self, row):
+ contract_date = row[1].value
+ if contract_date:
+ if type(contract_date)== float:
+ contract_date = pd.to_datetime(contract_date, unit='d', origin='1899-12-30')
+ else:
+ contract_date = datetime.strptime(contract_date, '%Y-%m-%d')
+ deposit = row[2].value
+ performance_bonds = row[3].value
+ if performance_bonds:
+ deposit_type = 'performance'
+ elif deposit:
+ deposit_type = 'deposit'
+ else:
+ deposit_type = None
+ contract_id = self.env['property.lease.contract'].search([('contract_code', '=', row[0].value)])
+ if contract_id:
+ contract_id.write({
+ 'contract_date':contract_date,
+ 'deposit':deposit,
+ 'performance_bonds':performance_bonds,
+ 'deposit_type':deposit_type,
+ 'increments_every_few_years': row[4].value,
+ 'increment_percentage':row[5].value,
+ 'increment_price':row[6].value,
+ 'increment_amount':row[7].value,
+ 'rent_free_period_month':row[8].value,
+ 'rent_free_period_days':row[9].value,
+ 'breach': row[10].value,
+ 'first_year_rent': row[11].value,
+ })
+