changeset e5e847225401 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset&node=e5e847225401
description:
        Rename split lines into reschedule lines

        issue11069
        review387661002
diffstat:

 CHANGELOG                                  |    1 +
 __init__.py                                |    8 +-
 doc/design/move.rst                        |   11 +-
 exceptions.py                              |    2 +-
 message.xml                                |   20 +-
 move.py                                    |   70 ++++++------
 move.xml                                   |   36 +++---
 tests/scenario_move_line_reschedule.rst    |  157 +++++++++++++++++++++++++++++
 tests/scenario_move_line_split.rst         |  157 -----------------------------
 tests/test_account.py                      |    2 +-
 view/move_line_reschedule_preview_form.xml |   13 ++
 view/move_line_reschedule_start_form.xml   |   21 +++
 view/move_line_reschedule_term_list.xml    |    7 +
 view/move_line_split_preview_form.xml      |   13 --
 view/move_line_split_start_form.xml        |   21 ---
 view/move_line_split_term_list.xml         |    7 -
 16 files changed, 274 insertions(+), 272 deletions(-)

diffs (782 lines):

diff -r 0ba0491cd956 -r e5e847225401 CHANGELOG
--- a/CHANGELOG Sun Jan 23 13:03:06 2022 +0100
+++ b/CHANGELOG Wed Jan 26 00:32:20 2022 +0100
@@ -1,3 +1,4 @@
+* Rename split lines into reschedule lines
 * Add optional credit type on account
 * Always require a date to compute taxes
 * Add support for Python 3.10
diff -r 0ba0491cd956 -r e5e847225401 __init__.py
--- a/__init__.py       Sun Jan 23 13:03:06 2022 +0100
+++ b/__init__.py       Wed Jan 26 00:32:20 2022 +0100
@@ -59,9 +59,9 @@
         move.ReconcileShow,
         move.CancelMovesDefault,
         move.GroupLinesStart,
-        move.SplitLinesStart,
-        move.SplitLinesPreview,
-        move.SplitLinesTerm,
+        move.RescheduleLinesStart,
+        move.RescheduleLinesPreview,
+        move.RescheduleLinesTerm,
         tax.TaxGroup,
         tax.TaxCodeTemplate,
         tax.TaxCode,
@@ -102,7 +102,7 @@
         move.Reconcile,
         move.CancelMoves,
         move.GroupLines,
-        move.SplitLines,
+        move.RescheduleLines,
         move_template.CreateMove,
         tax.OpenChartTaxCode,
         tax.OpenTaxCode,
diff -r 0ba0491cd956 -r e5e847225401 doc/design/move.rst
--- a/doc/design/move.rst       Sun Jan 23 13:03:06 2022 +0100
+++ b/doc/design/move.rst       Wed Jan 26 00:32:20 2022 +0100
@@ -97,13 +97,14 @@
 The maturity date used for the newly created account move line is the
 earliest maturity date from the lines that were grouped together.
 
-.. _wizard-account.move.line.split:
+.. _wizard-account.move.line.reschedule:
 
-Split Lines
-^^^^^^^^^^^
+Reschedule Lines
+^^^^^^^^^^^^^^^^
 
-The *Split Lines* wizard allows to reschedule payable or receivable *Account
-Move Lines* by creating an account move line for each new maturity date.
+The *Reschedule Lines* wizard allows to reschedule payable or receivable
+*Account Move Lines* by creating an account move line for each new maturity
+date.
 
 .. _wizard-account.move.reconcile_lines:
 
diff -r 0ba0491cd956 -r e5e847225401 exceptions.py
--- a/exceptions.py     Sun Jan 23 13:03:06 2022 +0100
+++ b/exceptions.py     Wed Jan 26 00:32:20 2022 +0100
@@ -93,5 +93,5 @@
     pass
 
 
-class SplitLineError(UserError):
+class RescheduleLineError(UserError):
     pass
diff -r 0ba0491cd956 -r e5e847225401 message.xml
--- a/message.xml       Sun Jan 23 13:03:06 2022 +0100
+++ b/message.xml       Wed Jan 26 00:32:20 2022 +0100
@@ -202,20 +202,20 @@
         <record model="ir.message" id="msg_group_line_maximum_account">
             <field name="text">You cannot group lines from more than 2 
different accounts.</field>
         </record>
-        <record model="ir.message" id="msg_split_line_same_origins">
-            <field name="text">You cannot split lines with different 
origins.</field>
+        <record model="ir.message" id="msg_reschedule_line_same_origins">
+            <field name="text">You cannot reschedule lines with different 
origins.</field>
         </record>
-        <record model="ir.message" id="msg_split_line_same_currency">
-            <field name="text">You cannot split lines with different 
currencies.</field>
+        <record model="ir.message" id="msg_reschedule_line_same_currency">
+            <field name="text">You cannot reschedule lines with different 
currencies.</field>
         </record>
-        <record model="ir.message" id="msg_split_line_same_account">
-            <field name="text">You cannot split lines with different 
accounts.</field>
+        <record model="ir.message" id="msg_reschedule_line_same_account">
+            <field name="text">You cannot reschedule lines with different 
accounts.</field>
         </record>
-        <record model="ir.message" id="msg_split_line_same_party">
-            <field name="text">You cannot split lines with different 
parties.</field>
+        <record model="ir.message" id="msg_reschedule_line_same_party">
+            <field name="text">You cannot reschedule lines with different 
parties.</field>
         </record>
-        <record model="ir.message" id="msg_split_line_wrong_amount">
-            <field name="text">To split the lines you must change the terms to 
have a total amount of %(total_amount)s instead of %(amount)s.</field>
+        <record model="ir.message" id="msg_reschedule_line_wrong_amount">
+            <field name="text">To reschedule the lines you must change the 
terms to have a total amount of %(total_amount)s instead of %(amount)s.</field>
         </record>
         <record model="ir.message" id="msg_cancel_line_delegated">
             <field name="text">The moves "%(moves)s" contain grouped lines, 
cancelling them will ungroup the lines.</field>
diff -r 0ba0491cd956 -r e5e847225401 move.py
--- a/move.py   Sun Jan 23 13:03:06 2022 +0100
+++ b/move.py   Wed Jan 26 00:32:20 2022 +0100
@@ -29,7 +29,7 @@
 from .exceptions import (
     CancelDelegatedWarning, CancelWarning, DeleteDelegatedWarning,
     GroupLineError, MoveDatesError, PostError, ReconciliationError,
-    SplitLineError)
+    RescheduleLineError)
 
 _MOVE_STATES = {
     'readonly': Eval('state') == 'posted',
@@ -2182,28 +2182,28 @@
     description = fields.Char("Description")
 
 
-class SplitLines(Wizard):
-    "Split Lines"
-    __name__ = 'account.move.line.split'
-    start = StateView('account.move.line.split.start',
-        'account.move_line_split_start_view_form', [
+class RescheduleLines(Wizard):
+    "Reschedule Lines"
+    __name__ = 'account.move.line.reschedule'
+    start = StateView('account.move.line.reschedule.start',
+        'account.move_line_reschedule_start_view_form', [
             Button("Cancel", 'end', 'tryton-cancel'),
             Button("Preview", 'preview', 'tryton-ok',
                 validate=False, default=True),
             ])
-    preview = StateView('account.move.line.split.preview',
-        'account.move_line_split_preview_view_form', [
+    preview = StateView('account.move.line.reschedule.preview',
+        'account.move_line_reschedule_preview_view_form', [
             Button("Cancel", 'end', 'tryton-cancel'),
-            Button("Split", 'split', 'tryton-ok', default=True),
+            Button("Reschedule", 'reschedule', 'tryton-ok', default=True),
             ])
-    split = StateAction('account.act_move_form_splitting')
+    reschedule = StateAction('account.act_move_form_rescheduling')
 
     def get_origin(self):
         try:
             origin, = {r.move.origin for r in self.records}
         except ValueError:
-            raise SplitLineError(
-                gettext('account.msg_split_line_same_origins'))
+            raise RescheduleLineError(
+                gettext('account.msg_reschedule_line_same_origins'))
         return origin
 
     @classmethod
@@ -2211,8 +2211,8 @@
         try:
             currency, = {l.amount_currency for l in lines}
         except ValueError:
-            raise SplitLineError(
-                gettext('account.msg_split_line_same_currency'))
+            raise RescheduleLineError(
+                gettext('account.msg_reschedule_line_same_currency'))
         return currency
 
     @classmethod
@@ -2220,8 +2220,8 @@
         try:
             account, = {l.account for l in lines}
         except ValueError:
-            raise SplitLineError(
-                gettext('account.msg_split_line_same_account'))
+            raise RescheduleLineError(
+                gettext('account.msg_reschedule_line_same_account'))
         return account
 
     @classmethod
@@ -2229,8 +2229,8 @@
         try:
             party, = {l.party for l in lines}
         except ValueError:
-            raise SplitLineError(
-                gettext('account.msg_split_line_same_party'))
+            raise RescheduleLineError(
+                gettext('account.msg_reschedule_line_same_party'))
         return party
 
     @classmethod
@@ -2298,8 +2298,8 @@
                     terms[-1]['amount'] += remaining
         return values
 
-    def do_split(self, action):
-        move, balance_line = self.split_lines(
+    def do_reschedule(self, action):
+        move, balance_line = self.reschedule_lines(
             self.records, self.preview.journal, self.preview.terms)
         move.origin = self.get_origin()
         move.description = self.preview.description
@@ -2320,7 +2320,7 @@
             }
 
     @classmethod
-    def split_lines(cls, lines, journal, terms):
+    def reschedule_lines(cls, lines, journal, terms):
         pool = Pool()
         Lang = pool.get('ir.lang')
         Line = pool.get('account.move.line')
@@ -2330,15 +2330,15 @@
         if amount != total_amount:
             lang = Lang.get()
             currency = cls.get_currency(lines)
-            raise SplitLineError(
-                gettext('account.msg_split_line_wrong_amount',
+            raise RescheduleLineError(
+                gettext('account.msg_reschedule_line_wrong_amount',
                     total_amount=lang.currency(total_amount, currency),
                     amount=lang.currency(amount, currency)))
 
         balance = cls.get_balance(lines)
         line_values = cls._line_values(lines)
         account = line_values['account']
-        move, balance_line = cls.get_split_move(
+        move, balance_line = cls.get_reschedule_move(
             amount, balance, journal, terms, **line_values)
         move.save()
         balance_line.move = move
@@ -2349,7 +2349,7 @@
         return move, balance_line
 
     @classmethod
-    def get_split_move(
+    def get_reschedule_move(
             cls, amount, balance, journal, terms, account, date=None,
             **line_values):
         pool = Pool()
@@ -2408,9 +2408,9 @@
         return move, balance_line
 
 
-class SplitLinesStart(ModelView):
-    "Split Lines"
-    __name__ = 'account.move.line.split.start'
+class RescheduleLinesStart(ModelView):
+    "Reschedule Lines"
+    __name__ = 'account.move.line.reschedule.start'
     start_date = fields.Date("Start Date", required=True)
     frequency = fields.Selection([
             ('monthly', "Monthly"),
@@ -2474,13 +2474,13 @@
             self.interval = self.frequency_intervals()[self.frequency]
 
 
-class SplitLinesPreview(ModelView):
-    "Split Lines"
-    __name__ = 'account.move.line.split.preview'
+class RescheduleLinesPreview(ModelView):
+    "Reschedule Lines"
+    __name__ = 'account.move.line.reschedule.preview'
     journal = fields.Many2One('account.journal', "Journal", required=True)
     description = fields.Char("Description")
     terms = fields.One2Many(
-        'account.move.line.split.term', None, "Terms",
+        'account.move.line.reschedule.term', None, "Terms",
         domain=[
             ('currency', '=', Eval('currency', -1)),
             ],
@@ -2488,9 +2488,9 @@
     currency = fields.Many2One('currency.currency', "Currency", readonly=True)
 
 
-class SplitLinesTerm(ModelView):
-    "Split Lines"
-    __name__ = 'account.move.line.split.term'
+class RescheduleLinesTerm(ModelView):
+    "Reschedule Lines"
+    __name__ = 'account.move.line.reschedule.term'
     date = fields.Date("Date", required=True)
     amount = Monetary(
         "Amount", currency='currency', digits='currency', required=True)
diff -r 0ba0491cd956 -r e5e847225401 move.xml
--- a/move.xml  Sun Jan 23 13:03:06 2022 +0100
+++ b/move.xml  Wed Jan 26 00:32:20 2022 +0100
@@ -452,43 +452,43 @@
             <field name="act_window" ref="act_move_form_grouping"/>
         </record>
 
-        <record model="ir.action.wizard" id="act_split_lines_wizard">
-            <field name="name">Split Lines</field>
-            <field name="wiz_name">account.move.line.split</field>
+        <record model="ir.action.wizard" id="act_reschedule_lines_wizard">
+            <field name="name">Reschedule Lines</field>
+            <field name="wiz_name">account.move.line.reschedule</field>
             <field name="model">account.move.line</field>
         </record>
-        <record model="ir.action.keyword" id="act_split_lines_keyword1">
+        <record model="ir.action.keyword" id="act_reschedule_lines_keyword1">
             <field name="keyword">form_action</field>
             <field name="model">account.move.line,-1</field>
-            <field name="action" ref="act_split_lines_wizard"/>
+            <field name="action" ref="act_reschedule_lines_wizard"/>
         </record>
 
-        <record model="ir.ui.view" id="move_line_split_start_view_form">
-            <field name="model">account.move.line.split.start</field>
+        <record model="ir.ui.view" id="move_line_reschedule_start_view_form">
+            <field name="model">account.move.line.reschedule.start</field>
             <field name="type">form</field>
-            <field name="name">move_line_split_start_form</field>
+            <field name="name">move_line_reschedule_start_form</field>
         </record>
 
-        <record model="ir.ui.view" id="move_line_split_preview_view_form">
-            <field name="model">account.move.line.split.preview</field>
+        <record model="ir.ui.view" id="move_line_reschedule_preview_view_form">
+            <field name="model">account.move.line.reschedule.preview</field>
             <field name="type">form</field>
-            <field name="name">move_line_split_preview_form</field>
+            <field name="name">move_line_reschedule_preview_form</field>
         </record>
 
-        <record model="ir.ui.view" id="move_line_split_term_view_list">
-            <field name="model">account.move.line.split.term</field>
+        <record model="ir.ui.view" id="move_line_reschedule_term_view_list">
+            <field name="model">account.move.line.reschedule.term</field>
             <field name="type">tree</field>
-            <field name="name">move_line_split_term_list</field>
+            <field name="name">move_line_reschedule_term_list</field>
         </record>
 
-        <record model="ir.action.act_window" id="act_move_form_splitting">
-            <field name="name">Split Account Move</field>
+        <record model="ir.action.act_window" id="act_move_form_rescheduling">
+            <field name="name">Reschedule Account Move</field>
             <field name="res_model">account.move</field>
         </record>
-        <record model="ir.action.act_window.view" 
id="act_move_form_splitting_view1">
+        <record model="ir.action.act_window.view" 
id="act_move_form_rescheduling_view1">
             <field name="sequence" eval="10"/>
             <field name="view" ref="move_view_form"/>
-            <field name="act_window" ref="act_move_form_splitting"/>
+            <field name="act_window" ref="act_move_form_rescheduling"/>
         </record>
 
         <record model="ir.action.report" id="report_general_journal">
diff -r 0ba0491cd956 -r e5e847225401 tests/scenario_move_line_reschedule.rst
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/scenario_move_line_reschedule.rst   Wed Jan 26 00:32:20 2022 +0100
@@ -0,0 +1,157 @@
+=========================
+Reschedule Lines Scenario
+=========================
+
+Imports::
+
+    >>> import datetime as dt
+    >>> from decimal import Decimal
+
+    >>> from dateutil.relativedelta import relativedelta
+
+    >>> from proteus import Model, Wizard
+    >>> from trytond.tests.tools import activate_modules
+    >>> from trytond.modules.currency.tests.tools import get_currency
+    >>> from trytond.modules.company.tests.tools import (
+    ...     create_company, get_company)
+    >>> from trytond.modules.account.tests.tools import (
+    ...     create_fiscalyear, create_chart, get_accounts)
+
+Activate modules::
+
+    >>> config = activate_modules('account')
+
+    >>> Journal = Model.get('account.journal')
+    >>> Line = Model.get('account.move.line')
+    >>> Move = Model.get('account.move')
+    >>> Party = Model.get('party.party')
+
+Create company::
+
+    >>> usd = get_currency('USD')
+    >>> eur = get_currency('EUR')
+    >>> _ = create_company(currency=usd)
+    >>> company = get_company()
+
+Create fiscal year::
+
+    >>> fiscalyear = create_fiscalyear(company)
+    >>> fiscalyear.click('create_period')
+    >>> period = fiscalyear.periods[0]
+
+Create chart of accounts::
+
+    >>> _ = create_chart(company)
+    >>> accounts = get_accounts(company)
+    >>> receivable = accounts['receivable']
+    >>> revenue = accounts['revenue']
+
+Create parties::
+
+    >>> party = Party(name="Party")
+    >>> party.save()
+
+Create Lines to reschedule::
+
+    >>> journal_revenue, = Journal.find([
+    ...         ('code', '=', 'REV'),
+    ...         ])
+
+    >>> move = Move()
+    >>> move.journal = journal_revenue
+    >>> move.date = period.start_date
+    >>> line = move.lines.new()
+    >>> line.account = revenue
+    >>> line.credit = Decimal('90.00')
+    >>> line = move.lines.new()
+    >>> line.account = receivable
+    >>> line.party = party
+    >>> line.debit = Decimal('90.00')
+    >>> line.second_currency = eur
+    >>> line.amount_second_currency = Decimal('100.00')
+    >>> line.maturity_date = period.start_date
+    >>> move.save()
+
+    >>> line, = [l for l in move.lines if l.account == receivable]
+    >>> receivable.reload()
+    >>> receivable.balance, receivable.amount_second_currency
+    (Decimal('90.00'), Decimal('100.00'))
+
+Split line by amount::
+
+    >>> reschedule = Wizard('account.move.line.reschedule', [line])
+    >>> reschedule.form.total_amount
+    Decimal('100.00')
+    >>> reschedule.form.start_date = period.end_date
+    >>> reschedule.form.frequency = 'other'
+    >>> reschedule.form.interval = 2
+    >>> reschedule.form.amount = Decimal('30.00')
+    >>> reschedule.execute('preview')
+
+    >>> term1, term2, term3, term4 = reschedule.form.terms
+    >>> term1.date == period.end_date
+    True
+    >>> term2.date == period.end_date + relativedelta(months=2)
+    True
+    >>> term3.date == period.end_date + relativedelta(months=4)
+    True
+    >>> term4.date == period.end_date + relativedelta(months=6)
+    True
+    >>> term1.amount, term2.amount, term3.amount, term4.amount
+    (Decimal('30.00'), Decimal('30.00'), Decimal('30.00'), Decimal('10.00'))
+
+Split line by number::
+
+    >>> reschedule = Wizard('account.move.line.reschedule', [line])
+    >>> reschedule.form.total_amount
+    Decimal('100.00')
+    >>> reschedule.form.start_date = period.end_date
+    >>> reschedule.form.frequency = 'monthly'
+    >>> reschedule.form.number = 3
+    >>> reschedule.execute('preview')
+
+    >>> reschedule.form.description = "Split 3 months"
+    >>> term1, term2, term3 = reschedule.form.terms
+    >>> term1.date == period.end_date
+    True
+    >>> term2.date == period.end_date + relativedelta(months=1)
+    True
+    >>> term3.date == period.end_date + relativedelta(months=2)
+    True
+    >>> term1.amount, term2.amount, term3.amount
+    (Decimal('33.33'), Decimal('33.33'), Decimal('33.34'))
+    >>> term1.amount = Decimal('40.00')
+    >>> term2.amount = term3.amount = Decimal('30.00')
+    >>> term3.date += relativedelta(months=1)
+
+    >>> reschedule.execute('reschedule')
+    >>> reschedule_move, = reschedule.actions[0]
+    >>> reschedule_move.description
+    'Split 3 months'
+
+Check receivable::
+
+    >>> receivable.reload()
+    >>> receivable.balance, receivable.amount_second_currency
+    (Decimal('90.00'), Decimal('100.00'))
+
+    >>> lines = Line.find([
+    ...     ('account', '=', receivable.id),
+    ...     ('reconciliation', '=', None),
+    ...     ], order=[('maturity_date', 'ASC')])
+    >>> line1, line2, line3 = lines
+
+    >>> line1.debit, line1.amount
+    (Decimal('36.00'), Decimal('40.00'))
+    >>> line1.maturity_date == period.end_date
+    True
+
+    >>> line2.debit, line2.amount
+    (Decimal('27.00'), Decimal('30.00'))
+    >>> line2.maturity_date == period.end_date + relativedelta(months=1)
+    True
+
+    >>> line3.debit, line3.amount
+    (Decimal('27.00'), Decimal('30.00'))
+    >>> line3.maturity_date == period.end_date + relativedelta(months=3)
+    True
diff -r 0ba0491cd956 -r e5e847225401 tests/scenario_move_line_split.rst
--- a/tests/scenario_move_line_split.rst        Sun Jan 23 13:03:06 2022 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-====================
-Split Lines Scenario
-====================
-
-Imports::
-
-    >>> import datetime as dt
-    >>> from decimal import Decimal
-
-    >>> from dateutil.relativedelta import relativedelta
-
-    >>> from proteus import Model, Wizard
-    >>> from trytond.tests.tools import activate_modules
-    >>> from trytond.modules.currency.tests.tools import get_currency
-    >>> from trytond.modules.company.tests.tools import (
-    ...     create_company, get_company)
-    >>> from trytond.modules.account.tests.tools import (
-    ...     create_fiscalyear, create_chart, get_accounts)
-
-Activate modules::
-
-    >>> config = activate_modules('account')
-
-    >>> Journal = Model.get('account.journal')
-    >>> Line = Model.get('account.move.line')
-    >>> Move = Model.get('account.move')
-    >>> Party = Model.get('party.party')
-
-Create company::
-
-    >>> usd = get_currency('USD')
-    >>> eur = get_currency('EUR')
-    >>> _ = create_company(currency=usd)
-    >>> company = get_company()
-
-Create fiscal year::
-
-    >>> fiscalyear = create_fiscalyear(company)
-    >>> fiscalyear.click('create_period')
-    >>> period = fiscalyear.periods[0]
-
-Create chart of accounts::
-
-    >>> _ = create_chart(company)
-    >>> accounts = get_accounts(company)
-    >>> receivable = accounts['receivable']
-    >>> revenue = accounts['revenue']
-
-Create parties::
-
-    >>> party = Party(name="Party")
-    >>> party.save()
-
-Create Lines to split::
-
-    >>> journal_revenue, = Journal.find([
-    ...         ('code', '=', 'REV'),
-    ...         ])
-
-    >>> move = Move()
-    >>> move.journal = journal_revenue
-    >>> move.date = period.start_date
-    >>> line = move.lines.new()
-    >>> line.account = revenue
-    >>> line.credit = Decimal('90.00')
-    >>> line = move.lines.new()
-    >>> line.account = receivable
-    >>> line.party = party
-    >>> line.debit = Decimal('90.00')
-    >>> line.second_currency = eur
-    >>> line.amount_second_currency = Decimal('100.00')
-    >>> line.maturity_date = period.start_date
-    >>> move.save()
-
-    >>> line, = [l for l in move.lines if l.account == receivable]
-    >>> receivable.reload()
-    >>> receivable.balance, receivable.amount_second_currency
-    (Decimal('90.00'), Decimal('100.00'))
-
-Split line by amount::
-
-    >>> split = Wizard('account.move.line.split', [line])
-    >>> split.form.total_amount
-    Decimal('100.00')
-    >>> split.form.start_date = period.end_date
-    >>> split.form.frequency = 'other'
-    >>> split.form.interval = 2
-    >>> split.form.amount = Decimal('30.00')
-    >>> split.execute('preview')
-
-    >>> term1, term2, term3, term4 = split.form.terms
-    >>> term1.date == period.end_date
-    True
-    >>> term2.date == period.end_date + relativedelta(months=2)
-    True
-    >>> term3.date == period.end_date + relativedelta(months=4)
-    True
-    >>> term4.date == period.end_date + relativedelta(months=6)
-    True
-    >>> term1.amount, term2.amount, term3.amount, term4.amount
-    (Decimal('30.00'), Decimal('30.00'), Decimal('30.00'), Decimal('10.00'))
-
-Split line by number::
-
-    >>> split = Wizard('account.move.line.split', [line])
-    >>> split.form.total_amount
-    Decimal('100.00')
-    >>> split.form.start_date = period.end_date
-    >>> split.form.frequency = 'monthly'
-    >>> split.form.number = 3
-    >>> split.execute('preview')
-
-    >>> split.form.description = "Split 3 months"
-    >>> term1, term2, term3 = split.form.terms
-    >>> term1.date == period.end_date
-    True
-    >>> term2.date == period.end_date + relativedelta(months=1)
-    True
-    >>> term3.date == period.end_date + relativedelta(months=2)
-    True
-    >>> term1.amount, term2.amount, term3.amount
-    (Decimal('33.33'), Decimal('33.33'), Decimal('33.34'))
-    >>> term1.amount = Decimal('40.00')
-    >>> term2.amount = term3.amount = Decimal('30.00')
-    >>> term3.date += relativedelta(months=1)
-
-    >>> split.execute('split')
-    >>> split_move, = split.actions[0]
-    >>> split_move.description
-    'Split 3 months'
-
-Check receivable::
-
-    >>> receivable.reload()
-    >>> receivable.balance, receivable.amount_second_currency
-    (Decimal('90.00'), Decimal('100.00'))
-
-    >>> lines = Line.find([
-    ...     ('account', '=', receivable.id),
-    ...     ('reconciliation', '=', None),
-    ...     ], order=[('maturity_date', 'ASC')])
-    >>> line1, line2, line3 = lines
-
-    >>> line1.debit, line1.amount
-    (Decimal('36.00'), Decimal('40.00'))
-    >>> line1.maturity_date == period.end_date
-    True
-
-    >>> line2.debit, line2.amount
-    (Decimal('27.00'), Decimal('30.00'))
-    >>> line2.maturity_date == period.end_date + relativedelta(months=1)
-    True
-
-    >>> line3.debit, line3.amount
-    (Decimal('27.00'), Decimal('30.00'))
-    >>> line3.maturity_date == period.end_date + relativedelta(months=3)
-    True
diff -r 0ba0491cd956 -r e5e847225401 tests/test_account.py
--- a/tests/test_account.py     Sun Jan 23 13:03:06 2022 +0100
+++ b/tests/test_account.py     Wed Jan 26 00:32:20 2022 +0100
@@ -1725,7 +1725,7 @@
             checker=doctest_checker,
             optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
     suite.addTests(doctest.DocFileSuite(
-            'scenario_move_line_split.rst',
+            'scenario_move_line_reschedule.rst',
             tearDown=doctest_teardown, encoding='utf-8',
             checker=doctest_checker,
             optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
diff -r 0ba0491cd956 -r e5e847225401 view/move_line_reschedule_preview_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/move_line_reschedule_preview_form.xml        Wed Jan 26 00:32:20 
2022 +0100
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<form>
+    <label name="journal"/>
+    <field name="journal"/>
+    <newline/>
+
+    <label name="description"/>
+    <field name="description" colspan="3"/>
+
+    <field name="terms" colspan="4"/>
+</form>
diff -r 0ba0491cd956 -r e5e847225401 view/move_line_reschedule_start_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/move_line_reschedule_start_form.xml  Wed Jan 26 00:32:20 2022 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<form col="2">
+    <label name="start_date"/>
+    <field name="start_date"/>
+
+    <label name="frequency"/>
+    <group id="frequency_interval" col="-1">
+        <field name="frequency"/>
+        <label name="interval" string="every"/>
+        <field name="interval" xexpand="0"/>
+        <label name="interval" string="months" xalign="0.0" xexpand="1"/>
+    </group>
+
+    <label name="amount"/>
+    <field name="amount"/>
+
+    <label name="number"/>
+    <field name="number"/>
+</form>
diff -r 0ba0491cd956 -r e5e847225401 view/move_line_reschedule_term_list.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/move_line_reschedule_term_list.xml   Wed Jan 26 00:32:20 2022 +0100
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<tree editable="1">
+    <field name="date"/>
+    <field name="amount" expand="1"/>
+</tree>
diff -r 0ba0491cd956 -r e5e847225401 view/move_line_split_preview_form.xml
--- a/view/move_line_split_preview_form.xml     Sun Jan 23 13:03:06 2022 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
-this repository contains the full copyright notices and license terms. -->
-<form>
-    <label name="journal"/>
-    <field name="journal"/>
-    <newline/>
-
-    <label name="description"/>
-    <field name="description" colspan="3"/>
-
-    <field name="terms" colspan="4"/>
-</form>
diff -r 0ba0491cd956 -r e5e847225401 view/move_line_split_start_form.xml
--- a/view/move_line_split_start_form.xml       Sun Jan 23 13:03:06 2022 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
-this repository contains the full copyright notices and license terms. -->
-<form col="2">
-    <label name="start_date"/>
-    <field name="start_date"/>
-
-    <label name="frequency"/>
-    <group id="frequency_interval" col="-1">
-        <field name="frequency"/>
-        <label name="interval" string="every"/>
-        <field name="interval" xexpand="0"/>
-        <label name="interval" string="months" xalign="0.0" xexpand="1"/>
-    </group>
-
-    <label name="amount"/>
-    <field name="amount"/>
-
-    <label name="number"/>
-    <field name="number"/>
-</form>
diff -r 0ba0491cd956 -r e5e847225401 view/move_line_split_term_list.xml
--- a/view/move_line_split_term_list.xml        Sun Jan 23 13:03:06 2022 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
-this repository contains the full copyright notices and license terms. -->
-<tree editable="1">
-    <field name="date"/>
-    <field name="amount" expand="1"/>
-</tree>

Reply via email to