Browse Source
Merge pull request #139 from alejandrosantana/8.0
Merge pull request #139 from alejandrosantana/8.0
[PRT] super_calendar: Ported to v8.0pull/222/head
Sandy
9 years ago
24 changed files with 1050 additions and 381 deletions
-
1__unported__/super_calendar/AUTHORS.txt
-
88__unported__/super_calendar/__openerp__.py
-
163__unported__/super_calendar/super_calendar.py
-
90super_calendar/README.rst
-
3super_calendar/__init__.py
-
52super_calendar/__openerp__.py
-
0super_calendar/data/cron_data.xml
-
233super_calendar/i18n/fr.po
-
0super_calendar/i18n/it.po
-
0super_calendar/i18n/ru.po
-
185super_calendar/i18n/super_calendar.pot
-
11super_calendar/models/__init__.py
-
74super_calendar/models/super_calendar.py
-
176super_calendar/models/super_calendar_configurator.py
-
85super_calendar/models/super_calendar_configurator_line.py
-
0super_calendar/security/ir.model.access.csv
-
BINsuper_calendar/static/description/icon.png
-
BINsuper_calendar/static/description/meetings.png
-
BINsuper_calendar/static/description/month_calendar.png
-
BINsuper_calendar/static/description/phone_calls.png
-
BINsuper_calendar/static/description/week_calendar.png
-
7super_calendar/tests/__init__.py
-
159super_calendar/tests/test_super_calendar.py
-
72super_calendar/views/super_calendar_view.xml
@ -1 +0,0 @@ |
|||
Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
@ -1,88 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
|||
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as published |
|||
# by the Free Software Foundation, either version 3 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
{ |
|||
'name': "Super Calendar", |
|||
'version': '0.1', |
|||
'category': 'Generic Modules/Others', |
|||
'summary': 'This module allows to create configurable calendars.', |
|||
'description': """ |
|||
This module allows to create configurable calendars. |
|||
|
|||
Through the 'calendar configurator' object, you can specify which models have |
|||
to be merged in the super calendar. For each model, you have to define the |
|||
'description' and 'date_start' fields at least. Then you can define 'duration' |
|||
and the 'user_id' fields. |
|||
|
|||
The 'super.calendar' object contains the the merged calendars. The |
|||
'super.calendar' can be updated by 'ir.cron' or manually. |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
After installing the module you can go to |
|||
|
|||
Super calendar → Configuration → Configurators |
|||
|
|||
and create a new configurator. For instance, if you want to see meetings and |
|||
phone calls, you can create the following lines |
|||
|
|||
.. image:: http://planet.domsense.com/wp-content/uploads/2012/04/meetings.png |
|||
:width: 400 px |
|||
|
|||
.. image:: http://planet.domsense.com/wp-content/uploads/2012/04/phone_calls.png |
|||
:width: 400 px |
|||
|
|||
Then, you can use the ‘Generate Calendar’ button or wait for the scheduled |
|||
action (‘Generate Calendar Records’) to be run. |
|||
|
|||
When the calendar is generated, you can visualize it by the ‘super calendar’ main menu. |
|||
|
|||
Here is a sample monthly calendar: |
|||
|
|||
.. image:: http://planet.domsense.com/wp-content/uploads/2012/04/month_calendar.png |
|||
:width: 400 px |
|||
|
|||
And here is the weekly one: |
|||
|
|||
.. image:: http://planet.domsense.com/wp-content/uploads/2012/04/week_calendar.png |
|||
:width: 400 px |
|||
|
|||
As you can see, several filters are available. A typical usage consists in |
|||
filtering by ‘Configurator’ (if you have several configurators, |
|||
‘Scheduled calls and meetings’ can be one of them) and by your user. |
|||
Once you filtered, you can save the filter as ‘Advanced filter’ or even |
|||
add it to a dashboard. |
|||
""", |
|||
'author': "Agile Business Group,Odoo Community Association (OCA)", |
|||
'website': 'http://www.agilebg.com', |
|||
'license': 'AGPL-3', |
|||
'depends': ['base'], |
|||
"data": [ |
|||
'super_calendar_view.xml', |
|||
'cron_data.xml', |
|||
'security/ir.model.access.csv', |
|||
], |
|||
'demo': [], |
|||
'test': [], |
|||
'installable': False, |
|||
'application': True, |
|||
'auto_install': False, |
|||
} |
@ -1,163 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
|||
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as published |
|||
# by the Free Software Foundation, either version 3 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.osv import fields, orm |
|||
from openerp.tools.translate import _ |
|||
import logging |
|||
from mako.template import Template |
|||
from datetime import datetime |
|||
from openerp import tools |
|||
from openerp.tools.safe_eval import safe_eval |
|||
|
|||
|
|||
def _models_get(self, cr, uid, context=None): |
|||
obj = self.pool.get('ir.model') |
|||
ids = obj.search(cr, uid, []) |
|||
res = obj.read(cr, uid, ids, ['model', 'name'], context) |
|||
return [(r['model'], r['name']) for r in res] |
|||
|
|||
|
|||
class super_calendar_configurator(orm.Model): |
|||
_logger = logging.getLogger('super.calendar') |
|||
_name = 'super.calendar.configurator' |
|||
_columns = { |
|||
'name': fields.char('Name', size=64, required=True), |
|||
'line_ids': fields.one2many('super.calendar.configurator.line', 'configurator_id', 'Lines'), |
|||
} |
|||
|
|||
def generate_calendar_records(self, cr, uid, ids, context=None): |
|||
configurator_ids = self.search(cr, uid, []) |
|||
super_calendar_pool = self.pool.get('super.calendar') |
|||
|
|||
# removing old records |
|||
super_calendar_ids = super_calendar_pool.search(cr, uid, [], context=context) |
|||
super_calendar_pool.unlink(cr, uid, super_calendar_ids, context=context) |
|||
|
|||
for configurator in self.browse(cr, uid, configurator_ids, context): |
|||
for line in configurator.line_ids: |
|||
current_pool = self.pool.get(line.name.model) |
|||
current_record_ids = current_pool.search( |
|||
cr, |
|||
uid, |
|||
line.domain and safe_eval(line.domain) or [], |
|||
context=context) |
|||
|
|||
for current_record_id in current_record_ids: |
|||
current_record = current_pool.browse(cr, uid, current_record_id, context=context) |
|||
if (line.user_field_id and |
|||
current_record[line.user_field_id.name] and |
|||
current_record[line.user_field_id.name]._table_name != 'res.users'): |
|||
raise orm.except_orm( |
|||
_('Error'), |
|||
_("The 'User' field of record %s (%s) does not refer to res.users") |
|||
% (current_record[line.description_field_id.name], line.name.model)) |
|||
if (((line.description_field_id and current_record[line.description_field_id.name]) or |
|||
line.description_code) and |
|||
current_record[line.date_start_field_id.name]): |
|||
duration = False |
|||
if (not line.duration_field_id and |
|||
line.date_stop_field_id and |
|||
current_record[line.date_start_field_id.name] and |
|||
current_record[line.date_stop_field_id.name]): |
|||
date_start = datetime.strptime( |
|||
current_record[line.date_start_field_id.name], |
|||
tools.DEFAULT_SERVER_DATETIME_FORMAT |
|||
) |
|||
date_stop = datetime.strptime( |
|||
current_record[line.date_stop_field_id.name], |
|||
tools.DEFAULT_SERVER_DATETIME_FORMAT |
|||
) |
|||
duration = (date_stop - date_start).total_seconds() / 3600 |
|||
elif line.duration_field_id: |
|||
duration = current_record[line.duration_field_id.name] |
|||
if line.description_type != 'code': |
|||
name = current_record[line.description_field_id.name] |
|||
else: |
|||
parse_dict = {'o': current_record} |
|||
mytemplate = Template(line.description_code) |
|||
name = mytemplate.render(**parse_dict) |
|||
super_calendar_values = { |
|||
'name': name, |
|||
'model_description': line.description, |
|||
'date_start': current_record[line.date_start_field_id.name], |
|||
'duration': duration, |
|||
'user_id': ( |
|||
line.user_field_id and |
|||
current_record[line.user_field_id.name] and |
|||
current_record[line.user_field_id.name].id or |
|||
False |
|||
), |
|||
'configurator_id': configurator.id, |
|||
'res_id': line.name.model+','+str(current_record['id']), |
|||
'model_id': line.name.id, |
|||
} |
|||
super_calendar_pool.create(cr, uid, super_calendar_values, context=context) |
|||
self._logger.info('Calendar generated') |
|||
return True |
|||
|
|||
|
|||
class super_calendar_configurator_line(orm.Model): |
|||
_name = 'super.calendar.configurator.line' |
|||
_columns = { |
|||
'name': fields.many2one('ir.model', 'Model', required=True), |
|||
'description': fields.char('Description', size=128, required=True), |
|||
'domain': fields.char('Domain', size=512), |
|||
'configurator_id': fields.many2one('super.calendar.configurator', 'Configurator'), |
|||
'description_type': fields.selection([ |
|||
('field', 'Field'), |
|||
('code', 'Code'), |
|||
], string="Description Type"), |
|||
'description_field_id': fields.many2one( |
|||
'ir.model.fields', 'Description field', |
|||
domain="[('model_id', '=', name),('ttype', '=', 'char')]"), |
|||
'description_code': fields.text( |
|||
'Description field', |
|||
help="Use '${o}' to refer to the involved object. E.g.: '${o.project_id.name}'" |
|||
), |
|||
'date_start_field_id': fields.many2one( |
|||
'ir.model.fields', 'Start date field', |
|||
domain="['&','|',('ttype', '=', 'datetime'),('ttype', '=', 'date'),('model_id', '=', name)]", |
|||
required=True), |
|||
'date_stop_field_id': fields.many2one( |
|||
'ir.model.fields', 'End date field', |
|||
domain="['&',('ttype', '=', 'datetime'),('model_id', '=', name)]" |
|||
), |
|||
'duration_field_id': fields.many2one( |
|||
'ir.model.fields', 'Duration field', |
|||
domain="['&',('ttype', '=', 'float'),('model_id', '=', name)]"), |
|||
'user_field_id': fields.many2one( |
|||
'ir.model.fields', 'User field', |
|||
domain="['&',('ttype', '=', 'many2one'),('model_id', '=', name)]"), |
|||
} |
|||
|
|||
|
|||
class super_calendar(orm.Model): |
|||
_name = 'super.calendar' |
|||
_columns = { |
|||
'name': fields.char('Description', size=512, required=True), |
|||
'model_description': fields.char('Model Description', size=128, required=True), |
|||
'date_start': fields.datetime('Start date', required=True), |
|||
'duration': fields.float('Duration'), |
|||
'user_id': fields.many2one('res.users', 'User'), |
|||
'configurator_id': fields.many2one('super.calendar.configurator', 'Configurator'), |
|||
'res_id': fields.reference('Resource', selection=_models_get, size=128), |
|||
'model_id': fields.many2one('ir.model', 'Model'), |
|||
} |
@ -0,0 +1,90 @@ |
|||
SUPER CALENDAR |
|||
============== |
|||
|
|||
This module allows to create configurable calendars. |
|||
|
|||
Through the 'calendar configurator' object, you can specify which models have |
|||
to be merged in the super calendar. For each model, you have to define the |
|||
'description' and 'date_start' fields at least. Then you can define 'duration' |
|||
and the 'user_id' fields. |
|||
|
|||
The 'super.calendar' object contains the merged calendars. The |
|||
'super.calendar' can be updated by 'ir.cron' or manually. |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
After installing the module you can go to |
|||
|
|||
*Super calendar > Configuration > Configurators* |
|||
|
|||
and create a new configurator. For instance, if you want to see meetings and |
|||
phone calls, you can create the following lines |
|||
|
|||
Meetings: |
|||
|
|||
.. image:: super_calendar/static/description/meetings.png |
|||
:width: 400 px |
|||
|
|||
Phonecalls: |
|||
|
|||
.. image:: super_calendar/static/description/phone_calls.png |
|||
:width: 400 px |
|||
|
|||
Then, you can use the 'Generate Calendar' button or wait for the scheduled |
|||
action (‘Generate Calendar Records’) to be run. |
|||
|
|||
When the calendar is generated, you can visualize it by the 'super calendar' main menu. |
|||
|
|||
Here is a sample monthly calendar: |
|||
|
|||
.. image:: super_calendar/static/description/month_calendar.png |
|||
:width: 400 px |
|||
|
|||
And here is the weekly one: |
|||
|
|||
.. image:: super_calendar/static/description/week_calendar.png |
|||
:width: 400 px |
|||
|
|||
As you can see, several filters are available. A typical usage consists in |
|||
filtering by 'Configurator' (if you have several configurators, |
|||
'Scheduled calls and meetings' can be one of them) and by your user. |
|||
Once you filtered, you can save the filter as 'Advanced filter' or even |
|||
add it to a dashboard. |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_. |
|||
In case of trouble, please check there if your issue has already been reported. |
|||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback |
|||
`here <https://github.com/OCA/server-tools/issues/new?body=module:%20super_calendar%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
* Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
|||
* Alejandro Santana <alejandrosantana@anubia.es> |
|||
* Agathe Mollé <agathe.molle@savoirfairelinux.com> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: http://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: http://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit http://odoo-community.org. |
|||
|
|||
Icon |
|||
---- |
|||
Module icon from WebIconSet.com: http://www.webiconset.com/mobile-icon-set/ |
@ -0,0 +1,52 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Copyright (c) All rights reserved: |
|||
# (c) 2012-2015 Agile Business Group sagl (<http://www.agilebg.com>) |
|||
# Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
|||
# (c) 2012 Domsense srl (<http://www.domsense.com>) |
|||
# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es) |
|||
# Alejandro Santana <alejandrosantana@anubia.es> |
|||
# (c) 2015 Savoir-faire Linux <http://www.savoirfairelinux.com>) |
|||
# Agathe Mollé <agathe.molle@savoirfairelinux.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see http://www.gnu.org/licenses |
|||
# |
|||
############################################################################## |
|||
{ |
|||
'name': 'Super Calendar', |
|||
'version': '0.2', |
|||
'category': 'Generic Modules/Others', |
|||
'summary': 'This module allows to create configurable calendars.', |
|||
'author': ('Agile Business Group, ' |
|||
'Alejandro Santana, ' |
|||
'Agathe Mollé, ' |
|||
'Odoo Community Association (OCA)'), |
|||
'website': 'http://www.agilebg.com', |
|||
'license': 'AGPL-3', |
|||
'depends': [ |
|||
'base', |
|||
'web_calendar', |
|||
], |
|||
'data': [ |
|||
'views/super_calendar_view.xml', |
|||
'data/cron_data.xml', |
|||
'security/ir.model.access.csv', |
|||
], |
|||
'demo': [], |
|||
'test': [], |
|||
'installable': True, |
|||
'application': True, |
|||
'auto_install': False, |
|||
} |
@ -0,0 +1,233 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * super_calendar |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-06-19 15:56+0000\n" |
|||
"PO-Revision-Date: 2015-06-19 12:06-0500\n" |
|||
"Last-Translator: Agathe Mollé <agathe.molle@savoirfairelinux.com>\n" |
|||
"Language-Team: Savoir-faire Linux <support@savoirfairelinux.com>\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: nplurals=2; plural=(n > 1);\n" |
|||
"X-Generator: Poedit 1.5.4\n" |
|||
"Language: fr\n" |
|||
"X-Poedit-SourceCharset: UTF-8\n" |
|||
|
|||
#. module: super_calendar |
|||
#: model:ir.ui.menu,name:super_calendar.super_calendar_calendar |
|||
#: model:ir.ui.menu,name:super_calendar.super_calendar_calendar_calendar |
|||
#: view:super.calendar:super_calendar.super_calendar |
|||
#: view:super.calendar:super_calendar.super_calendar_form |
|||
#: view:super.calendar:super_calendar.super_calendar_tree |
|||
msgid "Calendar" |
|||
msgstr "Calendrier" |
|||
|
|||
#. module: super_calendar |
|||
#: model:ir.actions.act_window,name:super_calendar.super_calendar_configurator |
|||
msgid "Calendar Configurators" |
|||
msgstr "Configurateurs de Calendrier" |
|||
|
|||
#. module: super_calendar |
|||
#: selection:super.calendar.configurator.line,description_type:0 |
|||
msgid "Code" |
|||
msgstr "Code" |
|||
|
|||
#. module: super_calendar |
|||
#: model:ir.ui.menu,name:super_calendar.super_calendar_configuration |
|||
msgid "Configuration" |
|||
msgstr "Configuration" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,configurator_id:0 |
|||
#: view:super.calendar.configurator:super_calendar.super_calendar_configurator_form |
|||
#: field:super.calendar.configurator.line,configurator_id:0 |
|||
msgid "Configurator" |
|||
msgstr "Configurateur" |
|||
|
|||
#. module: super_calendar |
|||
#: model:ir.ui.menu,name:super_calendar.super_calendar_configurators |
|||
#: view:super.calendar.configurator:super_calendar.super_calendar_configurator_tree |
|||
msgid "Configurators" |
|||
msgstr "Configurateurs" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,create_uid:0 |
|||
#: field:super.calendar.configurator,create_uid:0 |
|||
#: field:super.calendar.configurator.line,create_uid:0 |
|||
msgid "Created by" |
|||
msgstr "Créé par" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,create_date:0 |
|||
#: field:super.calendar.configurator,create_date:0 |
|||
#: field:super.calendar.configurator.line,create_date:0 |
|||
msgid "Created on" |
|||
msgstr "Créé le" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,name:0 |
|||
#: view:super.calendar.configurator:super_calendar.super_calendar_configurator_form |
|||
#: field:super.calendar.configurator.line,description:0 |
|||
msgid "Description" |
|||
msgstr "Description" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator.line,description_type:0 |
|||
msgid "Description Type" |
|||
msgstr "Type de Description" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator.line,description_code:0 |
|||
#: field:super.calendar.configurator.line,description_field_id:0 |
|||
msgid "Description field" |
|||
msgstr "Champ Description" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator.line,domain:0 |
|||
msgid "Domain" |
|||
msgstr "Domaine" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,duration:0 |
|||
msgid "Duration" |
|||
msgstr "Durée" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator.line,duration_field_id:0 |
|||
msgid "Duration field" |
|||
msgstr "Champ Durée" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator.line,date_stop_field_id:0 |
|||
msgid "End date field" |
|||
msgstr "Champ Date de fin" |
|||
|
|||
#. module: super_calendar |
|||
#: code:addons/super_calendar/models/super_calendar.py:100 |
|||
#, python-format |
|||
msgid "Error" |
|||
msgstr "Erreur" |
|||
|
|||
#. module: super_calendar |
|||
#: view:super.calendar:super_calendar.super_calendar_search |
|||
msgid "Extended Filters..." |
|||
msgstr "Filtres étendus..." |
|||
|
|||
#. module: super_calendar |
|||
#: selection:super.calendar.configurator.line,description_type:0 |
|||
msgid "Field" |
|||
msgstr "Champ" |
|||
|
|||
#. module: super_calendar |
|||
#: view:super.calendar.configurator:super_calendar.super_calendar_configurator_form |
|||
msgid "Generate Calendar" |
|||
msgstr "Générer le calendrier" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,id:0 field:super.calendar.configurator,id:0 |
|||
#: field:super.calendar.configurator.line,id:0 |
|||
msgid "ID" |
|||
msgstr "ID" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,write_uid:0 |
|||
#: field:super.calendar.configurator,write_uid:0 |
|||
#: field:super.calendar.configurator.line,write_uid:0 |
|||
msgid "Last Updated by" |
|||
msgstr "Dernière mise à jour par" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,write_date:0 |
|||
#: field:super.calendar.configurator,write_date:0 |
|||
#: field:super.calendar.configurator.line,write_date:0 |
|||
msgid "Last Updated on" |
|||
msgstr "Dernière mise à jour le" |
|||
|
|||
#. module: super_calendar |
|||
#: view:super.calendar.configurator:super_calendar.super_calendar_configurator_form |
|||
msgid "Line" |
|||
msgstr "Ligne" |
|||
|
|||
#. module: super_calendar |
|||
#: view:super.calendar.configurator:super_calendar.super_calendar_configurator_form |
|||
#: field:super.calendar.configurator,line_ids:0 |
|||
msgid "Lines" |
|||
msgstr "Lignes" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,model_id:0 |
|||
#: field:super.calendar.configurator.line,name:0 |
|||
msgid "Model" |
|||
msgstr "Modèle" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,model_description:0 |
|||
msgid "Model Description" |
|||
msgstr "Description du modèle" |
|||
|
|||
#. module: super_calendar |
|||
#: view:super.calendar:super_calendar.super_calendar_search |
|||
msgid "My Items" |
|||
msgstr "Mes éléments" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator,name:0 |
|||
msgid "Name" |
|||
msgstr "Nom" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,res_id:0 |
|||
msgid "Resource" |
|||
msgstr "Ressource" |
|||
|
|||
#. module: super_calendar |
|||
#: view:super.calendar:super_calendar.super_calendar_search |
|||
msgid "Search Calendar" |
|||
msgstr "Recherche de calendrier" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,date_start:0 |
|||
msgid "Start date" |
|||
msgstr "Date de début" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator.line,date_start_field_id:0 |
|||
msgid "Start date field" |
|||
msgstr "Champ Date de début" |
|||
|
|||
#. module: super_calendar |
|||
#: model:ir.actions.act_window,name:super_calendar.super_calendar_action |
|||
#: model:ir.ui.menu,name:super_calendar.super_calendar_menu |
|||
msgid "Super Calendar" |
|||
msgstr "Super Calendrier" |
|||
|
|||
#. module: super_calendar |
|||
#: code:addons/super_calendar/models/super_calendar.py:101 |
|||
#, python-format |
|||
msgid "The 'User' field of record %s (%s) does not refer to res.users" |
|||
msgstr "" |
|||
"Le champ 'Utilisateur' de l'enregistrement %s (%s) ne réfère pas à res.users" |
|||
|
|||
#. module: super_calendar |
|||
#: view:super.calendar.configurator:super_calendar.super_calendar_configurator_form |
|||
#: help:super.calendar.configurator.line,description_code:0 |
|||
msgid "" |
|||
"Use '${o}' to refer to the involved object. E.g.: '${o.project_id.name}'" |
|||
msgstr "" |
|||
"Utilisez '${o}' pour référer à l'objet concerné. Par exemple : '${o." |
|||
"project_id.name}'" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar,user_id:0 |
|||
msgid "User" |
|||
msgstr "Utilisateur" |
|||
|
|||
#. module: super_calendar |
|||
#: field:super.calendar.configurator.line,user_field_id:0 |
|||
msgid "User field" |
|||
msgstr "Champ Utilisateur" |
@ -0,0 +1,11 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################ |
|||
# License, author and contributors information in: # |
|||
# __openerp__.py file at the root folder of this module. # |
|||
################################################################ |
|||
|
|||
from . import ( |
|||
super_calendar, |
|||
super_calendar_configurator, |
|||
super_calendar_configurator_line, |
|||
) |
@ -0,0 +1,74 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Odoo, Open Source Management Solution |
|||
# |
|||
# Copyright (c) All rights reserved: |
|||
# (c) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
|||
# (c) 2012 Domsense srl (<http://www.domsense.com>) |
|||
# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es) |
|||
# Alejandro Santana <alejandrosantana@anubia.es> |
|||
# (c) 2015 Savoir-faire Linux <http://www.savoirfairelinux.com>) |
|||
# Agathe Mollé <agathe.molle@savoirfairelinux.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see http://www.gnu.org/licenses |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp import fields, models |
|||
|
|||
|
|||
def _models_get(self): |
|||
model_obj = self.env['ir.model'] |
|||
model_list = model_obj.search([]) |
|||
return [(model.model, model.name) for model in model_list] |
|||
|
|||
|
|||
class SuperCalendar(models.Model): |
|||
_name = 'super.calendar' |
|||
|
|||
name = fields.Char( |
|||
string='Description', |
|||
required=True, |
|||
readonly=True, |
|||
) |
|||
date_start = fields.Datetime( |
|||
string='Start date', |
|||
required=True, |
|||
readonly=True, |
|||
) |
|||
duration = fields.Float( |
|||
string='Duration', |
|||
readonly=True, |
|||
) |
|||
user_id = fields.Many2one( |
|||
comodel_name='res.users', |
|||
string='User', |
|||
readonly=True, |
|||
) |
|||
configurator_id = fields.Many2one( |
|||
comodel_name='super.calendar.configurator', |
|||
string='Configurator', |
|||
readonly=True, |
|||
) |
|||
res_id = fields.Reference( |
|||
selection=_models_get, |
|||
string='Resource', |
|||
readonly=True, |
|||
) |
|||
model_id = fields.Many2one( |
|||
comodel_name='ir.model', |
|||
string='Model', |
|||
readonly=True, |
|||
) |
@ -0,0 +1,176 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Odoo, Open Source Management Solution |
|||
# |
|||
# Copyright (c) All rights reserved: |
|||
# (c) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
|||
# (c) 2012 Domsense srl (<http://www.domsense.com>) |
|||
# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es) |
|||
# Alejandro Santana <alejandrosantana@anubia.es> |
|||
# (c) 2015 Savoir-faire Linux <http://www.savoirfairelinux.com>) |
|||
# Agathe Mollé <agathe.molle@savoirfairelinux.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see http://www.gnu.org/licenses |
|||
# |
|||
############################################################################## |
|||
|
|||
import logging |
|||
from datetime import datetime |
|||
from pytz import timezone, utc |
|||
from mako.template import Template |
|||
from openerp import _, api, exceptions, fields, models, tools |
|||
from openerp.tools.safe_eval import safe_eval |
|||
|
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class SuperCalendarConfigurator(models.Model): |
|||
_name = 'super.calendar.configurator' |
|||
|
|||
name = fields.Char( |
|||
string='Name', |
|||
required=True, |
|||
) |
|||
line_ids = fields.One2many( |
|||
comodel_name='super.calendar.configurator.line', |
|||
inverse_name='configurator_id', |
|||
string='Lines', |
|||
) |
|||
|
|||
def _clear_super_calendar_records(self): |
|||
""" |
|||
Remove old super_calendar records |
|||
""" |
|||
super_calendar_pool = self.env['super.calendar'] |
|||
super_calendar_list = super_calendar_pool.search([]) |
|||
super_calendar_list.unlink() |
|||
|
|||
@api.multi |
|||
def generate_calendar_records(self): |
|||
""" |
|||
At every CRON execution, every 'super calendar' data is deleted and |
|||
regenerated again. |
|||
""" |
|||
|
|||
# Remove old records |
|||
self._clear_super_calendar_records() |
|||
|
|||
# Rebuild all calendar records |
|||
configurator_list = self.search([]) |
|||
for configurator in configurator_list: |
|||
for line in configurator.line_ids: |
|||
configurator._generate_record_from_line(line) |
|||
_logger.info('Calendar generated') |
|||
return True |
|||
|
|||
@api.multi |
|||
def _generate_record_from_line(self, line): |
|||
""" |
|||
Create super_calendar records from super_calendar_configurator_line |
|||
objects. |
|||
""" |
|||
super_calendar_pool = self.env['super.calendar'] |
|||
values = self._get_record_values_from_line(line) |
|||
for record in values: |
|||
super_calendar_pool.create(values[record]) |
|||
|
|||
@api.multi |
|||
def _get_record_values_from_line(self, line): |
|||
""" |
|||
Get super_calendar fields values from super_calendar_configurator_line |
|||
objects. |
|||
Check if the User value is a res.users. |
|||
""" |
|||
res = {} |
|||
current_pool = self.env[line.name.model] |
|||
domain = line.domain and safe_eval(line.domain) or [] |
|||
current_record_list = current_pool.search(domain) |
|||
for cur_rec in current_record_list: |
|||
f_user = line.user_field_id.name |
|||
f_descr = line.description_field_id.name |
|||
f_date_start = line.date_start_field_id.name |
|||
f_date_stop = line.date_stop_field_id.name |
|||
f_duration = line.duration_field_id.name |
|||
|
|||
# Check if f_user refer to a res.users |
|||
if (f_user and cur_rec[f_user] and |
|||
cur_rec[f_user]._model._name != 'res.users'): |
|||
raise exceptions.ValidationError( |
|||
_("The 'User' field of record %s (%s) " |
|||
"does not refer to res.users") |
|||
% (cur_rec[f_descr], line.name.model)) |
|||
|
|||
if ((cur_rec[f_descr] or line.description_code) and |
|||
cur_rec[f_date_start]): |
|||
duration = False |
|||
|
|||
if line.date_start_field_id.ttype == 'date': |
|||
date_format = tools.DEFAULT_SERVER_DATE_FORMAT |
|||
else: |
|||
date_format = tools.DEFAULT_SERVER_DATETIME_FORMAT |
|||
date_start = datetime.strptime( |
|||
cur_rec[f_date_start], date_format |
|||
) |
|||
|
|||
if (not line.duration_field_id and |
|||
line.date_stop_field_id and |
|||
cur_rec[f_date_start] and |
|||
cur_rec[f_date_stop]): |
|||
if line.date_stop_field_id.ttype == 'date': |
|||
date_format = tools.DEFAULT_SERVER_DATE_FORMAT |
|||
else: |
|||
date_format = tools.DEFAULT_SERVER_DATETIME_FORMAT |
|||
date_stop = datetime.strptime( |
|||
cur_rec[f_date_stop], date_format |
|||
) |
|||
date_diff = (date_stop - date_start) |
|||
duration = date_diff.total_seconds() / 3600 |
|||
|
|||
elif line.duration_field_id: |
|||
duration = cur_rec[f_duration] |
|||
|
|||
if line.description_type != 'code': |
|||
name = cur_rec[f_descr] |
|||
else: |
|||
parse_dict = {'o': cur_rec} |
|||
mytemplate = Template(line.description_code) |
|||
name = mytemplate.render(**parse_dict) |
|||
|
|||
# Convert date_start to UTC timezone if it is a date field |
|||
# in order to be stored in UTC in the database |
|||
if line.date_start_field_id.ttype == 'date': |
|||
tz = timezone(self._context.get('tz') |
|||
or self.env.user.tz |
|||
or 'UTC') |
|||
local_date_start = tz.localize(date_start) |
|||
utc_date_start = local_date_start.astimezone(utc) |
|||
date_start = utc_date_start |
|||
date_start = datetime.strftime( |
|||
date_start, |
|||
tools.DEFAULT_SERVER_DATETIME_FORMAT |
|||
) |
|||
|
|||
super_calendar_values = { |
|||
'name': name, |
|||
'date_start': date_start, |
|||
'duration': duration, |
|||
'user_id': (f_user and cur_rec[f_user].id), |
|||
'configurator_id': self.id, |
|||
'res_id': line.name.model + ',' + str(cur_rec['id']), |
|||
'model_id': line.name.id, |
|||
} |
|||
res[cur_rec] = super_calendar_values |
|||
return res |
@ -0,0 +1,85 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Odoo, Open Source Management Solution |
|||
# |
|||
# Copyright (c) All rights reserved: |
|||
# (c) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
|||
# (c) 2012 Domsense srl (<http://www.domsense.com>) |
|||
# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es) |
|||
# Alejandro Santana <alejandrosantana@anubia.es> |
|||
# (c) 2015 Savoir-faire Linux <http://www.savoirfairelinux.com>) |
|||
# Agathe Mollé <agathe.molle@savoirfairelinux.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see http://www.gnu.org/licenses |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp import fields, models |
|||
|
|||
|
|||
class SuperCalendarConfiguratorLine(models.Model): |
|||
_name = 'super.calendar.configurator.line' |
|||
|
|||
name = fields.Many2one( |
|||
comodel_name='ir.model', |
|||
string='Model', |
|||
required=True, |
|||
) |
|||
domain = fields.Char( |
|||
string='Domain', |
|||
) |
|||
configurator_id = fields.Many2one( |
|||
comodel_name='super.calendar.configurator', |
|||
string='Configurator', |
|||
) |
|||
description_type = fields.Selection( |
|||
[('field', 'Field'), |
|||
('code', 'Code')], |
|||
string="Description Type", |
|||
default='field', |
|||
) |
|||
description_field_id = fields.Many2one( |
|||
comodel_name='ir.model.fields', |
|||
string='Description field', |
|||
domain="[('ttype', 'in', ('char', 'text')), ('model_id', '=', name)]", |
|||
) |
|||
description_code = fields.Text( |
|||
string='Description field', |
|||
help=("""Use '${o}' to refer to the involved object. |
|||
E.g.: '${o.project_id.name}'"""), |
|||
) |
|||
date_start_field_id = fields.Many2one( |
|||
comodel_name='ir.model.fields', |
|||
string='Start date field', |
|||
domain="[('ttype', 'in', ('datetime', 'date')), " |
|||
"('model_id', '=', name)]", |
|||
required=True, |
|||
) |
|||
date_stop_field_id = fields.Many2one( |
|||
comodel_name='ir.model.fields', |
|||
string='End date field', |
|||
domain="[('ttype', 'in', ('datetime', 'date')), " |
|||
"('model_id', '=', name)]", |
|||
) |
|||
duration_field_id = fields.Many2one( |
|||
comodel_name='ir.model.fields', |
|||
string='Duration field', |
|||
domain="[('ttype', '=', 'float'), ('model_id', '=', name)]", |
|||
) |
|||
user_field_id = fields.Many2one( |
|||
comodel_name='ir.model.fields', |
|||
string='User field', |
|||
domain="[('ttype', '=', 'many2one'), ('model_id', '=', name)]", |
|||
) |
After Width: 128 | Height: 128 | Size: 14 KiB |
After Width: 896 | Height: 360 | Size: 27 KiB |
After Width: 1397 | Height: 859 | Size: 92 KiB |
After Width: 897 | Height: 361 | Size: 28 KiB |
After Width: 1396 | Height: 860 | Size: 81 KiB |
@ -0,0 +1,7 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################ |
|||
# License, author and contributors information in: # |
|||
# __openerp__.py file at the root folder of this module. # |
|||
################################################################ |
|||
|
|||
from . import test_super_calendar |
@ -0,0 +1,159 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Odoo, Open Source Management Solution |
|||
# |
|||
# Copyright (c) All rights reserved: |
|||
# (c) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
|||
# (c) 2012 Domsense srl (<http://www.domsense.com>) |
|||
# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es) |
|||
# Alejandro Santana <alejandrosantana@anubia.es> |
|||
# (c) 2015 Savoir-faire Linux <http://www.savoirfairelinux.com>) |
|||
# Agathe Mollé <agathe.molle@savoirfairelinux.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see http://www.gnu.org/licenses |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.tests import TransactionCase |
|||
from datetime import datetime |
|||
from dateutil.relativedelta import relativedelta |
|||
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, \ |
|||
DEFAULT_SERVER_DATE_FORMAT |
|||
|
|||
|
|||
class TestSuperCalendar(TransactionCase): |
|||
|
|||
def setUp(self): |
|||
super(TestSuperCalendar, self).setUp() |
|||
|
|||
self.PartnerObj = self.env['res.partner'] |
|||
self.SuperCalendarObj = self.env['super.calendar'] |
|||
self.SuperCalendarConfiguratorObj = self.env[ |
|||
'super.calendar.configurator'] |
|||
self.SuperCalendarConfiguratorLineObj = self.env[ |
|||
'super.calendar.configurator.line'] |
|||
self.ModelFieldsObj = self.env['ir.model.fields'] |
|||
self.ModelObj = self.env['ir.model'] |
|||
|
|||
self.partner_A = self.env.ref("base.main_partner") |
|||
self.partner_A.write({ |
|||
'date': (datetime.today() + relativedelta(days=3)), |
|||
}) |
|||
|
|||
self.super_calendar_configurator = \ |
|||
self.SuperCalendarConfiguratorObj.create({ |
|||
'name': 'Partners', |
|||
}) |
|||
|
|||
self.partner_model = self.ModelObj.search([ |
|||
('model', '=', 'res.partner') |
|||
]) |
|||
self.date_start_field = self.ModelFieldsObj.search([ |
|||
('name', '=', 'write_date'), |
|||
('model', '=', 'res.partner'), |
|||
]) |
|||
self.description_field = self.ModelFieldsObj.search([ |
|||
('name', '=', 'name'), |
|||
('model', '=', 'res.partner'), |
|||
]) |
|||
|
|||
self.super_calendar_configurator_line = \ |
|||
self.SuperCalendarConfiguratorLineObj.create({ |
|||
'name': self.partner_model.id, |
|||
'date_start_field_id': self.date_start_field.id, |
|||
'description_field_id': self.description_field.id, |
|||
'configurator_id': self.super_calendar_configurator.id, |
|||
'domain': [('name', '=', self.partner_A.name)] |
|||
}) |
|||
|
|||
def test_get_record_values_from_line(self): |
|||
""" |
|||
Test if record values are correctly computed |
|||
""" |
|||
# Test without any date_stop or duration |
|||
values_partner_a = { |
|||
'configurator_id': self.super_calendar_configurator.id, |
|||
'date_start': self.partner_A.write_date, |
|||
'duration': False, |
|||
'model_id': self.partner_model.id, |
|||
'name': self.partner_A.name, |
|||
'res_id': self.partner_model.model+','+str(self.partner_A.id), |
|||
'user_id': False |
|||
} |
|||
self.assertEqual( |
|||
self.super_calendar_configurator._get_record_values_from_line( |
|||
self.super_calendar_configurator.line_ids[0] |
|||
)[self.partner_A], |
|||
values_partner_a |
|||
) |
|||
|
|||
# Add a date_stop |
|||
self.date_stop_field = self.ModelFieldsObj.search([ |
|||
('name', '=', 'date'), |
|||
('model', '=', 'res.partner'), |
|||
]) |
|||
start_date = datetime.strptime(self.partner_A.write_date, |
|||
DEFAULT_SERVER_DATETIME_FORMAT) |
|||
stop_date = datetime.strptime(self.partner_A.date, |
|||
DEFAULT_SERVER_DATE_FORMAT) |
|||
date_diff = (stop_date - start_date) |
|||
self.super_calendar_configurator_line.write({ |
|||
'date_stop_field_id': self.date_stop_field.id, |
|||
}) |
|||
values_partner_a['duration'] = date_diff.total_seconds() / 3600 |
|||
self.assertEqual( |
|||
self.super_calendar_configurator._get_record_values_from_line( |
|||
self.super_calendar_configurator.line_ids[0] |
|||
)[self.partner_A], |
|||
values_partner_a |
|||
) |
|||
|
|||
# Test description code |
|||
self.super_calendar_configurator2 = \ |
|||
self.SuperCalendarConfiguratorObj.create({ |
|||
'name': 'Partners 2', |
|||
}) |
|||
self.super_calendar_configurator_line2 = \ |
|||
self.SuperCalendarConfiguratorLineObj.create({ |
|||
'name': self.partner_model.id, |
|||
'date_start_field_id': self.date_start_field.id, |
|||
'description_type': 'code', |
|||
'description_code': '${o.email}', |
|||
'configurator_id': self.super_calendar_configurator2.id, |
|||
'domain': [('name', '=', self.partner_A.name)] |
|||
}) |
|||
values_partner_a['name'] = self.partner_A.email |
|||
values_partner_a['duration'] = False |
|||
values_partner_a['configurator_id'] = \ |
|||
self.super_calendar_configurator2.id |
|||
self.assertEqual( |
|||
self.super_calendar_configurator2._get_record_values_from_line( |
|||
self.super_calendar_configurator2.line_ids[0] |
|||
)[self.partner_A], |
|||
values_partner_a |
|||
) |
|||
|
|||
def test_generate_calendar_records(self): |
|||
""" |
|||
Test if calendar records are effectively created |
|||
""" |
|||
self.super_calendar_configurator.generate_calendar_records() |
|||
super_calendar_record = self.SuperCalendarObj.search([ |
|||
('name', '=', self.partner_A.name) |
|||
]) |
|||
self.assertEqual( |
|||
super_calendar_record.date_start, |
|||
self.partner_A.write_date |
|||
) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue