添加功能
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom" string="应收账单" decoration-success="is_reconciliation == True" limit="15" delete="false">
|
||||
<field name="acc_type" string=" "/>
|
||||
<field name="management_type_id" readonly="0"/>
|
||||
<field name="due_date" readonly="0" width="300px" required="1"/>
|
||||
<field name="due_date_end" readonly="0"/>
|
||||
<field name="payout_date" readonly="0"/>
|
||||
@@ -13,12 +14,11 @@
|
||||
<field name="delivered1" readonly="0"/>
|
||||
<field name="submitted" options='{"fg_color": "red: submitted != false;" }'/>
|
||||
<field name="number_of_payments"/>
|
||||
<field name="management_type_id" readonly="0"/>
|
||||
<field name="remark"/>
|
||||
<field name="multiplier" column_invisible="1"/>
|
||||
<field name="is_push" optional="hide" readonly="0"/>
|
||||
<field name="reconciliation_time" optional="hide" readonly="0"/>
|
||||
<field name="create_time" readonly="0"/>
|
||||
<field name="remark"/>
|
||||
<field name="last_update_time" optional="hide" readonly="0"/>
|
||||
<field name="is_invalid" column_invisible="1"/>
|
||||
<field name="void_date" column_invisible="1"/>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
'views/property_eligibility.xml',
|
||||
'views/yuthon_property_ledger_views.xml',
|
||||
'views/property_lessee_analysis_viwes.xml',
|
||||
'views/property_bills_list_views.xml',
|
||||
'views/property_fitment.xml',
|
||||
'views/property_information.xml',
|
||||
'views/property_inventory_table.xml',
|
||||
@@ -93,6 +94,7 @@
|
||||
'wizard/contract_signature_wizard_viwes.xml',
|
||||
'wizard/penalty_line_wizard_viwes.xml',
|
||||
'wizard/build_pop_wizard_viwes.xml',
|
||||
'wizard/property_bills_wizard_views.xml',
|
||||
'wizard/property_meeting_wizard_views.xml',
|
||||
'views/property_menu_all.xml',
|
||||
],
|
||||
|
||||
@@ -59,4 +59,5 @@ from . import yuthon_property_ledger
|
||||
from . import payment_process
|
||||
from . import contract_accounts_receivable
|
||||
from . import property_bills_payable
|
||||
from . import property_payment_notice
|
||||
from . import property_payment_notice
|
||||
from . import property_bills_list
|
||||
@@ -0,0 +1,31 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class PropertyBillsList(models.Model):
|
||||
_name = 'property.bills.list'
|
||||
_description = '应收账单'
|
||||
|
||||
management_type_id = fields.Many2one('yuthon.management.type', string='类型')
|
||||
due_date = fields.Date(string='应付日期')
|
||||
actual_date = fields.Date(string='实付日期')
|
||||
amount = fields.Float(string='应付')
|
||||
amount_actual = fields.Float(string='实付')
|
||||
contract_id = fields.Many2one('property.lease.contract', string="合同编号")
|
||||
lessee_id = fields.Many2one(related="contract_id.lessee_id", string="承租方", store=True)
|
||||
property_name = fields.Char(related='contract_id.property_name', string="物业信息")
|
||||
|
||||
def action_pay(self):
|
||||
return {
|
||||
'name': '支付账单弹窗',
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'property.bills.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_bills_list_id': self.id,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,9 +19,13 @@ class PropertyBillsPayable(models.Model):
|
||||
lease_contract_id = fields.Many2one('property.lease.contract', string="合同")
|
||||
property_name = fields.Char(related='lease_contract_id.property_name', string="物业信息", index=True)
|
||||
lessee_id = fields.Many2one(related="lease_contract_id.lessee_id", string='承租方', index=True)
|
||||
due_date = fields.Date('应付日期')
|
||||
amount_payable = fields.Float('应付金额')
|
||||
deduction_amount = fields.Float('扣除金额')
|
||||
actual_amount = fields.Float('实付金额')
|
||||
remake = fields.Text(string='备注')
|
||||
remarks = fields.Text(string='正文')
|
||||
document_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
bills_line_ids = fields.One2many('property.bills.line', 'payable_id', string="费用明细")
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
work_end = fields.Boolean(string="结束")
|
||||
|
||||
@@ -31,23 +35,22 @@ class PropertyBillsPayable(models.Model):
|
||||
self_users_ids = fields.Many2many('res.users', string="当前经办人",
|
||||
default=lambda self: [(6, 0, [self.env.user.id])])
|
||||
|
||||
@api.onchange('amount_payable', 'deduction_amount')
|
||||
def _onchange_amount_payable(self):
|
||||
if self.amount_payable and self.deduction_amount:
|
||||
self.actual_amount = self.amount_payable - self.deduction_amount
|
||||
|
||||
def end_approval(self):
|
||||
self.write({'work_end': True})
|
||||
receivable = self.env['property.accounts.receivable'].search([('contract_id', '=', self.lease_contract_id.id),
|
||||
('management_type_id.name', '=', '押金')
|
||||
])
|
||||
if receivable:
|
||||
receivable.write({'has_date': fields.Date.today()})
|
||||
self.lease_contract_id.contact_state = 'settle'
|
||||
self.lease_contract_id.compute_is_has()
|
||||
|
||||
management_type_id = self.env['yuthon.management.type'].search([('name', '=', '押金')], limit=1)
|
||||
self.env['property.bills.list'].create({
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': management_type_id.id,
|
||||
'amount': self.amount_payable,
|
||||
'amount_actual': self.actual_amount,
|
||||
'contract_id': self.lease_contract_id.id,
|
||||
})
|
||||
|
||||
class PropertyBillsLine(models.Model):
|
||||
_name = 'property.bills.line'
|
||||
_description = '账单明细'
|
||||
|
||||
payable_id = fields.Many2one('property.bills.payable', string='关联应付账单')
|
||||
due_date = fields.Date('应付日期')
|
||||
date_actual = fields.Date('实付日期')
|
||||
management_type_id = fields.Many2one('yuthon.management.type', string='类型')
|
||||
original_amount = fields.Float('金额')
|
||||
|
||||
@@ -417,11 +417,8 @@ class PropertyLeaseContract(models.Model):
|
||||
'context': {
|
||||
'default_lease_contract_id': record.id,
|
||||
'default_name': f'{record.contract_code}退押金申请',
|
||||
'default_bills_line_ids': [(0, 0, {
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': management_type_id.id,
|
||||
'original_amount': record.deposit
|
||||
})]
|
||||
'default_amount_payable': record.deposit,
|
||||
'default_actual_amount': record.deposit,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ class PropertyLeaseRenewal(models.Model):
|
||||
remake = fields.Text(string="备注")
|
||||
|
||||
receivables_ids = fields.One2many('early.receivables.line', 'renewal_id', string='应收明细')
|
||||
bills_record_id = fields.Many2one('property.bills.payable', string='应付账单流程')
|
||||
|
||||
@api.onchange('refund_amount')
|
||||
def _onchange_refund_amount(self):
|
||||
@@ -148,6 +147,7 @@ class PropertyLeaseRenewal(models.Model):
|
||||
management_type_id = rec.env["yuthon.management.type"].search([('name', '=', '更名费')])
|
||||
if not management_type_id:
|
||||
management_type_id = rec.env["yuthon.management.type"].create({'name': '更名费'})
|
||||
|
||||
self.env['property.accounts.receivable'].create({
|
||||
'contract_id': new_contract.id,
|
||||
'original_amount': rec.fee,
|
||||
@@ -183,14 +183,15 @@ class PropertyLeaseRenewal(models.Model):
|
||||
if rec.receivables_ids:
|
||||
refund_lines = rec.receivables_ids.filtered(lambda l: l.refund_amount > 0)
|
||||
bills_line_list = []
|
||||
soong_workflow_line_list = []
|
||||
# 除押金的明细
|
||||
if refund_lines:
|
||||
for refund_line in refund_lines:
|
||||
bills_line_list.append((0, 0, {
|
||||
bills_line_list.append({
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': refund_line.management_type_id.id,
|
||||
'original_amount': refund_line.refund_amount,
|
||||
}))
|
||||
'amount': refund_line.refund_amount,
|
||||
'contract_id': rec.contract_id.id,
|
||||
})
|
||||
|
||||
if rec.is_full_refund:
|
||||
deposit_management_type = self.env['yuthon.management.type'].search(
|
||||
@@ -199,19 +200,12 @@ class PropertyLeaseRenewal(models.Model):
|
||||
)
|
||||
deposit_amount = rec.deposit if rec.is_full_refund else rec.refund_amount
|
||||
if deposit_amount > 0:
|
||||
bills_line_list.append((0, 0, {
|
||||
bills_line_list.append({
|
||||
'due_date': fields.Date.today(),
|
||||
'management_type_id': deposit_management_type.id,
|
||||
'original_amount': deposit_amount,
|
||||
}))
|
||||
|
||||
bills_payable = self.env['property.bills.payable'].create({
|
||||
'code': self.env['ir.sequence'].next_by_code('property_bills_payable_code'),
|
||||
'lease_contract_id': rec.contract_id.id,
|
||||
'name': f'{rec.contract_id.contract_code}应付单',
|
||||
'create_uid': self.env.uid,
|
||||
'bills_line_ids': bills_line_list
|
||||
})
|
||||
'amount': deposit_amount,
|
||||
'contract_id': rec.contract_id.id,
|
||||
})
|
||||
|
||||
if not rec.is_full_refund:
|
||||
start_time = datetime.combine(rec.early_quitting_date, datetime.min.time().replace(hour=8, minute=00))
|
||||
@@ -222,17 +216,9 @@ class PropertyLeaseRenewal(models.Model):
|
||||
'remake': f'合同为{rec.contract_id.contract_code}{rec.remake}',
|
||||
})
|
||||
|
||||
workflow_record_id = self.env['soong.workflow.record'].search([
|
||||
('code', '=', rec.code),
|
||||
('res_id', '=', rec.id),
|
||||
])
|
||||
soong_workflow_line_list.append((0, 0, {
|
||||
'model': 'property.bills.payable',
|
||||
'res_id': bills_payable.id,
|
||||
'workflow_record_id': workflow_record_id.id
|
||||
}))
|
||||
self.bills_record_id = bills_payable.id
|
||||
bills_payable.soong_record_ids = soong_workflow_line_list
|
||||
# 创建应付账单
|
||||
if bills_line_list:
|
||||
self.env['property.bills.list'].create(bills_line_list)
|
||||
|
||||
# 原有作废/减免逻辑保留
|
||||
for receivable_id in rec.receivables_ids:
|
||||
|
||||
@@ -120,4 +120,6 @@ access_early_receivables_line, early_receivables_line,model_early_receivables_li
|
||||
access_property_bills_payable,property_bills_payable,model_property_bills_payable,base.group_user,1,1,1,1
|
||||
access_property_bills_line,property_bills_line,model_property_bills_line,base.group_user,1,1,1,1
|
||||
access_property_payment_notice,property_payment_notice,model_property_payment_notice,base.group_user,1,1,1,1
|
||||
access_print_payment_wizard,print_payment_wizard,model_print_payment_wizard,base.group_user,1,1,1,1
|
||||
access_print_payment_wizard,print_payment_wizard,model_print_payment_wizard,base.group_user,1,1,1,1
|
||||
access_property_bills_list,property_bills_list,model_property_bills_list,base.group_user,1,1,1,1
|
||||
access_property_bills_wizard,property_bills_wizard,model_property_bills_wizard,base.group_user,1,1,1,1
|
||||
|
@@ -410,7 +410,7 @@
|
||||
<!-- <field name="company_id1"/>-->
|
||||
<field name="contract_id" string="合同编号"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='remark']" position="after">
|
||||
<xpath expr="//field[@name='create_time']" position="after">
|
||||
<field name="charging_range"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='receivable_log']" position="after">
|
||||
@@ -432,6 +432,8 @@
|
||||
<field name="contract_id" string="合同"/>
|
||||
<field name="company_id"/>
|
||||
<field name="original_amount"/>
|
||||
<field name="tenure_type"/>
|
||||
<field name="due_date"/>
|
||||
<group expand="0" string="group_by">
|
||||
<filter name="group_company_id" string="公司" context="{'group_by':'company_id'}"/>
|
||||
<filter name="group_is_reconciliation" string="对账" context="{'group_by':'is_reconciliation'}"/>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_property_bills_list_tree" model="ir.ui.view">
|
||||
<field name="name">property.bills.list.tree</field>
|
||||
<field name="model">property.bills.list</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="应收账单" editable="bottom">
|
||||
<field name="due_date"/>
|
||||
<field name="actual_date"/>
|
||||
<field name="management_type_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="amount_actual"/>
|
||||
<field name="contract_id"/>
|
||||
<field name="property_name"/>
|
||||
<field name="lessee_id"/>
|
||||
<button name="action_pay" string="核销" type="object" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_property_bills_list_action" model="ir.actions.act_window">
|
||||
<field name="name">应收账单</field>
|
||||
<field name="res_model">property.bills.list</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<field name="name">property.bills.payable.tree</field>
|
||||
<field name="model">property.bills.payable</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="应付账单">
|
||||
<tree string="应付账单审批">
|
||||
<field name="lease_contract_id"/>
|
||||
<field name="property_name"/>
|
||||
<field name="lessee_id"/>
|
||||
@@ -15,7 +15,7 @@
|
||||
<field name="name">property.bills.payable.form</field>
|
||||
<field name="model">property.bills.payable</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="应付账单">
|
||||
<form string="应付账单审批">
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
|
||||
invisible="urgency_level != 'normal'"/>
|
||||
@@ -52,27 +52,18 @@
|
||||
<field name="lease_contract_id"/>
|
||||
<field name="property_name"/>
|
||||
<field name="lessee_id"/>
|
||||
<field name="amount_payable"/>
|
||||
<field name="deduction_amount"/>
|
||||
<field name="remake" invisible="not deduction_amount"/>
|
||||
<field name="actual_amount"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="账单明细">
|
||||
<field name="bills_line_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="payable_id" column_invisible="1"/>
|
||||
<field name="due_date"/>
|
||||
<field name="date_actual"/>
|
||||
<field name="management_type_id"/>
|
||||
<field name="original_amount"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_property_bills_payable_action" model="ir.actions.act_window">
|
||||
<field name="name">应付账单</field>
|
||||
<field name="name">应付账单审批</field>
|
||||
<field name="res_model">property.bills.payable</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
@@ -94,9 +94,6 @@
|
||||
<field name="early_explain" invisible="renewal_type != 'early_checkout'"/>
|
||||
<field name="document_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="bills_record_id" invisible="not bills_record_id" context="{'form_view_ref': 'yuthon_property_approval.view_property_bills_payable_form'}"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="应收明细" invisible="renewal_type != 'early_checkout'">
|
||||
<field name="receivables_ids" string=" ">
|
||||
|
||||
@@ -12,4 +12,5 @@ from . import binding_information_wizard
|
||||
from . import contract_signature_wizard
|
||||
from . import build_pop_wizard
|
||||
from . import penalty_line_wizard
|
||||
from . import print_payment_wizard
|
||||
from . import print_payment_wizard
|
||||
from . import property_bills_wizard
|
||||
@@ -0,0 +1,23 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class PropertyBillsWizard(models.TransientModel):
|
||||
_name = 'property.bills.wizard'
|
||||
_description = '应收账单弹窗'
|
||||
|
||||
bills_list_id = fields.Many2one('property.bills.list', string="账单")
|
||||
actual_date = fields.Date(string='实付日期')
|
||||
|
||||
def confirm(self):
|
||||
self.bills_list_id.actual_date = self.actual_date
|
||||
self.bills_list_id.state = 'paid'
|
||||
receivable = self.env['property.accounts.receivable'].search([('contract_id', '=', self.bills_list_id.contract_id.id),
|
||||
('management_type_id.name', '=', '押金')
|
||||
])
|
||||
if receivable:
|
||||
receivable.write({'has_date': fields.Date.today()})
|
||||
self.bills_list_id.contract_id.contact_state = 'settle'
|
||||
self.lease_contract_id.compute_is_has()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="property_bills_wizard_form" model="ir.ui.view">
|
||||
<field name="name">应收账单弹窗</field>
|
||||
<field name="model">property.bills.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="bills_list_id" invisible="1"/>
|
||||
<field name="actual_date"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
|
||||
|
||||
@@ -845,7 +845,7 @@
|
||||
id="property_bills_payable_menu"
|
||||
parent="yuthon_financial_management_menu"
|
||||
name="应付账单"
|
||||
action="yuthon_property_approval.view_property_bills_payable_action"
|
||||
action="yuthon_property_approval.view_property_bills_list_action"
|
||||
sequence="4"/>
|
||||
<menuitem id="yuthon_subject_form_menu"
|
||||
sequence="5"
|
||||
|
||||
Reference in New Issue
Block a user