bemade_margin_vendor_pricelist: add pre-migration to clear old views.
This commit is contained in:
parent
486aa9560e
commit
4d1883475c
2 changed files with 22 additions and 1 deletions
|
|
@ -18,7 +18,7 @@
|
||||||
#
|
#
|
||||||
{
|
{
|
||||||
'name': 'Sales Margin on Vendor Price',
|
'name': 'Sales Margin on Vendor Price',
|
||||||
'version': '17.0.0.0.3',
|
'version': '17.0.0.0.4',
|
||||||
'summary': 'Enables calculation of sales margins based on vendor pricelists.',
|
'summary': 'Enables calculation of sales margins based on vendor pricelists.',
|
||||||
'description': """Adds a new method for calculating """,
|
'description': """Adds a new method for calculating """,
|
||||||
'author': 'Bemade Inc.',
|
'author': 'Bemade Inc.',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
from odoo import api, SUPERUSER_ID
|
||||||
|
from openupgradelib.openupgrade import rename_fields
|
||||||
|
|
||||||
|
|
||||||
|
def migrate(cr, version):
|
||||||
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
|
field_spec = [
|
||||||
|
('sale.order', 'sale_order', 'margin_actual', 'gross_profit'),
|
||||||
|
('sale.order', 'sale_order', 'margin_percent_actual', 'gross_profit_percent'),
|
||||||
|
('sale.order.line', 'sale_order_line', 'margin_percent_vendor', 'gross_profit_percent_vendor'),
|
||||||
|
('sale.order.line', 'sale_order_line', 'margin_vendor', 'gross_profit_vendor'),
|
||||||
|
('sale.order.line', 'sale_order_line', 'margin_actual', 'gross_profit'),
|
||||||
|
('sale.order.line', 'sale_order_line', 'margin_percent_actual', 'gross_profit_percent'),
|
||||||
|
]
|
||||||
|
rename_fields(env, field_spec)
|
||||||
|
view_datas = env['ir.model.data'].search([
|
||||||
|
('module', '=', 'bemade_margin_vendor_pricelist'),
|
||||||
|
('model', '=', 'ir.ui.view')
|
||||||
|
])
|
||||||
|
views = env['ir.ui.view'].browse(view_datas.mapped('res_id'))
|
||||||
|
views.unlink()
|
||||||
Loading…
Reference in a new issue