[FIX] sale, account_payment: fix saleman payment transactions access error

Since odoo/odoo@2b1e2abda3 user need at least 'Account / Billing'
access to read payment.transaction, that not the case for most salesman.

So for user that don't have 'Account / Billing', this commit do:

- compute the 'amount_paid' as superuser
  (fixing "Generate Payment Link" wizard access errors)

- hide "Payment Transaction" smart-button on invoice

closes odoo/odoo#127835

X-original-commit: ad2c3a873a926ac8c94d014af24ed400b493493e
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Xavier Alt (xal) <xal@odoo.com>
This commit is contained in:
Xavier ALT
2023-07-10 08:56:27 +02:00
parent 92f030597b
commit 4b2106298d
2 changed files with 2 additions and 1 deletions
@@ -27,6 +27,7 @@
<xpath expr="//div[@name='button_box']" position="inside">
<field name="transaction_ids" invisible="1" />
<button name="action_view_payment_transactions" type="object"
groups="account.group_account_invoice"
class="oe_stat_button" icon="fa-money"
attrs="{'invisible': [('transaction_ids', '=', [])]}">
<div class="o_stat_info">
+1 -1
View File
@@ -238,7 +238,7 @@ class SaleOrder(models.Model):
compute='_compute_authorized_transaction_ids',
copy=False,
compute_sudo=True)
amount_paid = fields.Float(compute='_compute_amount_paid')
amount_paid = fields.Float(compute='_compute_amount_paid', compute_sudo=True)
# UTMs - enforcing the fact that we want to 'set null' when relation is unlinked
campaign_id = fields.Many2one(ondelete='set null')