From dbdf994df8e0a618c78de2bb0d383a23f401e67e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 23 Aug 2017 02:58:48 +0200 Subject: [PATCH] [FIX] account: do not show payment data to non-billing users Users will generally not have the right to read Journal Items unless they are members of one of the Accounting/Invoicing groups. Removing the payment-related fields & widgets from the view should let those users view relevant customer invoices (e.g. for Salesmen) without getting an AccessError, due to the underlying access to Journal Items. --- addons/account/models/account_invoice.py | 6 +++--- addons/account/views/account_invoice_view.xml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 0a52dd72bfc..5e6faf9cbdf 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -321,9 +321,9 @@ class AccountInvoice(models.Model): related='partner_id.commercial_partner_id', store=True, readonly=True, help="The commercial entity that will be used on Journal Entries for this invoice") - outstanding_credits_debits_widget = fields.Text(compute='_get_outstanding_info_JSON') - payments_widget = fields.Text(compute='_get_payment_info_JSON') - has_outstanding = fields.Boolean(compute='_get_outstanding_info_JSON') + outstanding_credits_debits_widget = fields.Text(compute='_get_outstanding_info_JSON', groups="account.group_account_invoice") + payments_widget = fields.Text(compute='_get_payment_info_JSON', groups="account.group_account_invoice") + has_outstanding = fields.Boolean(compute='_get_outstanding_info_JSON', groups="account.group_account_invoice") _sql_constraints = [ ('number_uniq', 'unique(number, company_id, journal_id, type)', 'Invoice Number must be unique per Company!'), diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index 2160872d84a..b2d4f2c0fd4 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -224,7 +224,7 @@