From 463040bcaff8519927cc4d5d6877bbc892cc49eb Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 19 Nov 2014 10:09:59 +0100 Subject: [PATCH] If no period is selected, use all the periods of the fiscal year --- account_tax_analysis/account_tax_analysis.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/account_tax_analysis/account_tax_analysis.py b/account_tax_analysis/account_tax_analysis.py index 10ed69b50..bb46c0873 100644 --- a/account_tax_analysis/account_tax_analysis.py +++ b/account_tax_analysis/account_tax_analysis.py @@ -37,14 +37,16 @@ class AccountTaxDeclarationAnalysis(models.TransientModel): column1='tax_analysis', column2='period_id', string='Periods', - required=True, + help="If no period is selected, all the periods of the " + "fiscal year will be used", ) @api.multi def show_vat(self): - if not self.period_list: - raise exceptions.Warning(_("You must select periods")) - domain = [('period_id', 'in', self.period_list.ids)] + periods = self.period_list + if not periods: + periods = self.fiscalyear_id.period_ids + domain = [('period_id', 'in', periods.ids)] action = self.env.ref('account_tax_analysis.action_view_tax_analysis') action_fields = action.read()[0] action_fields['domain'] = domain