Browse Source

[IMP] emc: add user error if cooperator account is not set

pull/21/head
robin.keunen 5 years ago
parent
commit
c6464dad16
  1. 8
      easy_my_coop/models/coop.py

8
easy_my_coop/models/coop.py

@ -404,7 +404,13 @@ class SubscriptionRequest(models.Model):
if self.company_id.property_cooperator_account: if self.company_id.property_cooperator_account:
account = self.company_id.property_cooperator_account account = self.company_id.property_cooperator_account
else: else:
account = account_obj.search([('code', '=', '416000')])[0]
accounts = account_obj.search([('code', '=', '416000')])
if accounts:
account = accounts[0]
else:
raise UserError(_(
'You must set a cooperator account on you company.'
))
return account return account
def get_invoice_vals(self, partner): def get_invoice_vals(self, partner):

Loading…
Cancel
Save