Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Feb 26, 2024
1 parent 84ce2f4 commit ce54b1f
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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)]",
Expand Down Expand Up @@ -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

Check warning on line 146 in account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py

View check run for this annotation

Codecov / codecov/patch

account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py#L146

Added line #L146 was not covered by tests

@api.depends("account_id")
Expand Down Expand Up @@ -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

Check warning on line 250 in account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py

View check run for this annotation

Codecov / codecov/patch

account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py#L249-L250

Added lines #L249 - L250 were not covered by tests
# 2. Start/end dates, INSIDE interval
inside_res = aml_obj._read_group(

Check warning on line 252 in account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py

View check run for this annotation

Codecov / codecov/patch

account_cutoff_accrual_subscription/models/account_cutoff_accrual_subscription.py#L252

Added line #L252 was not covered by tests
Expand Down

0 comments on commit ce54b1f

Please sign in to comment.