Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
0f7f3fc2
Commit
0f7f3fc2
authored
7 years ago
by
David Monjoie
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] web: prevent traceback on quickCreate in calendar
parent
58e130ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/web/static/src/js/views/calendar/calendar_controller.js
+3
-1
3 additions, 1 deletion
...s/web/static/src/js/views/calendar/calendar_controller.js
addons/web/static/tests/views/calendar_tests.js
+57
-0
57 additions, 0 deletions
addons/web/static/tests/views/calendar_tests.js
with
60 additions
and
1 deletion
addons/web/static/src/js/views/calendar/calendar_controller.js
+
3
−
1
View file @
0f7f3fc2
...
...
@@ -156,8 +156,10 @@ var CalendarController = AbstractController.extend({
self
.
quick
.
destroy
();
self
.
quick
=
null
;
self
.
reload
(
id
);
},
function
()
{
},
function
(
error
,
errorEvent
)
{
// This will occurs if there are some more fields required
// Preventdefaulting the error event will prevent the traceback window
errorEvent
.
preventDefault
();
event
.
data
.
options
.
disableQuickCreate
=
true
;
event
.
data
.
data
.
on_save
=
self
.
quick
.
destroy
.
bind
(
self
.
quick
);
self
.
_onOpenCreate
(
event
.
data
);
...
...
This diff is collapsed.
Click to expand it.
addons/web/static/tests/views/calendar_tests.js
+
57
−
0
View file @
0f7f3fc2
...
...
@@ -349,6 +349,63 @@ QUnit.module('Views', {
calendar
.
destroy
();
});
QUnit
.
test
(
'
quickcreate switching to actual create for required fields
'
,
function
(
assert
)
{
assert
.
expect
(
4
);
var
event
=
$
.
Event
();
var
calendar
=
createView
({
View
:
CalendarView
,
model
:
'
event
'
,
data
:
this
.
data
,
arch
:
'
<calendar class="o_calendar_test"
'
+
'
string="Events"
'
+
'
event_open_popup="true"
'
+
'
date_start="start"
'
+
'
date_stop="stop"
'
+
'
all_day="allday"
'
+
'
mode="month"
'
+
'
readonly_form_view_id="1">
'
+
'
<field name="name"/>
'
+
'
</calendar>
'
,
archs
:
archs
,
viewOptions
:
{
initialDate
:
initialDate
,
},
mockRPC
:
function
(
route
,
args
)
{
if
(
args
.
method
===
"
create
"
)
{
return
$
.
Deferred
().
reject
({
code
:
200
,
data
:
{},
message
:
"
Odoo server error
"
,
},
event
);
}
return
this
.
_super
(
route
,
args
);
},
});
// create a new event
var
$cell
=
calendar
.
$
(
'
.fc-day-grid .fc-row:eq(2) .fc-day:eq(2)
'
);
testUtils
.
triggerMouseEvent
(
$cell
,
"
mousedown
"
);
testUtils
.
triggerMouseEvent
(
$cell
,
"
mouseup
"
);
assert
.
strictEqual
(
$
(
'
.modal-dialog.modal-sm .modal-title
'
).
text
(),
'
Create
'
,
"
should open the quick create dialog
"
);
$
(
'
.modal-body input:first
'
).
val
(
'
new event in quick create
'
).
trigger
(
'
input
'
);
$
(
'
.modal button.btn:contains(Create)
'
).
trigger
(
'
click
'
).
trigger
(
'
click
'
);
// If the event is not default-prevented, a traceback will be raised, which we do not want
assert
.
ok
(
event
.
isDefaultPrevented
(),
"
fail deferred event should have been default-prevented
"
);
assert
.
strictEqual
(
$
(
'
.modal-dialog.modal-lg .modal-title
'
).
text
(),
'
Create: Events
'
,
"
should have switched to a bigger modal for an actual create rather than quickcreate
"
);
assert
.
strictEqual
(
$
(
'
.modal-dialog.modal-lg .modal-body .o_form_view.o_form_editable
'
).
length
,
1
,
"
should open the full event form view in a dialog
"
);
calendar
.
destroy
();
});
QUnit
.
test
(
'
create event with timezone in week mode
'
,
function
(
assert
)
{
assert
.
expect
(
5
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment