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
5c05e397
Commit
5c05e397
authored
8 years ago
by
Christophe Simonis
Browse files
Options
Downloads
Plain Diff
[MERGE] forward port branch 8.0 up to
2a65b815
parents
f5e19757
2a65b815
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
addons/resource/resource.py
+4
-4
4 additions, 4 deletions
addons/resource/resource.py
openerp/addons/base/tests/test_views.py
+5
-0
5 additions, 0 deletions
openerp/addons/base/tests/test_views.py
openerp/osv/orm.py
+4
-4
4 additions, 4 deletions
openerp/osv/orm.py
with
13 additions
and
8 deletions
addons/resource/resource.py
+
4
−
4
View file @
5c05e397
...
...
@@ -188,7 +188,7 @@ class resource_calendar(osv.osv):
def
get_weekdays
(
self
,
cr
,
uid
,
id
,
default_weekdays
=
None
,
context
=
None
):
"""
Return the list of weekdays that contain at least one working interval.
If no id is given (no calendar), return default weekdays.
"""
if
id
is
None
:
if
not
id
:
return
default_weekdays
if
default_weekdays
is
not
None
else
[
0
,
1
,
2
,
3
,
4
]
calendar
=
self
.
browse
(
cr
,
uid
,
id
,
context
=
None
)
weekdays
=
set
()
...
...
@@ -338,7 +338,7 @@ class resource_calendar(osv.osv):
work_dt
=
start_dt
.
replace
(
hour
=
0
,
minute
=
0
,
second
=
0
)
# no calendar: try to use the default_interval, then return directly
if
id
is
None
:
if
not
id
:
working_interval
=
[]
if
default_interval
:
working_interval
=
(
start_dt
.
replace
(
hour
=
default_interval
[
0
],
minute
=
0
,
second
=
0
),
...
...
@@ -462,7 +462,7 @@ class resource_calendar(osv.osv):
working_intervals
=
self
.
get_working_intervals_of_day
(
cr
,
uid
,
id
,
**
call_args
)
if
id
is
None
and
not
working_intervals
:
# no calendar -> consider working 8 hours
if
not
id
and
not
working_intervals
:
# no calendar -> consider working 8 hours
remaining_hours
-=
8.0
elif
working_intervals
:
if
backwards
:
...
...
@@ -556,7 +556,7 @@ class resource_calendar(osv.osv):
compute_leaves
=
compute_leaves
,
resource_id
=
resource_id
,
default_interval
=
default_interval
,
context
=
context
)
if
id
is
None
or
working_intervals
:
# no calendar -> no working hours, but day is considered as worked
if
not
id
or
working_intervals
:
# no calendar -> no working hours, but day is considered as worked
planned_days
+=
1
intervals
+=
working_intervals
# get next day
...
...
This diff is collapsed.
Click to expand it.
openerp/addons/base/tests/test_views.py
+
5
−
0
View file @
5c05e397
...
...
@@ -9,6 +9,7 @@ from lxml.builder import E
from
psycopg2
import
IntegrityError
from
openerp.osv.orm
import
modifiers_tests
from
openerp.exceptions
import
ValidationError
from
openerp.tests
import
common
import
openerp.tools
...
...
@@ -857,6 +858,10 @@ class test_views(ViewCase):
string
=
"
Replacement title
"
,
version
=
"
7.0
"
))
def
test_modifiers
(
self
):
# implemeted elsewhere...
modifiers_tests
()
class
ViewModeField
(
ViewCase
):
"""
This should probably, eventually, be folded back into other test case
...
...
This diff is collapsed.
Click to expand it.
openerp/osv/orm.py
+
4
−
4
View file @
5c05e397
...
...
@@ -118,13 +118,13 @@ def test_modifiers(what, expected):
node
=
etree
.
fromstring
(
what
)
transfer_node_to_modifiers
(
node
,
modifiers
)
simplify_modifiers
(
modifiers
)
json
=
simplejson
.
dumps
(
modifiers
)
assert
json
==
expected
,
"
%s != %s
"
%
(
json
,
expected
)
dumped
=
simplejson
.
dumps
(
modifiers
)
assert
dumped
==
expected
,
"
%s != %s
"
%
(
dumped
,
expected
)
elif
isinstance
(
what
,
dict
):
transfer_field_to_modifiers
(
what
,
modifiers
)
simplify_modifiers
(
modifiers
)
json
=
simplejson
.
dumps
(
modifiers
)
assert
json
==
expected
,
"
%s != %s
"
%
(
json
,
expected
)
dumped
=
simplejson
.
dumps
(
modifiers
)
assert
dumped
==
expected
,
"
%s != %s
"
%
(
dumped
,
expected
)
# To use this test:
...
...
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