Browse Source

[MIG] b_shift: migration to 10.0

pull/143/head
Elouan Le Bars 5 years ago
parent
commit
3d894c3559
  1. 2
      beesdoo_shift/__manifest__.py
  2. 11
      beesdoo_shift/migrations/9.0.1.2.1/post-migrate.py
  3. 16
      beesdoo_shift/migrations/9.0.1.2.3/post-migrate.py
  4. 66
      beesdoo_shift/migrations/9.0.1.3.0/post-migrate.py
  5. 16
      beesdoo_shift/migrations/9.0.1.3.0/pre-migrate.py
  6. 4
      beesdoo_shift/models/attendance_sheet.py
  7. 5
      beesdoo_shift/models/cooperative_status.py
  8. 4
      beesdoo_shift/models/planning.py
  9. 2
      beesdoo_shift/models/res_config.py
  10. 4
      beesdoo_shift/models/task.py
  11. 2
      beesdoo_shift/security/group.xml
  12. 6
      beesdoo_shift/tests/test_beesdoo_shift.py
  13. 4
      beesdoo_shift/views/res_config_view.xml
  14. 2
      beesdoo_shift/wizard/assign_super_coop.py
  15. 2
      beesdoo_shift/wizard/batch_template.py
  16. 4
      beesdoo_shift/wizard/extension.py
  17. 4
      beesdoo_shift/wizard/holiday.py
  18. 2
      beesdoo_shift/wizard/instanciate_planning.py
  19. 4
      beesdoo_shift/wizard/subscribe.py
  20. 4
      beesdoo_shift/wizard/temporary_exemption.py
  21. 4
      beesdoo_shift/wizard/validate_attendance_sheet.py

2
beesdoo_shift/__openerp__.py → beesdoo_shift/__manifest__.py

@ -13,7 +13,7 @@
'website': "https://github.com/beescoop/Obeesdoo", 'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Cooperative management', 'category': 'Cooperative management',
'version': '9.0.1.3.0',
'version': '10.0.1.0.0',
'depends': ['beesdoo_base', 'barcodes'], 'depends': ['beesdoo_base', 'barcodes'],

11
beesdoo_shift/migrations/9.0.1.2.1/post-migrate.py

@ -1,11 +0,0 @@
# coding: utf-8
def migrate(cr, version):
"""Fix bug occuring when trying to save a temporary exempt
(missing sequence in database). """
cr.execute(
"""
CREATE SEQUENCE IF NOT EXISTS beesdoo_website_shift_config_settings_id_seq
"""
)

16
beesdoo_shift/migrations/9.0.1.2.3/post-migrate.py

@ -1,16 +0,0 @@
# coding: utf-8
def migrate(cr, version):
"""Fix bug occuring when trying to save a temporary exempt
(missing sequence in database). """
cr.execute(
"""
CREATE SEQUENCE IF NOT EXISTS beesdoo_website_shift_config_settings_id_seq
"""
)
cr.execute(
"""
CREATE SEQUENCE IF NOT EXISTS beesdoo_shift_temporary_exemption_id_seq
"""
)

66
beesdoo_shift/migrations/9.0.1.3.0/post-migrate.py

@ -1,66 +0,0 @@
# coding: utf-8
def migrate(cr, version):
"""
The Char field 'code' from shift stage is now a Selection Field
named 'state'.
"""
# Set new field state
cr.execute(
"""
UPDATE beesdoo_shift_shift
SET state = old_code
"""
)
# Map new stage from corresponding old stage
cr.execute(
"""
UPDATE beesdoo_shift_shift
SET state = 'absent_2'
FROM res_partner
WHERE beesdoo_shift_shift.worker_id = res_partner.id
AND (
beesdoo_shift_shift.old_code = 'absent'
OR (
beesdoo_shift_shift.old_code = 'excused'
AND res_partner.working_mode = 'irregular'
)
)
"""
)
cr.execute(
"""
UPDATE beesdoo_shift_shift
SET state = 'absent_1'
FROM res_partner
WHERE beesdoo_shift_shift.worker_id = res_partner.id
AND beesdoo_shift_shift.old_code = 'excused'
AND res_partner.working_mode = 'regular'
"""
)
cr.execute(
"""
UPDATE beesdoo_shift_shift
SET state = 'absent_0'
FROM res_partner
WHERE beesdoo_shift_shift.worker_id = res_partner.id
AND beesdoo_shift_shift.old_code = 'excused_necessity'
"""
)
cr.execute(
"""
UPDATE beesdoo_shift_shift
SET state = 'absent_0'
WHERE beesdoo_shift_shift.state = 'excused'
"""
)
cr.execute(
"""
DELETE FROM beesdoo_shift_shift
WHERE beesdoo_shift_shift.state = 'absent'
"""
)
# Drop temporary columns
cr.execute("ALTER TABLE beesdoo_shift_shift DROP COLUMN old_code")

16
beesdoo_shift/migrations/9.0.1.3.0/pre-migrate.py

@ -1,16 +0,0 @@
# coding: utf-8
def migrate(cr, version):
# Record information from old shift stage
cr.execute("ALTER TABLE beesdoo_shift_shift ADD old_code varchar")
cr.execute(
"""
UPDATE beesdoo_shift_shift
SET old_code = (
SELECT code
FROM beesdoo_shift_stage
WHERE id = stage_id
)
"""
)

4
beesdoo_shift/models/attendance_sheet.py

@ -6,8 +6,8 @@ from datetime import date, datetime, timedelta
from lxml import etree from lxml import etree
from openerp import _, api, exceptions, fields, models
from openerp.exceptions import UserError, ValidationError
from odoo import _, api, exceptions, fields, models
from odoo.exceptions import UserError, ValidationError
class AttendanceSheetShift(models.AbstractModel): class AttendanceSheetShift(models.AbstractModel):

5
beesdoo_shift/models/cooperative_status.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import ValidationError, UserError
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError, UserError
from datetime import timedelta, datetime from datetime import timedelta, datetime
import logging import logging
from openerp.osv.fields import related
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
PERIOD = 28 # TODO: use system parameter PERIOD = 28 # TODO: use system parameter

4
beesdoo_shift/models/planning.py

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import UserError
from odoo import models, fields, api, _
from odoo.exceptions import UserError
from pytz import timezone, UTC from pytz import timezone, UTC
import math import math

2
beesdoo_shift/models/res_config.py

@ -5,7 +5,7 @@
import ast import ast
from openerp import fields, models, api
from odoo import fields, models, api
class ShiftConfigSettings(models.TransientModel): class ShiftConfigSettings(models.TransientModel):

4
beesdoo_shift/models/task.py

@ -2,8 +2,8 @@
import json import json
from datetime import datetime, timedelta from datetime import datetime, timedelta
from openerp import _, api, fields, models
from openerp.exceptions import UserError, ValidationError
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError

2
beesdoo_shift/security/group.xml

@ -1,5 +1,4 @@
<odoo> <odoo>
<data noupdate="0">
<record id="group_shift_attendance_sheet" model="res.groups"> <record id="group_shift_attendance_sheet" model="res.groups">
<field name="name">Attendance Sheet Generic Access</field> <field name="name">Attendance Sheet Generic Access</field>
<field name="category_id" ref="base.module_category_cooperative_management"/> <field name="category_id" ref="base.module_category_cooperative_management"/>
@ -30,5 +29,4 @@
<record model="ir.ui.menu" id="base.menu_board_root"> <record model="ir.ui.menu" id="base.menu_board_root">
<field name="groups_id" eval="[(6,0,[ref('group_shift_attendance_sheet')])]"/> <field name="groups_id" eval="[(6,0,[ref('group_shift_attendance_sheet')])]"/>
</record> </record>
</data>
</odoo> </odoo>

6
beesdoo_shift/tests/test_beesdoo_shift.py

@ -5,9 +5,9 @@
import time import time
from datetime import datetime, timedelta from datetime import datetime, timedelta
from openerp import exceptions, fields
from openerp.exceptions import UserError, ValidationError
from openerp.tests.common import TransactionCase
from odoo import exceptions, fields
from odoo.exceptions import UserError, ValidationError
from odoo.tests.common import TransactionCase
class TestBeesdooShift(TransactionCase): class TestBeesdooShift(TransactionCase):

4
beesdoo_shift/views/res_config_view.xml

@ -3,7 +3,7 @@
Copyright 2019-2020 Elouan Le Bars <elouan@coopiteasy.be> Copyright 2019-2020 Elouan Le Bars <elouan@coopiteasy.be>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<openerp>
<odoo>
<data> <data>
<record model="ir.ui.view" id="daynumber_view_tree"> <record model="ir.ui.view" id="daynumber_view_tree">
<field name="name">Day Number List</field> <field name="name">Day Number List</field>
@ -88,4 +88,4 @@
/> />
</data> </data>
</openerp>
</odoo>

2
beesdoo_shift/wizard/assign_super_coop.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from odoo import models, fields, api, _
class AssignSuperCoop(models.TransientModel): class AssignSuperCoop(models.TransientModel):

2
beesdoo_shift/wizard/batch_template.py

@ -5,7 +5,7 @@ Created on 2 janv. 2017
@author: Thibault Francois @author: Thibault Francois
''' '''
from openerp import models, fields, api, _
from odoo import models, fields, api, _
class GenerateShiftTemplate(models.TransientModel): class GenerateShiftTemplate(models.TransientModel):
_name = 'beesddoo.shift.generate_shift_template' _name = 'beesddoo.shift.generate_shift_template'

4
beesdoo_shift/wizard/extension.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import UserError
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class Subscribe(models.TransientModel): class Subscribe(models.TransientModel):
_name = 'beesdoo.shift.extension' _name = 'beesdoo.shift.extension'

4
beesdoo_shift/wizard/holiday.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import ValidationError
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class Subscribe(models.TransientModel): class Subscribe(models.TransientModel):
_name = 'beesdoo.shift.holiday' _name = 'beesdoo.shift.holiday'

2
beesdoo_shift/wizard/instanciate_planning.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from odoo import models, fields, api, _
class InstanciatePlanning(models.TransientModel): class InstanciatePlanning(models.TransientModel):

4
beesdoo_shift/wizard/subscribe.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import UserError
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class StatusActionMixin(models.AbstractModel): class StatusActionMixin(models.AbstractModel):
_name = "beesdoo.shift.action_mixin" _name = "beesdoo.shift.action_mixin"

4
beesdoo_shift/wizard/temporary_exemption.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import ValidationError
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class TemporaryExemption(models.TransientModel): class TemporaryExemption(models.TransientModel):
_name = 'beesdoo.shift.temporary_exemption' _name = 'beesdoo.shift.temporary_exemption'

4
beesdoo_shift/wizard/validate_attendance_sheet.py

@ -2,8 +2,8 @@
import ast import ast
from openerp import _, api, exceptions, fields, models
from openerp.exceptions import UserError, ValidationError
from odoo import _, api, exceptions, fields, models
from odoo.exceptions import UserError, ValidationError
class ValidateAttendanceSheet(models.TransientModel): class ValidateAttendanceSheet(models.TransientModel):

Loading…
Cancel
Save