Tryton - Issues

 

Issue8002

Title cron task for "posting clearing move" failed
Priority bug Status closed
Superseder Nosy List ced, pokoli, semarie
Type crash Components
Assigned To Keywords
Reviews

Created on 2019-01-16.14:14:45 by semarie, last changed by semarie.

Messages
msg50896 (view) Author: [hidden] (semarie) Date: 2019-07-26.08:17:45
after switching to 5.2, I don't have this problem anymore. so issue8200 should have solve it.
msg47962 (view) Author: [hidden] (semarie) Date: 2019-03-24.12:27:54
> I do not understand the logical of both sentences. I do not understand when and how often it happens and neither what is related to the restart and the restart of what?

Currently, I am seeing the issue with cron task when I restart the machine : true server with hardware (not a VM), hot reboot. At machine startup, I receive a mail from trytond with the traceback.

The OS is OpenBSD. Services (postgresql, trytond, trytond_cron) are started at boot time, in this order. It is a trytond-5.0 and postgresql-11.2.

Just restarting the services (using "rcctl restart") isn't enough to trigger the traceback, so I am assuming the load at boot time slowdown something, and it triggers the assertion.

> I have created issue8200 to standardize the cron startup, maybe it solve this issue?

I am seeing the problem on my production server. So I need to first reproduce it somewhere else to test.
msg47676 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-03-16.17:42:53
I have created issue8200 to standardize the cron startup, maybe it solve this issue?
msg47674 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-03-16.17:12:53
> The first problem: it is required for a Payment to have a Party AND an Account in order to create a Move on success. I wrongly assumed setting only the Party would be enough. So nothing related to account_payment_clearing.

The party is not required except if the clearing account requires a party.
So no issue here.

> I still see exceptions from the account_payment_clearing cron task. Currently, it is at server startup (after a reboot). Just restarting trytond or trytond_cron isn't enough, neither restarting postgresql and trytond/trytond_cron together.

I do not understand the logical of both sentences. I do not understand when and how often it happens and neither what is related to the restart and the restart of what?
msg47672 (view) Author: [hidden] (semarie) Date: 2019-03-16.16:25:45
> Do you mean you did not put a clearing account on the payment journal?

I am unsure about the question.

So let's resume the situation: in fact, there are two distincts problems (I found they were separated after more investigation).

The first problem: it is required for a Payment to have a Party AND an Account in order to create a Move on success. I wrongly assumed setting only the Party would be enough. So nothing related to account_payment_clearing.

The second problem: I still see exceptions from the account_payment_clearing cron task. Currently, it is at server startup (after a reboot). Just restarting trytond or trytond_cron isn't enough, neither restarting postgresql and trytond/trytond_cron together.
msg47669 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-03-16.15:33:27
Do you mean you did not put a clearing account on the payment journal?
msg45993 (view) Author: [hidden] (semarie) Date: 2019-01-16.19:58:44
I found the problem regarding the absence of move associated to the payment: I only set the party and not the account too. I expected it will use the default account associated to the party, and it seems it isn't the case.

Regarding the cron task error, I can't trigger it again. I will keep an eyes on it.
msg45989 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-01-16.14:53:38
If you fail the payment you will be able to success it another time and tryton will try to recreate the clearing move if required (if you have the accounts properly configured on the jounral). 

So if the issue is about creating the clearing_move some message will be raised
msg45988 (view) Author: [hidden] (semarie) Date: 2019-01-16.14:39:28
here, for each payment of the group, payment.clearing_move is None whereas payment.state = 'succeeded' (I check it with proteus too).

the cron job is enabled for the company.

I will try to reproduce using a scenario to share.
msg45987 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-01-16.14:28:02
The move is created when the payment is succeed [1] and it will be posted when the cron job is executed [2]. If the cron job failed you should have a draft move for the clearing move. Did you tried to post it manually?

Is the cron job enabled for your company? There is a companies field on the cron form, you should see your company there. 



Normally you can use the test scenario as reference of functionality.

[1] http://hg.tryton.org/modules/account_payment_clearing/file/f69f607fcff0/tests/scenario_account_payment_clearing.rst#l160
[2] http://hg.tryton.org/modules/account_payment_clearing/file/f69f607fcff0/tests/scenario_account_payment_clearing.rst#l193
msg45986 (view) Author: [hidden] (semarie) Date: 2019-01-16.14:14:44
I have a payment journal for SEPA using clearing.

I created several Payments *without* associated invoices (the related invoices are recorded in 2018 in another accounting program, and the moves will be imported with the closing balance of 2018, later).

I created a Payment Group, generated the SEPA message, and send it to my bank. The bank makes the move, and I have a Statement Line with the Payment Group.

When I posted the Statement, the payments in the PaymentGroup switched to "succeed" state, but no move for the payments has been created (I expected to see a move of clearingAccount/party). Only the one for PaymentGroup (clearingAccount/bankAccount) is here.

Next, I received a mail from trytond with the following backtrace:

Subject: L'action planifiée a échouée

L'action suivante n'a pas pu s'exécuter correctement: « Poster les mouvements de compensation »
tryton://mira.local/solitrap/model/ir.cron/2
 Retraçage:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/trytond/model/model.py", line 396, in __getattr__
    return self._values[name]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/trytond/model/modelstorage.py", line 1263, in __getattr__
    return super(ModelStorage, self).__getattr__(name)
  File "/usr/local/lib/python3.6/site-packages/trytond/model/model.py", line 399, in __getattr__
    % (self.__name__, name, self._values))
AttributeError: 'ir.configuration' Model has no attribute 'language': None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/trytond/ir/cron.py", line 171, in run
    cron.run_once()
  File "/usr/local/lib/python3.6/site-packages/trytond/model/descriptors.py", line 31, in newfunc
    return self.func(owner, [instance], *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/trytond/model/modelview.py", line 665, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/trytond/modules/company/cron.py", line 31, in run_once
    super(Cron, cls).run_once([cron])
  File "/usr/local/lib/python3.6/site-packages/trytond/model/descriptors.py", line 33, in newfunc
    return self.func(owner, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/trytond/model/modelview.py", line 665, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/trytond/ir/cron.py", line 151, in run_once
    getattr(Model, cron.function)(*args)
  File "/usr/local/lib/python3.6/site-packages/trytond/modules/account_payment_clearing/payment.py", line 51, in cron_post_clearing_moves
    Move.post(moves)
  File "/usr/local/lib/python3.6/site-packages/trytond/model/modelview.py", line 665, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/trytond/modules/analytic_account/line.py", line 173, in post
    MoveLine.set_analytic_state(lines)
  File "/usr/local/lib/python3.6/site-packages/trytond/modules/analytic_account/line.py", line 270, in set_analytic_state
    ('parent', '=', None),
  File "/usr/local/lib/python3.6/site-packages/trytond/model/modelsql.py", line 1199, in search
    forder = field.convert_order(oexpr, tables, cls)
  File "/usr/local/lib/python3.6/site-packages/trytond/model/fields/field.py", line 467, in convert_order
    language = Transaction().language
  File "/usr/local/lib/python3.6/site-packages/trytond/transaction.py", line 251, in language
    return self.context.get('language') or get_language()
  File "/usr/local/lib/python3.6/site-packages/trytond/transaction.py", line 249, in get_language
    return Config.get_language()
  File "/usr/local/lib/python3.6/site-packages/trytond/ir/configuration.py", line 27, in get_language
    language = config.language
  File "/usr/local/lib/python3.6/site-packages/trytond/model/fields/field.py", line 298, in __get__
    return inst.__getattr__(self.name)
  File "/usr/local/lib/python3.6/site-packages/trytond/model/modelstorage.py", line 1265, in __getattr__
    if self.id is None or self.id < 0:
  File "/usr/local/lib/python3.6/site-packages/trytond/model/fields/field.py", line 295, in __get__
    assert self.name is not None
AssertionError


I dunno about the order: if the cron task failed and so no move were created, or if no moves were created (because of no invoice ?) and so the cron task failed, or if the backtrace is unrelated.

I am interested to know if the Move associated to payments when succeeded should be created automatically or not
History
Date User Action Args
2019-07-26 08:17:46semariesetstatus: testing -> closed
messages: + msg50896
2019-03-24 12:37:01cedsetstatus: need-eg -> testing
2019-03-24 12:27:54semariesetmessages: + msg47962
2019-03-16 17:42:53cedsetmessages: + msg47676
2019-03-16 17:12:54cedsetcomponent: - account_payment_clearing
messages: + msg47674
2019-03-16 16:25:46semariesetmessages: + msg47672
2019-03-16 15:33:28cedsetstatus: chatting -> need-eg
nosy: + ced
messages: + msg47669
2019-01-16 19:58:44semariesetmessages: + msg45993
2019-01-16 14:53:38pokolisetmessages: + msg45989
2019-01-16 14:39:28semariesetmessages: + msg45988
2019-01-16 14:28:02pokolisetstatus: unread -> chatting
nosy: + pokoli
messages: + msg45987
2019-01-16 14:14:45semariecreate