|
@ -46,16 +46,16 @@ _auto_end_original = models.BaseModel._auto_end |
|
|
|
|
|
|
|
|
def _auto_end(self, cr, context=None): |
|
|
def _auto_end(self, cr, context=None): |
|
|
""" Create the foreign keys recorded by _auto_init. |
|
|
""" Create the foreign keys recorded by _auto_init. |
|
|
(pos_product_category monkey patching) |
|
|
|
|
|
|
|
|
(pos_remove_pos_category monkey patching) |
|
|
""" |
|
|
""" |
|
|
context = context or {} |
|
|
context = context or {} |
|
|
module = context['module'] |
|
|
module = context['module'] |
|
|
foreign_keys = [] |
|
|
foreign_keys = [] |
|
|
patched = 'openerp.addons.pos_product_category' in sys.modules |
|
|
|
|
|
|
|
|
patched = 'openerp.addons.pos_remove_pos_category' in sys.modules |
|
|
|
|
|
|
|
|
for t, k, r, d in self._foreign_keys: |
|
|
for t, k, r, d in self._foreign_keys: |
|
|
if patched and (t, k) == ('product_template', 'pos_categ_id'): |
|
|
if patched and (t, k) == ('product_template', 'pos_categ_id'): |
|
|
if module == 'pos_product_category': |
|
|
|
|
|
|
|
|
if module == 'pos_remove_pos_category': |
|
|
cr.execute(''' |
|
|
cr.execute(''' |
|
|
ALTER TABLE product_template |
|
|
ALTER TABLE product_template |
|
|
DROP CONSTRAINT IF EXISTS |
|
|
DROP CONSTRAINT IF EXISTS |