| 1 |
from odoo import fields, models |
| 2 |
|
| 3 |
|
| 4 |
class ResConfigSettings(models.TransientModel): |
| 5 |
_inherit = 'res.config.settings' |
| 6 |
|
| 7 |
l10n_ro_edi_client_id = fields.Char(related='company_id.l10n_ro_edi_client_id', readonly=False) |
| 8 |
l10n_ro_edi_client_secret = fields.Char(related='company_id.l10n_ro_edi_client_secret', readonly=False) |
| 9 |
l10n_ro_edi_access_token = fields.Char(related='company_id.l10n_ro_edi_access_token', readonly=False) |
| 10 |
l10n_ro_edi_refresh_token = fields.Char(related='company_id.l10n_ro_edi_refresh_token', readonly=False) |
| 11 |
l10n_ro_edi_access_expiry_date = fields.Date(related='company_id.l10n_ro_edi_access_expiry_date', readonly=False) |
| 12 |
l10n_ro_edi_refresh_expiry_date = fields.Date(related='company_id.l10n_ro_edi_refresh_expiry_date', readonly=False) |
| 13 |
l10n_ro_edi_callback_url = fields.Char(related='company_id.l10n_ro_edi_callback_url') |
| 14 |
l10n_ro_edi_test_env = fields.Boolean(related='company_id.l10n_ro_edi_test_env', readonly=False) |
| 15 |
l10n_ro_edi_anaf_imported_inv_journal_id = fields.Many2one(related='company_id.l10n_ro_edi_anaf_imported_inv_journal_id', readonly=False) |
| 16 |
|
| 17 |
def button_l10n_ro_edi_generate_token(self): |
| 18 |
""" Redirects to controllers/main.py ~ `authorize` method """ |
| 19 |
self.ensure_one() |
| 20 |
return { |
| 21 |
'type': 'ir.actions.act_url', |
| 22 |
'url': '/l10n_ro_edi/authorize/%s' % self.company_id.id, |
| 23 |
'target': 'new', |
| 24 |
} |