diff --git a/yuthon_property_approval/models/property_bills_payable.py b/yuthon_property_approval/models/property_bills_payable.py index 945103711..7af44e18f 100644 --- a/yuthon_property_approval/models/property_bills_payable.py +++ b/yuthon_property_approval/models/property_bills_payable.py @@ -44,7 +44,7 @@ def rmb_upper(value): class PropertyBillsPayable(models.Model): _name = 'property.bills.payable' - _description = '应付账单申请' + _description = '付款申请单' _inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin'] name = fields.Char(string='标题') @@ -55,6 +55,7 @@ class PropertyBillsPayable(models.Model): urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', default='normal') 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('应付日期') @@ -86,6 +87,7 @@ class PropertyBillsPayable(models.Model): payee_bank = fields.Char(string='开户行') payee_account = fields.Char(string='银行账号') payment_type_id = fields.Many2one('property.payment.type', string='付款类型') + payment_date = fields.Date(string='支付日期') def _get_default_name_title(self): return '付款申请单' @@ -119,14 +121,23 @@ class PropertyBillsPayable(models.Model): ]) existing_bill = self.env['property.bills.list'].search(domain, limit=1) if not existing_bill: - self.env['property.bills.list'].create({ + vals = { '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, 'workflow_record_id': workflow_record_id.id, - }) + } + if self.payment_date: + vals['actual_date'] = self.payment_date + bill = self.env['property.bills.list'].create(vals) + if self.payment_date: + wizard = self.env['property.bills.wizard'].create({ + 'bills_list_id': bill.id, + 'actual_date': self.payment_date, + }) + wizard.confirm() class PropertyBillsLine(models.Model): _name = 'property.bills.line' diff --git a/yuthon_property_approval/views/property_bills_payable_views.xml b/yuthon_property_approval/views/property_bills_payable_views.xml index ac34efe60..79925d42f 100644 --- a/yuthon_property_approval/views/property_bills_payable_views.xml +++ b/yuthon_property_approval/views/property_bills_payable_views.xml @@ -48,6 +48,7 @@ +