Tryton - Issues

 

Issue6456

Title Calendar View: selected_date is undefined when new record button is clicked
Priority bug Status resolved
Superseder Nosy List ced, fmorato, pokoli, reviewbot, roundup-bot, xcodinas
Type crash Components sao
Assigned To xcodinas Keywords review
Reviews 41281002, 40291002
View: 41281002, 40291002

Created on 2017-04-20.19:40:16 by fmorato, last changed by roundup-bot.

Messages
New changeset 5ed056a1dace by Xavier Codinas in branch 'default':
Use fullcalendar date instead of saving it in view
http://hg.tryton.org/sao/rev/5ed056a1dace
review40291002 updated at https://codereview.tryton.org/40291002/#ps80001
review40291002 updated at https://codereview.tryton.org/40291002/#ps60001
review40291002 updated at https://codereview.tryton.org/40291002/#ps40001
New review40291002 at https://codereview.tryton.org/40291002/#ps20001
msg33511 (view) Author: [hidden] (xcodinas) (Tryton committer) Date: 2017-05-02.14:00:47
I updated the review by using gotoDate[0] on dayClick and then using getDate when creating a new record. So there's no need to save the date in current_view.

[0] https://fullcalendar.io/docs/current_date/getDate/
msg33510 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-05-02.13:26:04
A better solution must be found because this one is very bad as this issue shows. And it is not by fixing the side effect that the design will improve.
I do not understand why when a day is clicked the actual date is not the day clicked. But at worst it should be set on the callback.
Moreover reading the documentation[1], the date can be a slot time so this can not work.

[1] https://fullcalendar.io/docs/mouse/dayClick/
msg33509 (view) Author: [hidden] (xcodinas) (Tryton committer) Date: 2017-05-02.12:50:29
FullCalendar does not provide it as getDate just returns the actual date and the only way I saw to get the day clicked date is by the dayClick callback.
msg33508 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-05-02.12:43:23
I do not agree, there is no reason to store on the view the date.
Such storing is a source of many bugs, it creates side effect and it is useless because FullCalendar provide it.
msg33506 (view) Author: [hidden] (xcodinas) (Tryton committer) Date: 2017-05-02.12:34:02
> I think the right way to fix that is by using getDate[1] instead of storing 
> our own version. But it may require to set it in dayClick[2] callback as 
> maybe FullCalendar will not yet set it.

The actual behavior is that the date stored is the one returned by 
fullCalendar dayClick  callback so if the user creates a new record without
passing through that function no date will be set, so imo the solution should 
be returning the current date when no date is defined (Using getDate).

As I've done in review40291002.
msg33426 (view) Author: [hidden] (fmorato) Date: 2017-04-26.15:57:07
>In which module there's such model? I am not able to reproduce it..

I'm not aware of such a module in tryton.

I wrote a simple module to help reproduce the issue. You can find it at https://bitbucket.org/fmorato/trytond_cal there is a branch default with 4.3 and a branch 4.2 if you need it.
msg33404 (view) Author: [hidden] (xcodinas) (Tryton committer) Date: 2017-04-26.09:33:01
>In a Calendar View for a Model with fields name, dtstart and dtend, when I  >click the new record button there is an error in the browser console, the >processing balloon stays on and the view freezes.

In which module there's such model? I am not able to reproduce it..
msg33322 (view) Author: [hidden] (fmorato) Date: 2017-04-21.13:46:41
I'll look into it but my knowledge on JS is very limited.
msg33314 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-04-20.22:51:49
I think the right way to fix that is by using getDate[1] instead of storing our own version. But it may require to set it in dayClick[2] callback as maybe FullCalendar will not yet set it.

[1] https://fullcalendar.io/docs/current_date/getDate/
[2] https://fullcalendar.io/docs/mouse/dayClick/
New review41281002 at https://codereview.tryton.org/41281002/#ps1
msg33312 (view) Author: [hidden] (fmorato) Date: 2017-04-20.19:40:15
In a Calendar View for a Model with fields name, dtstart and dtend, when I click the new record button there is an error in the browser console, the processing balloon stays on and the view freezes.

When creating the a new record from the form or tree view there are no errors.

It seems that the variable selected_date is undefined.

The console error in Firefox 54a2:

TypeError: selected_date is undefined[Learn More]  tryton-sao.js:13858:17
	set_default_date http://0.0.0.0:8000/dist/tryton-sao.js:13858:17
	new_/</< http://0.0.0.0:8000/dist/tryton-sao.js:6477:24
	bound  self-hosted:913:17
	then/</</< http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:28467
	i http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27146
	fireWith http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27914
	Deferred/</e[f[0]] http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:28879
	i http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27146
	add http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27450
	then/</</< http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:28518
	i http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27146
	fireWith http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27914
	Deferred/</e[f[0]] http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:28879
	ajax_success http://0.0.0.0:8000/dist/tryton-sao.js:695:17
	i http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27146
	fireWith http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27914
	z http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:4:12057
	c/< http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:4:15619

In chromium 57:

tryton-sao.js:13858 Uncaught TypeError: Cannot read property 'format' of undefined
    at ClassConstructor.set_default_date (http://0.0.0.0:8000/dist/tryton-sao.js:13858:59)
    at ClassConstructor.<anonymous> (http://0.0.0.0:8000/dist/tryton-sao.js:6477:38)
    at http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:28469
    at i (http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27151)
    at Object.fireWith [as resolveWith] (http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27914)
    at e.(anonymous function) (http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:28893)
    at i (http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27151)
    at Object.add [as done] (http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27450)
    at Object.<anonymous> (http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:28549)
    at i (http://0.0.0.0:8000/bower_components/jquery/dist/jquery.min.js:2:27151)
History
Date User Action Args
2017-05-19 11:56:47roundup-botsetstatus: chatting -> resolved
nosy: + roundup-bot
messages: + msg33709
2017-05-18 12:10:42reviewbotsetmessages: + msg33697
2017-05-10 13:03:14reviewbotsetmessages: + msg33617
2017-05-03 13:36:12reviewbotsetmessages: + msg33532
2017-05-02 14:01:10reviewbotsetmessages: + msg33512
2017-05-02 14:01:09reviewbotsetreviews: 41281002 -> 41281002, 40291002
2017-05-02 14:00:47xcodinassetmessages: + msg33511
2017-05-02 13:26:04cedsetmessages: + msg33510
2017-05-02 12:50:29xcodinassetmessages: + msg33509
2017-05-02 12:43:23cedsetmessages: + msg33508

Showing 10 items. Show all history (warning: this could be VERY long)