-
-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] Allow to use the storage either from the payment mode or from t…
…he payment method
- Loading branch information
1 parent
297eebf
commit c984316
Showing
30 changed files
with
286 additions
and
282 deletions.
There are no files selected for viewing
79 changes: 0 additions & 79 deletions
79
account_payment_method_fs_storage/i18n/account_payment_method_fs_storage.pot
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
3 changes: 3 additions & 0 deletions
3
...ment_method_fs_storage/models/__init__.py → ...hod_or_mode_fs_storage/models/__init__.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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from . import account_payment_order | ||
from . import account_payment_method | ||
from . import fs_storage | ||
from . import account_payment_mode | ||
from . import res_config_settings | ||
from . import res_company |
File renamed without changes.
25 changes: 25 additions & 0 deletions
25
account_payment_method_or_mode_fs_storage/models/account_payment_mode.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,25 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class AccountPaymentMode(models.Model): | ||
|
||
_inherit = "account.payment.mode" | ||
|
||
storage = fields.Selection( | ||
selection="_get_selection_storage", | ||
help="Storage where to put the file after generation", | ||
) | ||
|
||
def _get_selection_storage(self): | ||
""" | ||
This is to avoid giving access to the model fs.storage | ||
at groups other than base.group_system | ||
""" | ||
storages = ( | ||
self.env["fs.storage"].sudo().search([("use_on_payment_mode", "=", True)]) | ||
) | ||
|
||
return [(str(r.id), r.display_name) for r in storages] |
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.