From ca06d3ddb8c73b9c46ebbf2cd4e8544b338ea642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 4 Aug 2023 17:38:37 +0200 Subject: [PATCH] Create different menu entries for receivable and payable payments --- modules/account_payment/payment.py | 9 +++ modules/account_payment/payment.xml | 107 +++++++++++++++++++++------- 2 files changed, 90 insertions(+), 26 deletions(-) diff --git a/modules/account_payment/payment.py b/modules/account_payment/payment.py index 57a6725cb4..0b38a427f3 100644 --- a/modules/account_payment/payment.py +++ b/modules/account_payment/payment.py @@ -527,6 +527,15 @@ class Payment(Workflow, ModelSQL, ModelView): field_name = 'process_method' return Journal.fields_get([field_name])[field_name]['selection'] + @classmethod + def view_attributes(cls): + context = Transaction().context + attributes = super().view_attributes() + if context.get('kind') == 'receivable': + attributes.append( + ('/tree//button[@name="approve"]', 'tree_invisible', True)) + return attributes + @classmethod def copy(cls, payments, default=None): if default is None: diff --git a/modules/account_payment/payment.xml b/modules/account_payment/payment.xml index d0975d0fac..45d161e90b 100644 --- a/modules/account_payment/payment.xml +++ b/modules/account_payment/payment.xml @@ -242,58 +242,113 @@ this repository contains the full copyright notices and license terms. --> - + + + Payable Payments + account.payment + + + + + + + + + + + + + + Draft - + - + To Approve - + - + - + To Process - + - + - + Processing - + - - Succeeded - - - - - - Failed - - - - - + All - + + id="menu_payment_form_payable"/> + + + Receivable Payments + account.payment + + + + + + + + + + + + + + + Draft + + + + + + + To Process + + + + + + + Processing + + + + + + + All + + + + + + Payments