Update rent_payment

This commit is contained in:
zainab2097 2024-09-08 16:09:45 +03:00 committed by GitHub
parent 4f54eee062
commit 756ccfa088
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 14 deletions

View File

@ -215,20 +215,20 @@ class RentPayment(models.Model):
if not vendor_id or not account_id: if not vendor_id or not account_id:
raise UserError(_("Vendor or Account not configured properly in settings.")) raise UserError(_("Vendor or Account not configured properly in settings."))
if not payments_to_invoice: if payments_to_invoice:
raise UserError(_("No eligible payments selected. there are payment not valid conditions")) vendor_bill = self.env['account.move'].create({
'move_type': 'in_invoice',
vendor_bill = self.env['account.move'].create({ 'invoice_date': today_date, # Set the invoice date,
'move_type': 'in_invoice', 'partner_id': vendor_id,
'invoice_date': today_date, # Set the invoice date, 'invoice_line_ids': [(0, 0, {
'partner_id': vendor_id, 'name': name+' - '+str(today_date),
'invoice_line_ids': [(0, 0, { 'quantity': 1,
'name': name+' - '+str(today_date), 'price_unit': total_commission_amount,
'quantity': 1, 'account_id': account_id
'price_unit': total_commission_amount, })],
'account_id': account_id })
})], else:
}) raise UserError(_("No eligible payments selected. there are payment not valid conditions"))
for payment in payments_to_invoice: for payment in payments_to_invoice:
payment.invoice_commission_id = vendor_bill.id payment.invoice_commission_id = vendor_bill.id