payment term end of month

20 views
Skip to first unread message

lists.j...@symetrie.com

unread,
Jul 5, 2017, 6:34:54 AM7/5/17
to try...@googlegroups.com
Hello,


Following https://bugs.tryton.org/issue2320
I should use value 31 in day field of PaymentTermLine
to obtain the end of the month.

I created a PaymentTerm thirty days + end of month
with the line
Remainder, days=30, day=31

Testing in 4.2 with the wizard TestPaymentTermView
I get March 2 for a date of January 2
where I expect to get February 28.

Is it a bug or did I misuse?


Jean-Christophe Michel
--
Symétrie
livres et partitions, édition multimédia
30 rue Jean-Baptiste Say
69001 LYON (FRANCE)

tél +33 (0)478 29 52 14
web https://symetrie.com



Cédric Krier

unread,
Jul 5, 2017, 7:00:06 AM7/5/17
to try...@googlegroups.com
On 2017-07-05 12:34, lists.j...@symetrie.com wrote:
> I created a PaymentTerm thirty days + end of month
> with the line
> Remainder, days=30, day=31
>
> Testing in 4.2 with the wizard TestPaymentTermView
> I get March 2 for a date of January 2
> where I expect to get February 28.
>
> Is it a bug or did I misuse?

A misuse. The order of operations is important when using absolute and
relative in the same line.
See http://labix.org/python-dateutil#head-72c4689ec5608067d118b9143cef6bdffb6dad4e

So in your case what happens is:

January 2nd -> day=31 -> January 31 -> days=30 -> March 2nd

You must have 2 lines:

1) days=30
2) day=31

January 2nd -> days=30 -> February 1st -> day=31 -> February 28th

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
Reply all
Reply to author
Forward
0 new messages