diff --git a/CHANGELOG b/CHANGELOG index 152f0196c7..f2f6225810 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Permit to edit amount for manual payment in processing * Use reference field for statement line relation * Do not create dunning for line with pending payment * Add support for Python 3.10 diff --git a/payment.py b/payment.py index 5e0770b0fc..7c86340265 100644 --- a/payment.py +++ b/payment.py @@ -305,7 +305,13 @@ class Payment(Workflow, ModelSQL, ModelView): date = fields.Date('Date', required=True, states=_STATES, depends=_DEPENDS) amount = Monetary( "Amount", currency='currency', digits='currency', required=True, - states=_STATES, depends=_DEPENDS) + states={ + 'readonly': ~Eval('state').in_( + If(Eval('process_method') == 'manual', + ['draft', 'processing'], + ['draft'])), + }, + depends=['state', 'process_method']) line = fields.Many2One('account.move.line', 'Line', ondelete='RESTRICT', domain=[ ('move.company', '=', Eval('company', -1)), @@ -405,6 +411,13 @@ class Payment(Workflow, ModelSQL, ModelView): 'icon': 'tryton-forward', 'depends': ['state'], }, + 'proceed': { + 'invisible': ( + ~Eval('state').in_(['succeeded', 'failed']) + | (Eval('process_method') != 'manual')), + 'icon': 'tryton-back', + 'depends': ['state', 'process_method'], + }, 'succeed': { 'invisible': ~Eval('state').in_( ['processing', 'failed']), @@ -559,6 +572,7 @@ class Payment(Workflow, ModelSQL, ModelView): return group @classmethod + @ModelView.button @Workflow.transition('processing') def proceed(cls, payments): assert all(p.group for p in payments) diff --git a/payment.xml b/payment.xml index 2e4c7d9ce8..63f97fa98f 100644 --- a/payment.xml +++ b/payment.xml @@ -390,6 +390,16 @@ this repository contains the full copyright notices and license terms. --> + + proceed + Processing + + + + + + + succeed Succeed diff --git a/view/payment_form.xml b/view/payment_form.xml index 017ffe827c..bc078a52b7 100644 --- a/view/payment_form.xml +++ b/view/payment_form.xml @@ -41,6 +41,7 @@ this repository contains the full copyright notices and license terms. -->