
from functools import partial
import openerp
from openerp import api, SUPERUSER_ID

from . import models      # noqa
from . import report      # noqa


def uninstall_hook(cr, registry):
    def recreate_view(dbname):
        db_registry = openerp.modules.registry.Registry.new(dbname)
        with api.Environment.manage(), db_registry.cursor() as cr:
            env = api.Environment(cr, SUPERUSER_ID, {})
            if 'sale.report' in env:
                env['sale.report'].init()

    cr.after("commit", partial(recreate_view, cr.dbname))


from functools import partial
import odoo
from odoo import api, SUPERUSER_ID

from . import models      # noqa
from . import report      # noqa


def uninstall_hook(cr, registry):
    def recreate_view(dbname):
        db_registry = odoo.modules.registry.Registry.new(dbname)
        with api.Environment.manage(), db_registry.cursor() as cr:
            env = api.Environment(cr, SUPERUSER_ID, {})
            if 'sale.report' in env:
                env['sale.report'].init()

    cr.after("commit", partial(recreate_view, cr.dbname))

Use odoo instead of openerp
[IMP] sale_margin: Use odoo instead of openerp

Closes #23451

  
  from functools import partial
- import openerp
+ import odoo
- from openerp import api, SUPERUSER_ID
+ from odoo import api, SUPERUSER_ID
  
  from . import models      # noqa
  from . import report      # noqa
  
  
  def uninstall_hook(cr, registry):
      def recreate_view(dbname):
-         db_registry = openerp.modules.registry.Registry.new(dbname)
+         db_registry = odoo.modules.registry.Registry.new(dbname)
          with api.Environment.manage(), db_registry.cursor() as cr:
              env = api.Environment(cr, SUPERUSER_ID, {})
              if 'sale.report' in env:
                  env['sale.report'].init()
  
      cr.after("commit", partial(recreate_view, cr.dbname))
  
Use odoo instead of openerp
## Code Before:

from functools import partial
import openerp
from openerp import api, SUPERUSER_ID

from . import models      # noqa
from . import report      # noqa


def uninstall_hook(cr, registry):
    def recreate_view(dbname):
        db_registry = openerp.modules.registry.Registry.new(dbname)
        with api.Environment.manage(), db_registry.cursor() as cr:
            env = api.Environment(cr, SUPERUSER_ID, {})
            if 'sale.report' in env:
                env['sale.report'].init()

    cr.after("commit", partial(recreate_view, cr.dbname))

## Instruction:
Use odoo instead of openerp
## Code After:

from functools import partial
import odoo
from odoo import api, SUPERUSER_ID

from . import models      # noqa
from . import report      # noqa


def uninstall_hook(cr, registry):
    def recreate_view(dbname):
        db_registry = odoo.modules.registry.Registry.new(dbname)
        with api.Environment.manage(), db_registry.cursor() as cr:
            env = api.Environment(cr, SUPERUSER_ID, {})
            if 'sale.report' in env:
                env['sale.report'].init()

    cr.after("commit", partial(recreate_view, cr.dbname))
