Dunning Process Levels Ambiguity

Hi for everybody here,
I have a question please , any help will be appreciated ;

The whole story is with the dunning module, it’s a little bit more complicated for me . For example I have extensively tested and researched for the Dunning Process (“Procedures”) to run automatically , but I have had no success at all. To explain How i was did:
When a Dunning is created what i understand that you should assign a dunning process that consist of one or many
levels of dunning (usually 3) in which each level is is executed according to the number of days
that an invoice is overdue its payment date For example:
Due date of the invoice is 10.08.2021 and the first level of dunning should be reached when the
first 10 days after the due date have passed in this example on the 20.08.2021 the first
payment reminder (the email ) should be sent. Then the 2nd
dunning level should be reached after 20 days have passed, in this case on the
30.08.2021 and the 3rd when 30 days have passed in this case on the 09.09.2021. When this 3
levels are done the system should change status from “Waiting” to “Final/Processed”
I have made a lot of testing and right now I have created a Dunning Process for testing fast
in which I ask the system to run the process in the order of
1st Level - after 5min
2nd Level- after 15 min
3rd Level -after 25 min
4th Level -after 40 min

NOTHING HAPPENS!!
The whole process is limited just to that first email that is sent immediately after i create the dunning and never goes through the whole process and levels and it doesn’t respect any configuration regarding the time (or days) that is requested. Is just as the system doesn’t have that “trigger” configurated to compare the dates and execute the conditionals to see” if true do this…”
is their something missed i should do it or any other configuration i should do it !!

Did you process the dunning after each level?

Hi @ced , what do u mean by “process the dunning after each level” , how i could do that !?

The first email was sent when you processed the dunning. So to go to the next level, you must process it again.

yeah thank you M.@ced

i received the email when i go the next Level as you advice me to do, but now the email is empty , nothing displayed, No body.

image

image

PS: after the first email sender the state become “waited” so how i modify the Level to go to next Level .the system prevent me to modify the Level that.

You must check the template selected for the level.

You do not change the level yourself. You run the process wizard which will calculate if the dunning must go to the next level.

Here in The “Level” Field,the “Email Template” was “Dunning Email” by default ,and when i open it , it contains all the fields normally.

this is how it looks like:

Hi again , am sorry for distribution;

Now when i tried edit the code of html from the browser and add an instruction for display the date to test if it will showed me this on email , it gives me an error and now i can’t doing any dunning process Although I delete the instruction that i added it to test and then i save but it still gives me this error when i try to do process:

Traceback (most recent call last):
  File "/site-packages/genshi/input.py", line 161, in _generate
    self.expat.Parse(data, False)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 12, column 21

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/site-packages/genshi/template/base.py", line 418, in __init__
    self._stream = self._parse(source, encoding)
  File "/site-packages/genshi/template/markup.py", line 82, in _parse
    for kind, data, pos in source:
  File "/site-packages/genshi/core.py", line 274, in _ensure
    event = next(stream)
  File "/site-packages/genshi/input.py", line 449, in _coalesce
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/site-packages/genshi/input.py", line 169, in _generate
    raise ParseError(msg, self.filename, e.lineno, e.offset)
genshi.input.ParseError: not well-formed (invalid token): line 12, column 21, in /tmp/trytond_frmcudoi.html

During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/trytond/wsgi.py", line 104, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 48, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 72, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 197, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/wizard/wizard.py", line 284, in execute
    return wizard._execute(state_name)
  File "/trytond/wizard/wizard.py", line 315, in _execute
    result = self._execute(transition())
  File "/trytond/wizard/wizard.py", line 315, in _execute
    result = self._execute(transition())
  File "/trytond/wizard/wizard.py", line 315, in _execute
    result = self._execute(transition())
  File "/trytond/modules/account_dunning_email/account.py", line 100, in transition_send_email
    log = dunning.send_email(datamanager=datamanager)
  File "/trytond/modules/account_dunning_email/account.py", line 141, in send_email
    msg = self._email(from_, to, cc, bcc, languages)
  File "/trytond/modules/account_dunning_email/account.py", line 151, in _email
    msg, title = get_email(self.level.email_template, self, languages)
  File "/trytond/report/report.py", line 412, in get_email
    'language': language,
  File "/trytond/modules/account_dunning_letter/dunning.py", line 57, in execute
    return super(Letter, cls).execute(ids, data)
  File "/trytond/report/report.py", line 191, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/trytond/report/report.py", line 217, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/report.py", line 317, in render
    data = rel_report(**report_context).render()
  File "/site-packages/relatorio/reporting.py", line 121, in __call__
    template = self.tmpl_loader.load(self.fpath, self.mimetype)
  File "/site-packages/relatorio/reporting.py", line 81, in load
    path, cls=cls, relative_to=relative_to)
  File "/site-packages/genshi/template/loader.py", line 236, in load
    filename, encoding=encoding)
  File "/site-packages/genshi/template/loader.py", line 274, in _instantiate
    allow_exec=self.allow_exec)
  File "/site-packages/genshi/template/markup.py", line 67, in __init__
    allow_exec=allow_exec)
  File "/site-packages/genshi/template/base.py", line 420, in __init__
    raise TemplateSyntaxError(e.msg, self.filepath, e.lineno, e.offset)
genshi.template.base.TemplateSyntaxError: not well-formed (invalid token): line 12, column 21 (/tmp/trytond_frmcudoi.html, line 12)

Obviously there is a syntax error. It is usually easier to find problem by editing the raw HTML instead of using the WYSIWYG editor.

yeah i guess so , is their a possible to make it like the original one, because although i have copied the original code (from my backup) it still doesn’t work and gives me TemplateSyntaxError,

If you used the default email template, then you can just clear the content and save. This will restore the default content.

1 Like

thank you so much M@ced for all your efforts , you helped me much ,
i have uploaded the "Dunning Email.html" in the administration(user interface/action/reports) after clear the content and save it.

i have just a last note , the email i received it seems to me not well formed and the rows not organized(they are not on same column) ,


is this the standard form that i should be see it in my email!?

For me it is a correct rendering but by default the HTML is very light with almost no style.
But default table style is to have header centered and content align left. But I guess we could align right fixed size content like the date and amount.
By the way I filled Issue 10682: Align to end date and amount in dunning email - Tryton issue tracker

1 Like