From 144fcb3bf9f68688c4d23e066189a5c23860dc96 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Tue, 5 Dec 2017 14:46:54 +0100 Subject: [PATCH] FIX l10n_it_withholding_tax (#416) Gli oggetti withholding.tax.move, withholding.tax.statement e withholding.tax.move.payment si possono eliminare dalla vista elendo dei relativi menu --- l10n_it_withholding_tax_payment/models/withholding_tax.py | 7 +++++++ l10n_it_withholding_tax_payment/views/withholding_tax.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/l10n_it_withholding_tax_payment/models/withholding_tax.py b/l10n_it_withholding_tax_payment/models/withholding_tax.py index d18751bf3618..2f77cc019fac 100644 --- a/l10n_it_withholding_tax_payment/models/withholding_tax.py +++ b/l10n_it_withholding_tax_payment/models/withholding_tax.py @@ -157,3 +157,10 @@ def move_payment_confirmed(self): # Wt move set to due for wt_move in move.line_ids: wt_move.action_paid() + + @api.multi + def unlink(self): + for payment in self: + if payment.state != 'draft': + raise ValidationError(_("You can only delete draft payments")) + return super(WithholdingTaxMovePayment, self).unlink() diff --git a/l10n_it_withholding_tax_payment/views/withholding_tax.xml b/l10n_it_withholding_tax_payment/views/withholding_tax.xml index 8d3b3271038a..3d37a6ff73fa 100644 --- a/l10n_it_withholding_tax_payment/views/withholding_tax.xml +++ b/l10n_it_withholding_tax_payment/views/withholding_tax.xml @@ -75,7 +75,7 @@ - +