diff --git a/yaltik_crm_action/__manifest__.py b/yaltik_crm_action/__manifest__.py index 201ec7a..ba28fe8 100644 --- a/yaltik_crm_action/__manifest__.py +++ b/yaltik_crm_action/__manifest__.py @@ -18,7 +18,7 @@ { 'name': 'CRM Actions', 'summary': 'Action management, instead of new activity, in CRM', - 'version': '10.0.1.0.0', + 'version': '10.0.1.1.0', 'category': 'Sales', 'author': 'Fabien BOURGEOIS - Yaltik', 'license': 'AGPL-3', diff --git a/yaltik_crm_action/migrations/10.0.1.1.0/post-migrate.py b/yaltik_crm_action/migrations/10.0.1.1.0/post-migrate.py new file mode 100644 index 0000000..54def73 --- /dev/null +++ b/yaltik_crm_action/migrations/10.0.1.1.0/post-migrate.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 Fabien Bourgeois +# +# 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 . + +""" Migration script """ + +from openupgradelib import openupgrade + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + """ Migration function : migrate Date date to datetime """ + openupgrade.date_to_datetime_tz(env.cr, 'crm_action', 'user_id', + 'date_bak', 'date') + openupgrade.drop_columns(env.cr, [('crm_action', 'date_bak')]) diff --git a/yaltik_crm_action/migrations/10.0.1.1.0/pre-migrate.py b/yaltik_crm_action/migrations/10.0.1.1.0/pre-migrate.py new file mode 100644 index 0000000..88e0d90 --- /dev/null +++ b/yaltik_crm_action/migrations/10.0.1.1.0/pre-migrate.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 Fabien Bourgeois +# +# 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 . + +""" Migration script """ + +from openupgradelib import openupgrade + +@openupgrade.migrate() +def migrate(env, version): + """ Migration function : copy old Date date to legacy column """ + openupgrade.copy_columns(env.cr, {'crm_action': [('date', 'date_bak', None)]}) diff --git a/yaltik_crm_action/models/crm_action.py b/yaltik_crm_action/models/crm_action.py index bcc9c70..7ba2115 100644 --- a/yaltik_crm_action/models/crm_action.py +++ b/yaltik_crm_action/models/crm_action.py @@ -39,13 +39,14 @@ class CrmAction(models.Model): details = fields.Text() partner_id = fields.Many2one('res.partner', string='Customer', index=True) - date = fields.Date('Date', required=True, default=fields.Date.context_today) + date = fields.Datetime('Date', required=True, default=fields.Date.context_today) user_id = fields.Many2one('res.users', string='User', required=True, default=lambda self: self.env.user) lead_id = fields.Many2one('crm.lead', string='Lead', ondelete='cascade') event_id = fields.Many2one('calendar.event', 'Calendar event', ondelete='cascade') - action_type_id = fields.Many2one('crm.action.type', string='Type', required=True, - default=lambda self: self.env['crm.action.type'].search([], limit=1)) + action_type_id = fields.Many2one( + 'crm.action.type', string='Type', required=True, + default=lambda self: self.env['crm.action.type'].search([], limit=1)) action_type_name = fields.Char(related='action_type_id.name') @api.onchange('lead_id') diff --git a/yaltik_crm_action/models/crm_lead.py b/yaltik_crm_action/models/crm_lead.py index 45c0911..0944b65 100644 --- a/yaltik_crm_action/models/crm_lead.py +++ b/yaltik_crm_action/models/crm_lead.py @@ -29,7 +29,7 @@ class CrmLead(models.Model): action_ids = fields.One2many('crm.action', 'lead_id', string='Actions') next_action_id = fields.Many2one('crm.action', string='Next Action', compute='compute_next_action', store=True) - next_action_date = fields.Date(related='next_action_id.date', store=True) + next_action_date = fields.Datetime(related='next_action_id.date', store=True) next_action_title = fields.Char(related='next_action_id.display_name', store=True) @api.multi