添加功能

This commit is contained in:
zhou
2025-07-31 21:09:11 +08:00
parent 7a96e0606b
commit ddf14d0ffc
4 changed files with 65 additions and 46 deletions
@@ -147,49 +147,49 @@ class PropertyBankStatements(models.Model):
def _get_reconciliation_vals(self, record):
if record.name:
dt = datetime.strptime(str(self.start_time), '%Y-%m-%d %H:%M:%S').date()
last_day = dt.replace(day=1) + relativedelta(months=1) - relativedelta(days=1)
first_day = dt.replace(day=1)
last_day = first_day + relativedelta(months=1) - relativedelta(days=1)
total_rent_month = 0
bank_lines = self.env['property.bank.line'].search([
('bank', '=', self.name),
('tenant_id.name', '!=', False),
# 应收租金
rent_ids = self.env['property.accounts.receivable'].search([
('lessee_id.name', '=', record.name_account),
('management_type_id.name', '=', '租金'),
('is_reconciliation', '=', False),
('due_date', '>=', fields.Date.to_string(first_day)),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收押金
deposit_ids = self.env['property.accounts.receivable'].search([
('lessee_id.name', '=', record.name_account),
('management_type_id.name', '=', '押金'),
('is_reconciliation', '=', False),
('due_date', '>=', fields.Date.to_string(first_day)),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收管理费
management_ids = self.env['property.accounts.receivable'].search([
('lessee_id.name', '=', record.name_account),
('management_type_id.name', '=', '管理费'),
('is_reconciliation', '=', False),
('due_date', '>=', fields.Date.to_string(first_day)),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收水费
water_ids = self.env['property.accounts.receivable'].search([
('lessee_id.name', '=', record.name_account),
('management_type_id.name', '=', '水费'),
('is_reconciliation', '=', False),
('due_date', '>=', fields.Date.to_string(first_day)),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收电费
electricity_ids = self.env['property.accounts.receivable'].search([
('lessee_id.name', '=', record.name_account),
('management_type_id.name', '=', '电费'),
('is_reconciliation', '=', False),
('due_date', '>=', fields.Date.to_string(first_day)),
('due_date', '<=', fields.Date.to_string(last_day)),
])
if bank_lines:
tenant_id = bank_lines[0].tenant_id
# 应收租金
rent_ids = self.env['property.accounts.receivable'].search([
('lessee_id', '=', tenant_id.id),
('management_type_id.name', '=', '租金'),
('is_reconciliation', '=', False),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收押金
deposit_ids = self.env['property.accounts.receivable'].search([
('lessee_id', '=', tenant_id.id),
('management_type_id.name', '=', '押金'),
('is_reconciliation', '=', False),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收管理费
management_ids = self.env['property.accounts.receivable'].search([
('lessee_id', '=', tenant_id.id),
('management_type_id.name', '=', '管理费'),
('is_reconciliation', '=', False),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收水费
water_ids = self.env['property.accounts.receivable'].search([
('lessee_id', '=', tenant_id.id),
('management_type_id.name', '=', '水费'),
('is_reconciliation', '=', False),
('due_date', '<=', fields.Date.to_string(last_day)),
])
# 应收电费
electricity_ids = self.env['property.accounts.receivable'].search([
('lessee_id', '=', tenant_id.id),
('management_type_id.name', '=', '电费'),
('is_reconciliation', '=', False),
('due_date', '<=', fields.Date.to_string(last_day)),
])
def create_reconciliation_vals(ids, collection_type_val, sequence_val):
"""
@@ -122,10 +122,20 @@ class PropertyReconciliationWizard(models.Model):
# 跳过金额为0的行
if line.amount == 0 and line.collection_type != 'penalty':
continue
domain = [('lessee_id', '=', first_line.tenant_id.id),
('is_reconciliation', '=', False),
('is_suspend', '=', False),
]
due_date = datetime.strptime(line.due_date, '%Y-%m-%d')
first_day = due_date.replace(day=1)
last_day = (first_day + relativedelta(months=1)) - relativedelta(days=1)
first_day_str = first_day.strftime('%Y-%m-%d')
last_day_str = last_day.strftime('%Y-%m-%d')
domain = [
('lessee_id', '=', first_line.tenant_id.id),
('is_reconciliation', '=', False),
('is_suspend', '=', False),
('due_date', '>=', first_day_str),
('due_date', '<=', last_day_str),
]
# 如果有物业信息
if line.property_id:
domain.append(('property_id', '=', line.property_id.id))
@@ -243,6 +243,9 @@
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<tree string="薪资审定">
<header>
<button name="all_put_release" type="object" string="推送" class="oe_highlight"/>
</header>
<field name="employee_id" string="姓名" readonly="1" options="{'no_open': True}"/>
<field name="date_of_entry"/>
<field name="bank_account_id"/>
@@ -310,6 +313,9 @@
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<tree string="薪资审定">
<header>
<button name="all_put_release" type="object" string="推送" class="oe_highlight"/>
</header>
<field name="employee_id" string="姓名" readonly="1" options="{'no_open': True}"/>
<field name="date_of_entry"/>
<field name="bank_account_id"/>
@@ -364,6 +370,9 @@
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<tree string="薪资审定">
<header>
<button name="all_put_release" type="object" string="推送" class="oe_highlight"/>
</header>
<field name="employee_id" string="姓名" readonly="1" options="{'no_open': True}"/>
<field name="date_of_entry"/>
<field name="bank_account_id"/>
+1 -1
View File
@@ -70,7 +70,7 @@ class PutSalaryWizard(models.TransientModel):
('payslip_run_id', '=', run.id)
])
if all(payslip.is_salary_push and not payslip.is_salary_release for payslip in run_payslips):
run.run_stage = 'individual_tax'
run.run_stage = 'to_be_signed'
class ReturnSalaryWizard(models.TransientModel):