[FIX] account, sale: avoid error when internal user (no accounting
permissions) edit information at /my/account Issue: Internal user cannot edit their information (email, street,...) at portal without permissions in the accounting Analyze: Because the method `can_edit_vat` has a search from the account.move model, it causes an error Fix: Use sudo to avoid error when searching closes odoo/odoo#138291 X-original-commit: eb9505375483d18cf21fbaf8e5a60398d5c041c5 Signed-off-by: Laurent Smet (las) <las@odoo.com>
This commit is contained in:
@@ -658,7 +658,7 @@ class ResPartner(models.Model):
|
||||
|
||||
def _has_invoice(self):
|
||||
self.ensure_one()
|
||||
invoice = self.env['account.move'].search([
|
||||
invoice = self.env['account.move'].sudo().search([
|
||||
('move_type', 'in', ['out_invoice', 'out_refund']),
|
||||
('partner_id', 'child_of', self.commercial_partner_id.id),
|
||||
('state', '=', 'posted')
|
||||
|
||||
@@ -38,7 +38,7 @@ class ResPartner(models.Model):
|
||||
|
||||
def _has_order(self):
|
||||
self.ensure_one()
|
||||
sale_order = self.env['sale.order'].search([
|
||||
sale_order = self.env['sale.order'].sudo().search([
|
||||
('partner_id', 'child_of', self.commercial_partner_id.id),
|
||||
('state', 'in', ['sent', 'sale'])
|
||||
], limit=1)
|
||||
|
||||
Reference in New Issue
Block a user