Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dc2b11e
First part of product migration analysis.
gurneyalex Jun 2, 2014
1252ab4
fix missing dependency in product in v8
gurneyalex Jun 2, 2014
1240331
updated product migration analysis
gurneyalex Jun 2, 2014
d8f8b1b
first pass at product migration script
gurneyalex Jun 2, 2014
adb73d2
fix bad refactoring
gurneyalex Jun 2, 2014
776c954
compute active attribute of template from attribute of variants
gurneyalex Jun 2, 2014
db73bf7
copy product_product.image to product_product.image_variant
gurneyalex Jun 2, 2014
2e9f1a6
updated work analysis
gurneyalex Jun 2, 2014
978684c
migration of product.packaging and product.ul
gurneyalex Jun 2, 2014
c684512
migration of product_template.cost_method, moved in stock_account
guewen Jun 2, 2014
08fd7aa
reinstall data from product moved to mrp
gurneyalex Jun 2, 2014
81da4ed
add migration for product.packaging to template
gurneyalex Jun 2, 2014
dd941af
fix error in previous refactoring
gurneyalex Jun 2, 2014
b185b32
Merge branch 'product-v8-migration' of https://github.com/guewen/Open…
gurneyalex Jun 3, 2014
2a7beba
Migrate product_template.standard_price.
guewen Jun 3, 2014
3bbc27c
[ADD] check value for ir_ui_view.type field.
legalsylvain Jun 3, 2014
dc8414a
[REF] Remove useless field migration because 'oldname' is defined;
legalsylvain Jun 3, 2014
7dff6b2
Updated openupgrade_analysis_WORK.txt with comments
guewen Jun 3, 2014
be0576e
packaging field is o2m -> no colum renaming required
gurneyalex Jun 3, 2014
c6e21ee
fix packaging/ul migration
gurneyalex Jun 3, 2014
6afa1a6
re-add the change on product consultant
gurneyalex Jun 3, 2014
2f10573
added AGPL header
gurneyalex Jun 3, 2014
0bbfeb6
fix typo
gurneyalex Jun 3, 2014
edc8280
Merge remote-tracking branch 'openupgrade/master' into product-v8-mig…
guewen Jun 3, 2014
b944b0b
openerp namespace is missing in the import
guewen Jun 3, 2014
92414d4
Wrong API call (PR submitted upstream)
guewen Jun 3, 2014
f44b8e4
Migrate 'variants' and 'price_extra' using the new attribute models
guewen Jun 3, 2014
23862a9
[IMP] 'base' analysis. now 'ir.actions.server' changes only are missing
legalsylvain Jun 3, 2014
eaf8402
Merge remote-tracking branch 'gurneyalex/product-v8-migration' into p…
guewen Jun 3, 2014
c01afcb
pep8, unused models
guewen Jun 3, 2014
2effbb8
Write a 'Unix time zero' on the product price history entries so prod…
guewen Jun 3, 2014
a85e9e2
[REF] openupgrade_records: sorting key can be a tuple
florentx Jun 3, 2014
6f965d1
[ADD] finish analyses of 'base';
legalsylvain Jun 3, 2014
71f17b2
pep8: missing whitespace around operator
guewen Jun 3, 2014
382f779
[REF] Pep8
legalsylvain Jun 3, 2014
ee91d78
Migrate product_template.cost_method to property (in stock_account)
guewen Jun 3, 2014
e2c9b6e
Remove a line in order to be pep8 compliant after merge
legalsylvain Jun 4, 2014
cec20e3
Merge branch 'base' of https://github.com/legalsylvain/OpenUpgrade in…
arthru Jun 4, 2014
ef54fdc
Merge pull request #47 from florentx/sort_key
arthru Jun 4, 2014
3569cb1
Merge pull request #60 from arthru/legalsylvain-base
legalsylvain Jun 4, 2014
47113c6
Merge pull request #37 from guewen/product-v8-migration
Jun 4, 2014
31cdb22
Init of analysis work file for mail
Jun 2, 2014
3bc9c0d
Add pre and post migration scripts for mail
Jun 4, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions addons/mail/migrations/8.0.1.0/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---Fields in module 'mail'---
mail / mail.alias / alias_contact (selection) : NEW required: required, selection_keys: ['everyone', 'followers', 'partners'], req_default: everyone
mail / mail.alias / alias_parent_model_id (many2one): NEW relation: ir.model
mail / mail.alias / alias_parent_thread_id (integer): NEW
mail / mail.mail / recipient_ids (many2many) : NEW relation: res.partner

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[need information, code review : test and review]
Is it normal if alias_parent_model_id (and alias_parent_thread_id) are not initialized ?
I tested realizing diff between 7.0 database migrated to 8.0 and 8.0 just-installed and the data of those 2 columns are not the same.
(in migrated database the two fields are empty)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't know how to fill this columns during migration. I see that only used in hr_reruitment and crm, this modules will have to update their data accordingly.

mail / mail.message.subtype / hidden (boolean) : NEW
mail / mail.message.subtype / sequence (integer) : NEW
mail / res.users / display_groups_suggestions (boolean): NEW
mail / mail.message / record_name (char) : not a function anymore
mail / mail.thread / message_last_post (datetime) : NEW
## Nothing to do

mail / mail.group / message_last_post (datetime) : NEW
mail / res.partner / message_last_post (datetime) : NEW
## TODO something with last_post in openupgrade80

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO looks like there is work needed, but you treated it in post_migration script. Could you change that message ?



mail / res.partner / notification_email_send (selection): DEL required: required, selection_keys: ['all', 'comment', 'email', 'none'], req_default: function
mail / res.partner / notify_email (selection) : NEW required: required, selection_keys: ['always', 'none'], req_default: function
## all, comment, email -> always, none -> none

mail / mail.mail / email_from (char) : DEL
## Possibly moved to mail.message, nothing done

mail / mail.mail / mail_server_id (many2one) : DEL relation: ir.mail_server
mail / mail.message / mail_server_id (many2one) : NEW relation: ir.mail_server
mail / mail.mail / reply_to (char) : DEL
mail / mail.message / reply_to (char) : NEW
## Moved from mail.mail to mail.message

---XML records in module 'mail'---
NEW ir.actions.act_window: base.action_attachment
NEW ir.actions.client: mail.action_client_messaging_menu
NEW ir.actions.server: mail.action_mail_redirect
NEW ir.actions.todo: base.open_menu
NEW ir.config_parameter: mail.icp_mail_catchall_alias
NEW ir.rule: mail.mail_followers_read_write_others
NEW ir.ui.view: mail.assets_backend
NEW ir.ui.view: mail.view_document_file_kanban
NEW res.partner: base.partner_root
## Nothing to do
50 changes: 50 additions & 0 deletions addons/mail/migrations/8.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.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 pooler, SUPERUSER_ID
from openerp.openupgrade import openupgrade, openupgrade_80


def mail_mail_to_mail_message_migration(cr, uid, pool):
"""
The following fields have been moved from mail.mail to mail.message
* mail_server_id
* reply_to
Get the mail.message from the mail.mail object and transfer the data that
way.
"""
legacy_server_id = openupgrade.get_legacy_name('mail_server_id')
legacy_reply_to = openupgrade.get_legacy_name('reply_to')
openupgrade.logged_query(cr, """
UPDATE mail_message
SET %s = %s, %s = %s
FROM mail_message AS a JOIN mail_mail AS b ON a.id = b.mail_message_id
""" % ('mail_server_id', legacy_server_id, 'reply_to', legacy_reply_to, ))


@openupgrade.migrate()
def migrate(cr, version):
pool = pooler.get_pool(cr.dbname)
uid = SUPERUSER_ID
mail_mail_to_mail_message_migration(cr, uid, pool)
openupgrade_80.set_message_last_post(
cr, uid, pool, ['mail.group', 'res.partner'])
52 changes: 52 additions & 0 deletions addons/mail/migrations/8.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.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.openupgrade import openupgrade


column_renames = {
'res_partner': [
('notification_email_send', 'notify_email'),

],
'mail_mail': [
('email_from', None),
# The following fields are to be moved to mail_message in post
('mail_server_id', None),
('reply_to', None),
]
}


def partner_notify_migration(cr):
"""The selection values 'all', 'comment' and 'email' got replaced by
'always', 'never' is still 'never'"""
openupgrade.logged_query(cr, """
UPDATE res_partner
SET notify_email = 'always'
WHERE notify_email IN ('all', 'comment', 'email')""")


@openupgrade.migrate()
def migrate(cr, version):
openupgrade.rename_columns(cr, column_renames)
partner_notify_migration(cr)
18 changes: 18 additions & 0 deletions addons/mrp/migrations/8.0.1.1/post-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from openerp.openupgrade import openupgrade
from openerp import pooler, SUPERUSER_ID

def move_fields(cr, pool):
execute = openupgrade.logged_query
queries = [ """
UPDATE product_product
SET produce_delay=(SELECT pt.%s
FROM product_template
WHERE product_template.id=product_product.product_tmpl_id)
""" % openupgrade.get_legacy_name('produce_delay'),


@openupgrade.migrate()
def migrate(cr, version):
pool = pooler.get_pool(cr.dbname)
move_fields(cr, pool)

2 changes: 1 addition & 1 deletion addons/product/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'version': '1.1',
'author': 'OpenERP SA',
'category': 'Sales Management',
'depends': ['base', 'decimal_precision', 'mail'],
'depends': ['base', 'decimal_precision', 'mail', 'report'],
'demo': [
'product_demo.xml',
'product_image_demo.xml',
Expand Down
24 changes: 24 additions & 0 deletions addons/product/migrations/8.0.1.1/modified_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<openerp>
<data>
<record id="product_supplierinfo_comp_rule" model="ir.rule"><field name="domain_force">['|',('company_id','=',False),('company_id','=',user.company_id.id)]</field>
</record>
<record id="product_pricelist_comp_rule" model="ir.rule"><field name="domain_force"> ['|',('company_id','=',user.company_id.id),('company_id','=',False)]</field>
</record>
<record id="product_uom_kgm" model="product.uom"><field name="rounding" eval="0.001"/>
</record>
<record id="item0" model="product.pricelist.item"><field name="sequence">1000</field>
</record>
<record id="product_category_all" model="product.category"><field name="name">All</field>
</record>
<record id="product_pricelist_version_comp_rule" model="ir.rule"><field name="domain_force"> ['|',('company_id','=',user.company_id.id),('company_id','=',False)]</field>
</record>
<record id="product_pricelist_item_comp_rule" model="ir.rule"><field name="domain_force"> ['|',('company_id','=',user.company_id.id),('company_id','=',False)]</field>
</record>
<record id="product_comp_rule" model="ir.rule"><field name="domain_force"> ['|',('company_id','=',user.company_id.id),('company_id','=',False)]</field>
</record>
<record id="product_product_consultant" model="product.product"><field name="sale_ok" eval="False"/>
</record>
</data>
</openerp>

163 changes: 163 additions & 0 deletions addons/product/migrations/8.0.1.1/openupgrade_analysis_WORK.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---Fields in module 'product'---
product / product.attribute / name (char) : NEW required: required
product / product.attribute / value_ids (one2many) : NEW relation: product.attribute.value
product / product.attribute.line / attribute_id (many2one) : NEW relation: product.attribute, required: required
product / product.attribute.line / product_tmpl_id (many2one) : NEW relation: product.template, required: required
product / product.attribute.line / value_ids (many2many) : NEW relation: product.attribute.value
product / product.attribute.price / price_extra (float) : NEW
product / product.attribute.price / product_tmpl_id (many2one) : NEW relation: product.template, required: required
product / product.attribute.price / value_id (many2one) : NEW relation: product.attribute.value, required: required
product / product.attribute.value / attribute_id (many2one) : NEW relation: product.attribute, required: required
product / product.attribute.value / name (char) : NEW required: required
product / product.attribute.value / price_ids (one2many) : NEW relation: product.attribute.price
product / product.attribute.value / product_ids (many2many) : NEW relation: product.product
product / product.attribute.value / sequence (integer) : NEW

## OK new model, will be handled by standard migration


product / product.packaging / ul_container (many2one) : NEW relation: product.ul
product / product.packaging / height (float) : DEL
product / product.ul / height (float) : NEW
product / product.packaging / length (float) : DEL
product / product.ul / length (float) : NEW
product / product.packaging / weight_ul (float) : DEL
product / product.ul / weight (float) : NEW
product / product.packaging / width (float) : DEL
product / product.ul / width (float) : NEW
## OK new relation ul_container handled by migration
## OK the dimensions are weight must be moved to the related UL (through the ul field)


product / product.price.history / company_id (many2one) : NEW relation: res.company, required: required, req_default: function
product / product.price.history / cost (float) : NEW
product / product.price.history / datetime (datetime) : NEW
product / product.price.history / product_template_id (many2one): NEW relation: product.template, required: required
# OK new fields -> nothing to do

product / product.template / attribute_line_ids (one2many) : NEW relation: product.attribute.line
product / product.product / attribute_value_ids (many2many): NEW relation: product.attribute.value
# OK nothing to do


product / product.supplierinfo / product_id (many2one) : DEL relation: product.template, required: required
product / product.supplierinfo / product_tmpl_id (many2one) : NEW relation: product.template, required: required
# OK seller_ids moved from product.product to product.template

product / product.template / active (boolean) : NEW
# OK: set to True if at least one variant is active

product / product.template / color (integer) : NEW
product / product.product / color (integer) : DEL
## OK color moved up in template

product / product.template / cost_method (selection) : module is now 'stock_account' ('product')
product / product.template / cost_method (selection) : now a function
product / product.template / cost_method (selection) : selection_keys is now '['average', 'real', 'standard']' ('['average', 'standard']')
# moved in stock_account, now a fields.property

product / product.template / image (binary) : NEW
product / product.product / image (binary) : now afunction
# OK need to move up to template

product / product.product / image_variant (binary) : NEW
# nothing to do

product / product.template / message_ids (one2many) : NEW relation: mail.message
product / product.template / message_last_post (datetime) : NEW
# now product.template derives from mail template
# TODO : move up messages -> they will still be on the product so why bother
product / product.product / message_last_post (datetime) : NEW


product / product.template / packaging (one2many) : NEW relation: product.packaging
# OK moved from product.product

product / product.template / produce_delay (float) : DEL
# OK moved in mrp, defined on product.product

product / product.template / product_variant_ids (one2many): NEW relation: product.product, required: required
# nothing to do?

product / product.template / standard_price (float) : now a function
# OK. Now a fields.property, properties needs to be created

product / product.product / incoming_qty (float) : module is now 'stock' ('product')
product / product.product / outgoing_qty (float) : module is now 'stock' ('product')
# function fields nothing to do

product / product.product / price_extra (float) : now a function
# OK moved to 'product.attribute.price', needs to create attributes

product / product.product / price_margin (float) : DEL
# no longer exists!

product / product.product / qty_available (float) : module is now 'stock' ('product')
# function field nothing to do

product / product.product / variants (char) : DEL
# OK moved to 'product.attribute.value', needs to create attributes

product / product.product / virtual_available (float) : module is now 'stock' ('product')
# function field nothing to do



---XML records in module 'product'---
NEW ir.actions.act_window: product.product_template_action
NEW ir.actions.act_window: product.product_variant_action
NEW ir.actions.act_window: product.variants_template_action
DEL ir.actions.act_window: product.product_normal_action_puchased
DEL ir.actions.act_window: product.product_template_action_tree
DEL ir.actions.act_window.view: product.open_view_product_form1
DEL ir.actions.act_window.view: product.open_view_product_kanban1
DEL ir.actions.act_window.view: product.open_view_product_tree1
NEW ir.actions.report.xml: product.action_report_pricelist
DEL ir.actions.report.xml: product.report_product_pricelist
## ir.actions: the doc says we can safely ignore these

NEW ir.model.access: product.access_product_attribute
NEW ir.model.access: product.access_product_attribute_line
NEW ir.model.access: product.access_product_attribute_line_sale_manager
NEW ir.model.access: product.access_product_attribute_price
NEW ir.model.access: product.access_product_attribute_price_sale_manager
NEW ir.model.access: product.access_product_attribute_sale_manager
NEW ir.model.access: product.access_product_attribute_value
NEW ir.model.access: product.access_product_attribute_value_sale_manager
NEW ir.model.access: product.access_product_price_history_employee
## access rules: let them be for now


NEW ir.ui.menu: product.menu_product_template_action
NEW ir.ui.view: product.product_template_form_view_variant_button
NEW ir.ui.view: product.product_template_kanban_view
NEW ir.ui.view: product.product_template_kanban_view_variant_button
NEW ir.ui.view: product.product_template_search_view
NEW ir.ui.view: product.report_pricelist
NEW ir.ui.view: product.variants_template_tree_view
DEL ir.ui.view: product.product_variant_form_view
DEL ir.ui.view: product.product_variant_tree_view
DEL ir.ui.view_sc: product.ir_ui_view_sc_product0
## ir.ui.* doc says we can ignore

DEL process.node: product.process_node_product0
DEL process.node: product.process_node_supplier0
DEL process.process: product.process_process_productprocess0
DEL process.transition: product.process_transition_supplierofproduct0
## process addon removed -> nothing to do

NEW product.uom: product.product_uom_floz
NEW product.uom: product.product_uom_foot
NEW product.uom: product.product_uom_gal
NEW product.uom: product.product_uom_inch
NEW product.uom: product.product_uom_lb
NEW product.uom: product.product_uom_mile
NEW product.uom: product.product_uom_oz
NEW product.uom: product.product_uom_qt
## great new stuff, std upgrade should work by itself

DEL res.groups: product.group_costing_method
DEL res.groups: product.group_product_variant
## well... probably nothing to do either...

## modified no update records listed in modified_data.xml
Loading