From ce54b1f4aa007f6a6ee3ea2c7cb292722ef2348b Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 9 Feb 2024 10:32:08 +0100 Subject: [PATCH] fixup --- .../account_cutoff_accrual_subscription.py | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py b/account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py index 682d326da64..0241dfec80b 100644 --- a/account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py +++ b/account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py @@ -50,7 +50,10 @@ class AccountCutoffAccrualSubscription(models.Model): ) partner_id = fields.Many2one( "res.partner", - compute="_compute_partner_id", readonly=False, store=True, precompute=True, + compute="_compute_partner_id", + readonly=False, + store=True, + precompute=True, string="Partner", domain=[("parent_id", "=", False)], ondelete="restrict", @@ -73,8 +76,12 @@ class AccountCutoffAccrualSubscription(models.Model): help="Minimum amount without taxes over the period", ) provision_amount = fields.Monetary( - compute='_compute_provision_amount', readonly=False, store=True, precompute=True, - string="Default Provision Amount", currency_field="company_currency_id" + compute="_compute_provision_amount", + readonly=False, + store=True, + precompute=True, + string="Default Provision Amount", + currency_field="company_currency_id", ) account_id = fields.Many2one( "account.account", @@ -86,7 +93,10 @@ class AccountCutoffAccrualSubscription(models.Model): type_tax_use = fields.Char(compute="_compute_type_tax_use") tax_ids = fields.Many2many( "account.tax", - compute="_compute_tax_ids", readonly=False, store=True, precompute=True, + compute="_compute_tax_ids", + readonly=False, + store=True, + precompute=True, string="Taxes", domain="[('price_include', '=', False), ('company_id', '=', company_id), " "('type_tax_use', '=', type_tax_use)]", @@ -130,10 +140,9 @@ def check_start_date(self): @api.depends("min_amount") def _compute_provision_amount(self): for sub in self: - if ( - sub.company_currency_id.compare_amounts(sub.min_amount, 0) > 0 - and sub.company_currency_id.is_zero(sub.provision_amount) - ): + if sub.company_currency_id.compare_amounts( + sub.min_amount, 0 + ) > 0 and sub.company_currency_id.is_zero(sub.provision_amount): sub.provision_amount = sub.min_amount @api.depends("account_id") @@ -237,9 +246,7 @@ def _process_subscription( ], aggregates=["balance:sum"], ) - amount_no_start_end = ( - no_start_end_res and no_start_end_res[0][0] or 0 - ) + amount_no_start_end = no_start_end_res and no_start_end_res[0][0] or 0 amount += amount_no_start_end * sign # 2. Start/end dates, INSIDE interval inside_res = aml_obj._read_group(