diff --git a/CHANGELOG b/CHANGELOG index 6528d1abe6..7776d3fdc0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Allow to define the text color and background color in calendar view * Allow to override cache implementation * Add button rule * Allow to specify translatable languages in trytond-admin diff --git a/doc/topics/views/index.rst b/doc/topics/views/index.rst index 82bf8dd438..ccf9190e33 100644 --- a/doc/topics/views/index.rst +++ b/doc/topics/views/index.rst @@ -771,6 +771,12 @@ Each calendar view must start with this tag. * ``mode``: An optional name for the view that will be used first. Available views are: `week` and `month`. The default value is `month`. + * ``color``: An optional field name that contains the text color for the + event. The default value is `black`. + + * ``background_color``: An optional field name that contains the background + color for the event. The default value is `lightblue`. + field ^^^^^ diff --git a/trytond/ir/ui/calendar.rnc b/trytond/ir/ui/calendar.rnc index 35f8a85164..da16cad0a8 100644 --- a/trytond/ir/ui/calendar.rnc +++ b/trytond/ir/ui/calendar.rnc @@ -8,6 +8,10 @@ attlist.calendar &= attlist.calendar &= attribute mode { "week" | "month" }? +attlist.calendar &= + [ a:defaultValue = "black" ] attribute color { text }? +attlist.calendar &= + [ a:defaultValue = "lightblue" ] attribute background_color { text }? field = element field { attlist.field, empty } attlist.field &= attribute name { text } data = element data { attlist.data, xpath* } diff --git a/trytond/ir/ui/calendar.rng b/trytond/ir/ui/calendar.rng index 43127a3eba..800d86ce7a 100644 --- a/trytond/ir/ui/calendar.rng +++ b/trytond/ir/ui/calendar.rng @@ -26,6 +26,16 @@ + + + + + + + + + + diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py index b403051c32..8a2c2b4ca7 100644 --- a/trytond/model/modelview.py +++ b/trytond/model/modelview.py @@ -587,7 +587,7 @@ class ModelView(Model): fields_attrs.setdefault(element.get('sequence'), {}) if element.tag == 'calendar': - for attr in ('dtstart', 'dtend'): + for attr in ['dtstart', 'dtend', 'color', 'background_color']: if element.get(attr): fields_attrs.setdefault(element.get(attr), {})