[IMP]GOLEM Activity : type are now dynamics and configurables

This commit is contained in:
Fabien Bourgeois 2017-06-05 11:22:34 +02:00
parent 11b8643d21
commit 438ec5ccac
6 changed files with 133 additions and 75 deletions

View File

@ -33,8 +33,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="company_id" ref="base.main_company"/>
</record>
<!-- Base data for activities -->
<record model="golem.activity.type" id="golem_activity_type_activity">
<field name="name">Activity</field>
<field name="is_recurrent">1</field>
</record>
<record model="golem.activity.type" id="golem_activity_type_workshop">
<field name="name">Workshop</field>
<field name="is_recurrent">0</field>
</record>
<record model="golem.activity.type" id="golem_activity_type_training">
<field name="name">Training</field>
<field name="is_recurrent">0</field>
</record>
<record model="product.category" id="golem_product_category_activities">
<field name="name">Activités</field>
<field name="property_account_income_categ_id"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-01 15:36+0000\n"
"PO-Revision-Date: 2017-05-01 15:36+0000\n"
"POT-Creation-Date: 2017-06-05 09:21+0000\n"
"PO-Revision-Date: 2017-06-05 09:21+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -63,9 +63,7 @@ msgid "Activities Categories"
msgstr "Catégories d'activités"
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:50
#: model:ir.ui.view,arch_db:golem_activity.golem_activity_search
#, python-format
#: model:golem.activity.type,name:golem_activity.golem_activity_type_activity
msgid "Activity"
msgstr "Activité"
@ -75,9 +73,14 @@ msgid "Activity Name"
msgstr "Nom de l'activité"
#. module: golem_activity
#: selection:golem.activity,type_of:0
msgid "Activité"
msgstr "Activité"
#: model:ir.ui.menu,name:golem_activity.golem_activity_type_menu_list
msgid "Activity Types"
msgstr "Types d'activité"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_name
msgid "Activity type"
msgstr "Type d'activité"
#. module: golem_activity
#: model:product.category,name:golem_activity.golem_product_category_activities
@ -158,12 +161,12 @@ msgstr "Catégories"
#. module: golem_activity
#: model:ir.model.fields,help:golem_activity.field_golem_activity_membership
msgid "Check if the product is eligible for membership."
msgstr "Check if the product is eligible for membership."
msgstr "Cochez si l'article est éligible pour l'adhésion"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_color
msgid "Color Index"
msgstr "Color Index"
msgstr "Couleur"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_company_id
@ -182,11 +185,13 @@ msgstr "Le prix de revient calculé est exprimé dans l'unité de mesure par dé
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_create_uid
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_create_uid
msgid "Created by"
msgstr "Créé par"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_create_date
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_create_date
msgid "Created on"
msgstr "Créé le"
@ -252,6 +257,7 @@ msgstr "Description"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_display_name
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_display_name
msgid "Display Name"
msgstr "Nom affiché"
@ -282,6 +288,16 @@ msgstr "Activités"
msgid "GOLEM Activity"
msgstr "Activité"
#. module: golem_activity
#: model:ir.model,name:golem_activity.model_golem_activity_type
msgid "GOLEM Activity Type"
msgstr "GOLEM Activity Type"
#. module: golem_activity
#: model:ir.actions.act_window,name:golem_activity.golem_activity_type_action
msgid "GOLEM Activity Types"
msgstr "GOLEM Activity Types"
#. module: golem_activity
#: model:ir.model.fields,help:golem_activity.field_golem_activity_packaging_ids
msgid "Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."
@ -299,6 +315,7 @@ msgstr "Grouper par"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_id
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_id
msgid "ID"
msgstr "ID"
@ -329,20 +346,24 @@ msgstr "Numéro d'article international (IAN) utilisé pour identifier cet artic
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_is_recurrent
msgid "Is recurrent ?"
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_is_recurrent
msgid "Is recurrent?"
msgstr "Est récurrent ?"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity___last_update
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type___last_update
msgid "Last Modified on"
msgstr "Dernière Modification le"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_write_uid
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_write_date
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
@ -525,7 +546,7 @@ msgid "Start of the period cannot be after end of the period."
msgstr "Le début de la période ne peut être antérieure à sa fin"
#. module: golem_activity
#: field:golem.activity,hour_start:0
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_hour_start
msgid "Start time"
msgstr "Heure de début"
@ -566,6 +587,13 @@ msgstr "Ce compte sera utilisé au lieu de celui par défaut pour les factures p
msgid "This account will be used for invoices instead of the default one to value sales for the current product."
msgstr "Ce compte sera utilisé au lieu de celui par défaut pour les factures pour comptabiliser les ventes pour le produit en cours."
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:28
#: sql_constraint:golem.activity.type:0
#, python-format
msgid "This activity type name has already been used."
msgstr "Ce nom pour un type d'activité a déjà été utilisé."
#. module: golem_activity
#: model:ir.model.fields,help:golem_activity.field_golem_activity_image
msgid "This field holds the image used as image for the activity."
@ -579,10 +607,7 @@ msgid "Thursday"
msgstr "Jeudi"
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:52
#: selection:golem.activity,type_of:0
#: model:ir.ui.view,arch_db:golem_activity.golem_activity_search
#, python-format
#: model:golem.activity.type,name:golem_activity.golem_activity_type_training
msgid "Training"
msgstr "Stage"
@ -599,7 +624,7 @@ msgid "Tuesday"
msgstr "Mardi"
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_of
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_id_4222
msgid "Type"
msgstr "Type"
@ -646,15 +671,7 @@ msgid "Weight"
msgstr "Poids"
#. module: golem_activity
#: model:ir.model.fields,help:golem_activity.field_golem_activity_is_recurrent
msgid "Work in progress"
msgstr "Travail en cours"
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:51
#: selection:golem.activity,type_of:0
#: model:ir.ui.view,arch_db:golem_activity.golem_activity_search
#, python-format
#: model:golem.activity.type,name:golem_activity.golem_activity_type_workshop
msgid "Workshop"
msgstr "Atelier"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-01 15:36+0000\n"
"PO-Revision-Date: 2017-05-01 15:36+0000\n"
"POT-Creation-Date: 2017-06-05 09:21+0000\n"
"PO-Revision-Date: 2017-06-05 09:21+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -59,9 +59,7 @@ msgid "Activities Categories"
msgstr ""
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:50
#: model:ir.ui.view,arch_db:golem_activity.golem_activity_search
#, python-format
#: model:golem.activity.type,name:golem_activity.golem_activity_type_activity
msgid "Activity"
msgstr ""
@ -71,8 +69,13 @@ msgid "Activity Name"
msgstr ""
#. module: golem_activity
#: selection:golem.activity,type_of:0
msgid "Activité"
#: model:ir.ui.menu,name:golem_activity.golem_activity_type_menu_list
msgid "Activity Types"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_name
msgid "Activity type"
msgstr ""
#. module: golem_activity
@ -178,11 +181,13 @@ msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_create_uid
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_create_uid
msgid "Created by"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_create_date
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_create_date
msgid "Created on"
msgstr ""
@ -248,6 +253,7 @@ msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_display_name
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_display_name
msgid "Display Name"
msgstr ""
@ -278,6 +284,16 @@ msgstr ""
msgid "GOLEM Activity"
msgstr ""
#. module: golem_activity
#: model:ir.model,name:golem_activity.model_golem_activity_type
msgid "GOLEM Activity Type"
msgstr ""
#. module: golem_activity
#: model:ir.actions.act_window,name:golem_activity.golem_activity_type_action
msgid "GOLEM Activity Types"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,help:golem_activity.field_golem_activity_packaging_ids
msgid "Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."
@ -295,6 +311,7 @@ msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_id
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_id
msgid "ID"
msgstr ""
@ -325,20 +342,24 @@ msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_is_recurrent
msgid "Is recurrent ?"
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_is_recurrent
msgid "Is recurrent?"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity___last_update
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type___last_update
msgid "Last Modified on"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_write_uid
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_write_uid
msgid "Last Updated by"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_write_date
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_write_date
msgid "Last Updated on"
msgstr ""
@ -562,6 +583,13 @@ msgstr ""
msgid "This account will be used for invoices instead of the default one to value sales for the current product."
msgstr ""
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:28
#: sql_constraint:golem.activity.type:0
#, python-format
msgid "This activity type name has already been used."
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,help:golem_activity.field_golem_activity_image
msgid "This field holds the image used as image for the activity."
@ -575,10 +603,7 @@ msgid "Thursday"
msgstr ""
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:52
#: selection:golem.activity,type_of:0
#: model:ir.ui.view,arch_db:golem_activity.golem_activity_search
#, python-format
#: model:golem.activity.type,name:golem_activity.golem_activity_type_training
msgid "Training"
msgstr ""
@ -595,7 +620,7 @@ msgid "Tuesday"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_of
#: model:ir.model.fields,field_description:golem_activity.field_golem_activity_type_id_4222
msgid "Type"
msgstr ""
@ -642,15 +667,7 @@ msgid "Weight"
msgstr ""
#. module: golem_activity
#: model:ir.model.fields,help:golem_activity.field_golem_activity_is_recurrent
msgid "Work in progress"
msgstr ""
#. module: golem_activity
#: code:addons/golem_activity/models/golem_activity.py:51
#: selection:golem.activity,type_of:0
#: model:ir.ui.view,arch_db:golem_activity.golem_activity_search
#, python-format
#: model:golem.activity.type,name:golem_activity.golem_activity_type_workshop
msgid "Workshop"
msgstr ""

View File

@ -19,6 +19,16 @@
from odoo import models, fields, api, _
class GolemActivityType(models.Model):
""" GOLEM Activity Type """
_name = 'golem.activity.type'
_description = 'GOLEM Activity Type'
_sql_constraints = [('golem_activity_type_name_uniq', 'UNIQUE (name)',
_('This activity type name has already been used.'))]
name = fields.Char('Activity type', required=True, translate=True)
is_recurrent = fields.Boolean('Is recurrent?')
class GolemActivity(models.Model):
""" GOLEM Activity """
@ -47,17 +57,6 @@ class GolemActivity(models.Model):
full_name = u'[{}] {}'.format(activity.default_code, full_name)
activity.full_name = full_name
type_of = fields.Selection([('activity', _('Activity')),
('workshop', _('Workshop')),
('training', _('Training'))],
default='activity', index=True, string='Type')
@api.onchange('type_of')
def onchange_type_of(self):
""" Sets is_recurrent default according to activity type of """
for activity in self:
activity.is_recurrent = (activity.type_of == 'activity')
@api.model
def _default_season(self):
""" Get default season """
@ -82,8 +81,9 @@ class GolemActivity(models.Model):
domain=[('is_company', '=', False)])
categ_id = fields.Many2one('product.category',
help='Select category for the current activity')
is_recurrent = fields.Boolean('Is recurrent ?', default=True,
help='Work in progress')
type_id = fields.Many2one('golem.activity.type', required=True, index=True,
string='Type')
is_recurrent = fields.Boolean(related='type_id.is_recurrent')
date_start = fields.Date('Start date', copy=False)
date_stop = fields.Date('End date', copy=False)

View File

@ -1,3 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_golem_activity_user,Access GOLEM Activity User,model_golem_activity,golem_base.group_golem_user,1,1,1,0
access_golem_activity_manager,Access GOLEM Activity Manager,model_golem_activity,golem_base.group_golem_manager,1,1,1,1
access_golem_activity_type_user,Access GOLEM Activity Type User,model_golem_activity_type,golem_base.group_golem_user,1,1,1,0
access_golem_activity_type_manager,Access GOLEM Activity Type Manager,model_golem_activity_type,golem_base.group_golem_manager,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_golem_activity_user Access GOLEM Activity User model_golem_activity golem_base.group_golem_user 1 1 1 0
3 access_golem_activity_manager Access GOLEM Activity Manager model_golem_activity golem_base.group_golem_manager 1 1 1 1
4 access_golem_activity_type_user Access GOLEM Activity Type User model_golem_activity_type golem_base.group_golem_user 1 1 1 0
5 access_golem_activity_type_manager Access GOLEM Activity Type Manager model_golem_activity_type golem_base.group_golem_manager 1 1 1 1

View File

@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<group>
<field name="season_id" required="True" />
<field name="animator_id" />
<field name="type_of" required="True" />
<field name="type_id" required="True" />
</group>
<group>
<field name="categ_id" required="True" />
@ -93,7 +93,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<tree>
<field name="is_recurrent" invisible="True" />
<field name="season_id" />
<field name="type_of" />
<field name="type_id" />
<field name="full_name" />
<field name="animator_id" />
<field name="weekday" string="Day"
@ -104,6 +104,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tree>
</field>
</record>
<record model="ir.ui.view" id="golem_activity_type_tree">
<field name="name">GOLEM Activity Type Tree/List</field>
<field name="model">golem.activity.type</field>
<field name="arch" type="xml">
<tree editable="top">
<field name="name" />
<field name="is_recurrent" />
</tree>
</field>
</record>
<!-- Calendars -->
<record id="golem_activity_calendar" model="ir.ui.view">
@ -124,20 +134,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="arch" type="xml">
<search>
<field name="full_name" />
<field name="animator_id" widget="many2one" />
<field name="categ_id" widget="many2one" />
<field name="season_id" widget="many2one" />
<field name="animator_id" />
<field name="type_id" />
<field name="categ_id" />
<field name="season_id" />
<filter name="season_default" string="Default season"
domain="[('is_current', '=', True)]" />
<filter name="type_of_activity" string="Activity"
domain="[('type_of', '=', 'activity')]" />
<filter name="type_of_workshop" string="Workshop"
domain="[('type_of', '=', 'workshop')]" />
<filter name="type_of_training" string="Training"
domain="[('type_of', '=', 'training')]" />
<group string="Group By">
<filter name="group_type_of" string="By type"
context="{'group_by': 'type_of'}" />
<filter name="group_type_id" string="By type"
context="{'group_by': 'type_id'}" />
<filter name="group_category" string="By category"
context="{'group_by': 'categ_id'}"/>
<filter name="group_weekday" string="By weekday"
@ -153,6 +158,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<act_window id="golem_activity_action" name="GOLEM Activities"
res_model="golem.activity" view_mode="tree,form,calendar"
context="{'search_default_season_default': True, 'default_categ_id': ref('golem_activity.golem_product_category_activities')}" />
<act_window id="golem_activity_type_action" name="GOLEM Activity Types"
res_model="golem.activity.type" view_mode="tree" />
<record id="product_category_action" model="ir.actions.act_window">
<field name="name">Activities Categories</field>
<field name="res_model">product.category</field>
@ -167,6 +174,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<menuitem id="golem_activity_menu_list" name="List"
groups="golem_base.group_golem_user"
parent="golem_activity_menu" sequence="0" action="golem_activity_action" />
<menuitem id="golem_activity_type_menu_list" name="Activity Types"
groups="golem_base.group_golem_user"
parent="golem_activity_menu" sequence="5" action="golem_activity_type_action" />
<menuitem id="product_category_menu" name="Categories"
parent="golem_activity.golem_activity_menu" sequence="20"
groups="golem_base.group_golem_manager"