Permit to edit amount for manual payment in processing

Payment processed manually can have mistakes in the amount.
So by going back to processing, the user can edit the amount.

issue11176
review387791003
This commit is contained in:
Cédric Krier committed 2022-03-19 22:31:21 +01:00
1 parent fa653af53c
commit b0e0ee3d52
4 files changed
+27 -1

No files matched your search

+1
View File
@@ -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
+15 -1
View File
@@ -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)
+10
View File
@@ -390,6 +390,16 @@ this repository contains the full copyright notices and license terms. -->
<field name="group" ref="group_payment_approval"/>
</record>
<record model="ir.model.button" id="payment_proceed_button">
<field name="name">proceed</field>
<field name="string">Processing</field>
<field name="model" search="[('model', '=', 'account.payment')]"/>
</record>
<record model="ir.model.button-res.group" id="payment_proceed_button_group_payment">
<field name="button" ref="payment_proceed_button"/>
<field name="group" ref="group_payment"/>
</record>
<record model="ir.model.button" id="payment_succeed_button">
<field name="name">succeed</field>
<field name="string">Succeed</field>
+1
View File
@@ -41,6 +41,7 @@ this repository contains the full copyright notices and license terms. -->
<group col="-1" colspan="2" id="buttons">
<button name="draft"/>
<button name="approve"/>
<button name="proceed"/>
<button name="fail"/>
<button name="succeed"/>
</group>