[IMP] l10n_in_edi*: add buy credits button

Added buy credits button in the view which gives ease to user to directly buy
l10n_in_edi IAP credits

X-original-commit: a604e023d79c72ab2f91b063bdd592f6c03e1eac
Part-of: odoo/odoo#148418
This commit is contained in:
Harsh Modi
2024-01-10 05:04:39 +00:00
parent 190382e665
commit 212d0dd4fc
3 changed files with 15 additions and 0 deletions
@@ -32,3 +32,12 @@ class ResConfigSettings(models.TransientModel):
self.env["account.edi.format"]._l10n_in_edi_authenticate(self.company_id)
if not self.company_id.sudo()._l10n_in_edi_token_is_valid():
raise UserError(_("Incorrect username or password, or the GST number on company does not match."))
def l10n_in_edi_buy_iap(self):
if not self.l10n_in_edi_production_env:
raise UserError(_("You must enable production environment to buy credits"))
return {
'type': 'ir.actions.act_url',
'url': self.env["iap.account"].get_credits_url(service_name="l10n_in_edi", base_url=''),
'target': '_new'
}
@@ -27,6 +27,9 @@
<div class='mt8'>
<button name="l10n_in_edi_test" icon="oi-arrow-right" type="object" string="Verify Username and Password" class="btn-link"/>
</div>
<div class='mt8'>
<button name="l10n_in_edi_buy_iap" title="Costs 1 credit per transaction. Free 200 credits will be available for the first time." icon="fa-arrow-right" type="object" string="Buy credits" class="btn-link"/>
</div>
</setting>
</xpath>
</field>
@@ -27,6 +27,9 @@
<div class='mt8'>
<button name="l10n_in_edi_ewaybill_test" icon="oi-arrow-right" type="object" string="Verify Username and Password" class="btn-link"/>
</div>
<div class='mt8'>
<button name="l10n_in_edi_buy_iap" title="Costs 1 credit per transaction. Free 200 credits will be available for the first time." icon="fa-arrow-right" type="object" string="Buy credits" class="btn-link"/>
</div>
</setting>
</xpath>
</field>