diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 8ff9be67f..923bde4da 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -276,6 +276,13 @@ class PropertyAccountsReceivable(models.Model): rent_owed = fields.Float(string="欠租金额") per_day = fields.Float(string="每天违约金(元/天)") + def initialize_reconciliation(self): + receivable_ids = self.env["property.accounts.receivable"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for receivable in receivable_ids: + receivable.delivered1 = receivable.submitted + receivable.submitted = 0 + receivable.is_reconciliation = True @api.model_create_multi def create(self, vals_list): @@ -398,7 +405,7 @@ class PropertyDepositList(models.Model): _inherit = 'property.deposit.list' contract_id = fields.Many2one('property.lease.contract', string="合同") - due_date = fields.Date(related='contract_id.actual_start_time', string='应收日期') + due_date = fields.Date(related='contract_id.actual_start_time', string='应收日期', store=True) posit_type = fields.Selection([('deposit', '押金'), ('performance_bonds', '经营履约保证金'), ('utility_bills', '水电费'), ('decorate', '装修')], string="保证金类型") original_amount = fields.Float(string="金额") @@ -411,6 +418,7 @@ class PropertyDepositList(models.Model): self.env['property.accounts.receivable'].create({ 'contract_id': rec.contract_id.id, 'property_id': rec.property_id.id, + 'due_date' : rec.due_date, 'lessee_id':rec.contract_id.lessee_id.id if rec.contract_id.lessee_id else None, 'original_amount' : rec.original_amount, 'create_time': datetime.now(), diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml index 1569085a3..6b659910b 100644 --- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml +++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml @@ -414,6 +414,13 @@ + + 初始化对账 + + + code + action = model.initialize_reconciliation() + 应收账单 property.accounts.receivable