Skip to content

Commit

Permalink
[FIX] viin_brand_mail: fix runbot when debranding odoo bot
Browse files Browse the repository at this point in the history
  • Loading branch information
SonCrits committed Jul 17, 2024
1 parent e52b711 commit b5d5a40
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions viin_brand_mail/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
from . import models
from . import wizard
from odoo.tests.common import TransactionCase
setupTransactionCase = TransactionCase.setUp


def _setupTransactionCase_plus(self):
"""Odoo has some test cases to check the return value when the Odoo bot performs an action
Some tests like:
- test_manual_revaluation_statement
Therefore, it is necessary to check if the Odoo bot is being rebranded as the Viindoo bot
Change the name and email of the Odoo bot if necessary
"""
res = setupTransactionCase(self)
bot = self.env.ref('base.partner_root', raise_if_not_found=False)
if bot.name == 'ViindooBot' or bot.email == '[email protected]':
bot.write({
'name': 'OdooBot',
'email': '[email protected]'
})
return res


def _post_init_hook(env):
TransactionCase.setUp = _setupTransactionCase_plus
1 change: 1 addition & 0 deletions viin_brand_mail/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
},
'installable': True,
'auto_install': True,
'post_init_hook': '_post_init_hook',
'price': 9.9,
'currency': 'EUR',
'license': 'OPL-1',
Expand Down

0 comments on commit b5d5a40

Please sign in to comment.