account_credit_hold and bemade_mailcow_integration fixed to pass tests
This commit is contained in:
parent
2410cceaab
commit
a951989662
2 changed files with 7 additions and 9 deletions
|
|
@ -44,8 +44,8 @@ class Partner(models.Model):
|
||||||
rec.hold_bg = False
|
rec.hold_bg = False
|
||||||
rec.message_post(body=_('Credit hold lifted.'))
|
rec.message_post(body=_('Credit hold lifted.'))
|
||||||
|
|
||||||
def _execute_followup_partner(self):
|
def _execute_followup_partner(self, options=None):
|
||||||
res = super()._execute_followup_partner()
|
res = super()._execute_followup_partner(options)
|
||||||
if self.followup_status == 'in_need_of_action':
|
if self.followup_status == 'in_need_of_action':
|
||||||
if self.followup_line_id.account_hold:
|
if self.followup_line_id.account_hold:
|
||||||
self.action_credit_hold()
|
self.action_credit_hold()
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class MailcowMailbox(models.Model):
|
||||||
Overridden create method to add a new mailbox entry on the Mailcow server for each user created in Odoo.
|
Overridden create method to add a new mailbox entry on the Mailcow server for each user created in Odoo.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
res_list = []
|
res = self.env['mail.mailcow.mailbox']
|
||||||
|
|
||||||
for vals in vals_list:
|
for vals in vals_list:
|
||||||
password = secrets.token_hex(16)
|
password = secrets.token_hex(16)
|
||||||
|
|
@ -81,10 +81,8 @@ class MailcowMailbox(models.Model):
|
||||||
self.api_request(endpoint, method='POST', data=data)
|
self.api_request(endpoint, method='POST', data=data)
|
||||||
_logger.info(f"Mailbox {vals['local_part']}@{vals['domain']} has been created on Mailcow server")
|
_logger.info(f"Mailbox {vals['local_part']}@{vals['domain']} has been created on Mailcow server")
|
||||||
|
|
||||||
res = super().create(vals)
|
res |= super().create(vals)
|
||||||
res_list.append(res)
|
return res
|
||||||
|
|
||||||
return res_list
|
|
||||||
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
"""
|
"""
|
||||||
|
|
@ -141,8 +139,8 @@ class MailcowMailbox(models.Model):
|
||||||
self.api_request(endpoint, method='POST', data=data)
|
self.api_request(endpoint, method='POST', data=data)
|
||||||
_logger.info(f'Mailbox for user {user.login} has been created on Mailcow server')
|
_logger.info(f'Mailbox for user {user.login} has been created on Mailcow server')
|
||||||
|
|
||||||
pw_bundle = seld.env['password.bundle'].search([('name', '=', user.name)])
|
pw_bundle = self.env['password.bundle'].search([('name', '=', user.name)])
|
||||||
self.env['password.key'].create_mailbox_for_user(res)
|
self.env['password.key'].create_mailbox_for_user(user)
|
||||||
|
|
||||||
return self.create({
|
return self.create({
|
||||||
'address': user.login,
|
'address': user.login,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue