update access rights in rental payment

This commit is contained in:
esraa 2024-10-24 15:33:46 +03:00
parent 354c56bd26
commit f0894b267d
1 changed files with 2 additions and 2 deletions

View File

@ -204,7 +204,7 @@ class RentPayment(models.Model):
def create_vendor_bill_for_payments(self):
active_ids = self._context.get('active_ids', [])
# action = self.env['rent.payment'].browse(context.get('active_ids', []))
payments_to_invoice = self.env['rent.payment'].browse(active_ids).filtered(
payments_to_invoice = self.env['rent.payment'].sudo().browse(active_ids).filtered(
lambda p: p.state == 'paid' and p.collected_from_company and not p.invoice_commission_id)
vendor_id = int(self.env['ir.config_parameter'].sudo().get_param('property_management.collecting_company_id'))
account_id = int(self.env['ir.config_parameter'].sudo().get_param('property_management.commission_account_id'))
@ -217,7 +217,7 @@ class RentPayment(models.Model):
raise UserError(_("Vendor or Account not configured properly in settings."))
if payments_to_invoice:
vendor_bill = self.env['account.move'].create({
vendor_bill = self.env['account.move'].sudo().create({
'move_type': 'in_invoice',
'invoice_date': today_date, # Set the invoice date,
'partner_id': vendor_id,