Skip to content

Instantly share code, notes, and snippets.

@tong-odoo
Last active September 19, 2023 09:03
Show Gist options
  • Select an option

  • Save tong-odoo/c1cfffb5ec6215296892e8b561a14872 to your computer and use it in GitHub Desktop.

Select an option

Save tong-odoo/c1cfffb5ec6215296892e8b561a14872 to your computer and use it in GitHub Desktop.
Project
env.cr.execute("""
UPDATE ir_ui_view SET arch_db = REPLACE(arch_db, 'x_studio_payment_date', 'x_payment_date') WHERE arch_db LIKE '%x_studio_payment_date%';
UPDATE ir_ui_view SET arch_db = REPLACE(arch_db, 'x_studio_payment_entry', 'x_payment_entry') WHERE arch_db LIKE '%x_studio_payment_entry%';
UPDATE ir_act_server SET code = REPLACE(code, 'x_studio_payment_date', 'x_payment_date') WHERE code LIKE '%x_studio_payment_date%' and id = 615;
DELETE FROM ir_model_fields WHERE name = 'x_studio_payment_date';
DELETE FROM ir_model_fields WHERE name = 'x_studio_payment_entry';
DELETE FROM base_automation WHERE id = 9;
DELETE FROM ir_actions WHERE id = 608;
""")
old_categ = env["product.category"].search([("name", "=", "Side Diamond")])
new_categ = env.ref("flawless_mrp.product_category_side_diamonds")
new_categ["property_valuation"] = "real_time"
new_categ["property_stock_account_production_cost_id"] = env.ref("account.1_l10n_id_29000000")
products = env["product.template"].search([("categ_id", "=", old_categ.id)])
products["categ_id"] = new_categ
old_categ.unlink()
env.cr.execute("""
UPDATE mail_template
SET subject = replace(subject, 'x_studio_many2one_field_c1H8O', 'site_id'),
body_html = replace(body_html, 'x_studio_many2one_field_c1H8O', 'site_id')
WHERE subject like '%x_studio_many2one_field_c1H8O%'
OR body_html like '%x_studio_many2one_field_c1H8O%';
UPDATE mail_template
SET subject = replace(subject, 'x_studio_om_partner_pic', 'om_partner_pic'),
body_html = replace(body_html, 'x_studio_om_partner_pic', 'om_partner_pic'),
email_to = replace(email_to, 'x_studio_om_partner_pic', 'om_partner_pic'),
partner_to = replace(partner_to, 'x_studio_om_partner_pic', 'om_partner_pic')
WHERE subject like '%x_studio_om_partner_pic%'
OR body_html like '%x_studio_om_partner_pic%'
OR email_to like '%x_studio_om_partner_pic%'
OR partner_to like '%x_studio_om_partner_pic%';
""")
env.cr.execute("""
UPDATE mail_template
SET subject = replace(subject, 'x_studio_staff_id', 'staff_id'),
body_html = replace(body_html, 'x_studio_staff_id', 'staff_id'),
email_to = replace(email_to, 'x_studio_staff_id', 'staff_id'),
partner_to = replace(partner_to, 'x_studio_staff_id', 'staff_id')
WHERE subject like '%x_studio_staff_id%'
OR body_html like '%x_studio_staff_id%'
OR email_to like '%x_studio_staff_id%'
OR partner_to like '%x_studio_staff_id%';
""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment