-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85f33af
commit 0df3866
Showing
24 changed files
with
283 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
UPDATE l10n_ro_account_anaf_sync | ||
SET state = 'test', anaf_einvoice_sync_url = 'https://api.anaf.ro/test/FCTEL/rest'; | ||
UPDATE l10n_ro_account_anaf_sync_scope SET state = 'test'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import l10n_ro_account_anaf_sync | ||
from . import l10n_ro_account_anaf_sync_scope | ||
from . import res_company |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
l10n_ro_account_anaf_sync/models/l10n_ro_account_anaf_sync_scope.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (C) 2024 Dakai Soft | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountANAFSyncScope(models.Model): | ||
_name = "l10n.ro.account.anaf.sync.scope" | ||
_inherit = ["mail.thread", "l10n.ro.mixin"] | ||
_description = "Account ANAF Sync Scope" | ||
|
||
anaf_sync_id = fields.Many2one("l10n.ro.account.anaf.sync") | ||
company_id = fields.Many2one(related="anaf_sync_id.company_id", store=True) | ||
scope = fields.Selection([]) | ||
anaf_sync_production_url = fields.Char(string="API production URL") | ||
anaf_sync_test_url = fields.Char(string="API test URL") | ||
state = fields.Selection( | ||
[("test", "Test"), ("production", "Production")], | ||
default="test", | ||
) | ||
anaf_sync_url = fields.Char(compute="_compute_anaf_sync_url") | ||
|
||
@api.depends("state") | ||
def _compute_anaf_sync_url(self): | ||
for entry in self: | ||
entry.anaf_sync_url = getattr( | ||
entry, f"anaf_sync_{entry.state}_url", "anaf_sync_test_url" | ||
) | ||
|
||
@api.onchange("scope") | ||
def _onchange_scope(self): | ||
self._compute_anaf_sync_url() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PyJWT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.