diff --git a/account_move_cutoff/models/account_move_line.py b/account_move_cutoff/models/account_move_line.py index cada98e95a1..f30674733fc 100644 --- a/account_move_cutoff/models/account_move_line.py +++ b/account_move_cutoff/models/account_move_line.py @@ -19,16 +19,6 @@ class AccountMoveLine(models.Model): "cutoff.period.mixin", ] - @api.model - def _get_default_cutoff_method(self): - return ( - self.env["ir.config_parameter"] - .sudo() - .get_param( - "account_move_cutoff.default_cutoff_method", "monthly_prorata_temporis" - ) - ) - is_deferrable_line = fields.Boolean( string="Is deferrable line", compute="_compute_is_deferrable_line", @@ -41,7 +31,7 @@ def _get_default_cutoff_method(self): ], string="Cut-off method", required=True, - default=lambda self: self._get_default_cutoff_method(), + default="monthly_prorata_temporis", help=( "Determine how to split amounts over periods:\n" " * Equal: same amount is splitted over periods of the service" diff --git a/account_move_cutoff/models/res_config_settings.py b/account_move_cutoff/models/res_config_settings.py index 4f730e97660..2f59c9e6343 100644 --- a/account_move_cutoff/models/res_config_settings.py +++ b/account_move_cutoff/models/res_config_settings.py @@ -22,3 +22,20 @@ class ResConfigSettings(models.TransientModel): config_parameter="account_move_cutoff.link_product", help="Link product on deferred account.move.line.", ) + default_cutoff_method = fields.Selection( + [ + ("equal", "Equal"), + ("monthly_prorata_temporis", "Prorata temporis (by month %)"), + ], + string="Default Cutoff method", + default="monthly_prorata_temporis", + default_model="account.move.line", + required=True, + help=( + "Determine how to split amounts over periods:\n" + " * Equal: same amount is splitted over periods of the service" + " (using start and end date on the invoice line).\n" + " * Prorata temporis by month %: amount is splitted over" + " the rate of service days in the month.\n" + ), + ) diff --git a/account_move_cutoff/views/account_move.xml b/account_move_cutoff/views/account_move.xml index 1b402ca08cf..6022589388a 100644 --- a/account_move_cutoff/views/account_move.xml +++ b/account_move_cutoff/views/account_move.xml @@ -33,9 +33,16 @@ /> + + + + diff --git a/account_move_cutoff/views/account_move_line.xml b/account_move_cutoff/views/account_move_line.xml index 6cface65cbe..15b5ad2d168 100644 --- a/account_move_cutoff/views/account_move_line.xml +++ b/account_move_cutoff/views/account_move_line.xml @@ -14,6 +14,7 @@ string="Deferred Revenue/Expense" attrs="{'invisible': [('cutoff_source_move_id', '=', False)]}" > + @@ -28,6 +29,7 @@ + @@ -41,6 +43,7 @@ + diff --git a/account_move_cutoff/views/res_config_settings.xml b/account_move_cutoff/views/res_config_settings.xml index dce6da96aaf..3c26b2a2558 100644 --- a/account_move_cutoff/views/res_config_settings.xml +++ b/account_move_cutoff/views/res_config_settings.xml @@ -45,6 +45,28 @@ + +
+
+
+ +
+ Determine how to split amounts over periods: +
  • +
      Equal: same amount is splitted over periods of the service" + (using start and end date on the invoice line).
    +
      + Prorata temporis by month %: amount is splitted over" + the rate of service days in the month.\n" +
    +
  • +
    +
    +