添加功能

This commit is contained in:
zhou
2025-06-20 15:49:35 +08:00
parent a4a440b24a
commit 41665a7b74
10 changed files with 46 additions and 27 deletions
+1 -1
View File
@@ -223,7 +223,7 @@ class RoomBooking(models.Model):
'views': [(False, 'form')],
'target': 'new',
'context': {
'default_qrcode_image': qrcode_image,
'efault_default_qrcode_image': qrcode_image,
}
}
return action
@@ -11,8 +11,8 @@ export class CustomStatementsListController extends ListController {
openAllStatementsWizard() {
this.actionService.doAction({
type: 'ir.actions.act_window',
res_model: 'property.statements.wizard',
name: '批量对账',
res_model: 'click.reconciliation.wizard',
name: '一键对账',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
+1
View File
@@ -74,6 +74,7 @@
'wizard/choose_contract_wizard_views.xml',
'wizard/property_reconciliation_wizard_views.xml',
'wizard/property_management_wizard.xml',
'wizard/click_reconciliation_wizard_views.xml',
'wizard/property_rental_wizard_views.xml',
'wizard/property_meeting_wizard_views.xml',
'views/property_menu_all.xml',
@@ -66,7 +66,7 @@ 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()
bank_id = self.env['property.bank.line'].search([('bank', '=', record.name)])
bank_id = self.env['property.bank.line'].search([('bank', '=', record.name)], limit=1)
first_day = dt.replace(day=1)
last_day = first_day + relativedelta(months=1) - relativedelta(days=1)
total_rent_month = 0
@@ -220,19 +220,6 @@ class PropertyBankStatements(models.Model):
all_vals, total_rent_month = self._get_reconciliation_vals(record)
return self._get_context_and_action(record, all_vals, total_rent_month)
def button_all_reconciliation(self):
statements_ids = self.env["property.bank.statements"].browse(self._context.get('active_ids', self._context.get('active_id')))
total_all_vals = []
grand_total_rent_month = 0
for record in statements_ids:
all_vals, total_rent_month = self._get_reconciliation_vals(record)
total_all_vals.extend(all_vals)
grand_total_rent_month += total_rent_month
if statements_ids:
first_record = statements_ids[0]
return self._get_context_and_action(first_record, total_all_vals, grand_total_rent_month)
return None
def put_button(self):
form_id = self.env.ref('yuthon_property_approval.view_property_accounts_approval_form').id
bank_list = []
@@ -97,4 +97,5 @@ access_property_meeting_line,property_meeting_line,model_property_meeting_line,b
access_property_management_line, property_management_line,model_property_management_line,base.group_user,1,1,1,1
access_property_management_line2, property_management_line2,model_property_management_line2,base.group_user,1,1,1,1
access_property_management_wizard, property_management_wizard,model_property_management_wizard,base.group_user,1,1,1,1
access_click_reconciliation_wizard, click_reconciliation_wizard,model_click_reconciliation_wizard,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
97 access_property_management_line2 property_management_line2 model_property_management_line2 base.group_user 1 1 1 1
98 access_property_management_wizard property_management_wizard model_property_management_wizard base.group_user 1 1 1 1
99 access_click_reconciliation_wizard click_reconciliation_wizard model_click_reconciliation_wizard base.group_user 1 1 1 1
100
101
@@ -543,13 +543,6 @@
<button name="button_reconciliation" type="object" string="对账" class="btn btn-primary" invisible="is_reconciliation"/>
</xpath>
</field>
</record>
<record id="all_data_property_bank_statements" model="ir.actions.server">
<field name="name">批量对账</field>
<field name="model_id" ref="yuthon_property.model_property_bank_statements"/>
<field name="binding_model_id" ref="yuthon_property.model_property_bank_statements"/>
<field name="state">code</field>
<field name="code">action = model.button_all_reconciliation()</field>
</record>
<!-- 违约金 -->
<record id="inherit_view_property_penalty_list_tree" model="ir.ui.view">
+2 -1
View File
@@ -5,4 +5,5 @@ from . import property_add_wizard
from . import property_physical_wizard
from . import property_reconciliation_wizard
from . import property_meeting_wizard
from . import property_management_wizard
from . import property_management_wizard
from . import click_reconciliation_wizard
@@ -0,0 +1,17 @@
from odoo import models, fields, api, _, SUPERUSER_ID
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
class ClickReconciliationWizard(models.Model):
_name = 'click.reconciliation.wizard'
message = fields.Text(string='确认信息', readonly=True)
def action_confirm(self):
statements_ids = self.env["property.bank.statements"].search([('bank_state', '=', 'not_reconciled')])
for record in statements_ids:
all_vals, total_rent_month = record._get_reconciliation_vals(record)
# 更新对账状态
if total_rent_month == record.original_amount:
record.bank_state = 'reconciled'
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="click_reconciliation_wizard_form" model="ir.ui.view">
<field name="name">click.reconciliation.wizard.form</field>
<field name="model">click.reconciliation.wizard</field>
<field name="arch" type="xml">
<form string="一键对账">
<group>
<field name="message" string="你确认要一键对账吗" readonly="1"/>
</group>
<footer>
<button name="action_confirm" string="确认" type="object" class="oe_highlight"/>
<button string="取消" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>
@@ -36,8 +36,9 @@ class PropertyReconciliationWizard(models.Model):
remaining_amount -= line.amount # 更新剩余金额
# 检查是否违约
if line.due_date and self.actual_date:
# 计算应收日期的下月1号
if(line.due_date and self.actual_date and
line.collection_type != 'deposit'):
# 计算应收日期的下月1号
next_month_first = (fields.Date.from_string(line.due_date) + relativedelta(months=1)).replace(day=1)
# 如果实收日期晚于下月1号,产生违约