mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-22 12:42:02 +02:00
Initial commit: Accounting packages
This commit is contained in:
commit
4ef34c2317
2661 changed files with 1709616 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import wizards
|
||||
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
""" Create `account.payment.method` records for the installed payment providers. """
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
PaymentProvider = env['payment.provider']
|
||||
installed_providers = PaymentProvider.search([('module_id.state', '=', 'installed')])
|
||||
for code in set(installed_providers.mapped('code')):
|
||||
PaymentProvider._setup_payment_method(code)
|
||||
|
||||
|
||||
def uninstall_hook(cr, registry):
|
||||
""" Delete `account.payment.method` records created for the installed payment providers. """
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
installed_providers = env['payment.provider'].search([('module_id.state', '=', 'installed')])
|
||||
env['account.payment.method'].search([
|
||||
('code', 'in', installed_providers.mapped('code')),
|
||||
('payment_type', '=', 'inbound'),
|
||||
]).unlink()
|
||||
Loading…
Add table
Add a link
Reference in a new issue