diff --git a/__manifest__.py b/__manifest__.py index e508d67..ad9ad19 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -59,7 +59,8 @@ 'views/partner_import.xml', 'views/portal.xml', 'data/donation_recurring_mail_template.xml', - 'views/partner.xml' + 'views/partner.xml', + 'views/fls.xml' diff --git a/models/__init__.py b/models/__init__.py index 0512fd1..f79bcb7 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -25,3 +25,5 @@ from . import partner_import from .import donation_print_email_history from .import bank_deposit from .import accounting_deposit +from .import fls + diff --git a/models/accounting_deposit.py b/models/accounting_deposit.py index 5ca1255..c65d9ae 100644 --- a/models/accounting_deposit.py +++ b/models/accounting_deposit.py @@ -21,4 +21,10 @@ class opendons_accounting_deposit(models.Model): string='Payment batchs', readonly=True ) + payment_batch_ids = fields.One2many( + 'opendons_payment_batch', + 'accountingdeposit_id', + string='Payment batchs', + readonly=True + ) \ No newline at end of file diff --git a/models/fls.py b/models/fls.py new file mode 100644 index 0000000..7fa4b72 --- /dev/null +++ b/models/fls.py @@ -0,0 +1,45 @@ +from odoo import models, fields, api +import logging +import psycopg2 + +from contextlib import contextmanager +import json + +class fls(models.TransientModel): + _name = 'fls' + _description = 'fls data' + + name = fields.Char() + description = fields.Char() + + def get_data(self): + db = self.env['base.external.dbsource'].search([('name', '=', 'fls')], limit=1) + + conn = db.connection_open_postgresql() + + query = 'select nom from public.contact' + params=None + metadata=None + cursor = db.execute_postgresql(query,params,metadata) + + self.env['fls'].search([]).unlink() + vals={} + #raise Warning(json.dumps(cursor[0][0])) + i=1 + for row in cursor[0] or []: + if i==100:break + vals['name'] = row + + self.create(vals) + i=i+1 + + db.connection_close_postgresql(conn) + action_vals = {'name': 'Transient Model from external datasource', + 'type': 'ir.actions.act_window', + 'view_mode': 'tree', + 'res_model': 'fls', + } + return action_vals + + + diff --git a/models/payment_batch.py b/models/payment_batch.py index 2de0221..d6918ad 100644 --- a/models/payment_batch.py +++ b/models/payment_batch.py @@ -67,8 +67,7 @@ class opendons_payment_batch(models.Model): track_visibility='onchange') - bank_deposit_date=fields.Datetime(related='bankdeposit_id.create_date') - accounting_deposit_date=fields.Datetime(related='accountingdeposit_id.create_date') + bankdeposit_id = fields.Many2one( 'opendons.bankdeposit', @@ -86,6 +85,8 @@ class opendons_payment_batch(models.Model): track_visibility='onchange', ) + bank_deposit_date=fields.Datetime(related='bankdeposit_id.create_date') + accounting_deposit_date=fields.Datetime(related='accountingdeposit_id.create_date') state = fields.Selection([ ('draft', 'Draft'), ('validated', 'Validated'), diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv index ad1a4ae..e551747 100644 --- a/security/ir.model.access.csv +++ b/security/ir.model.access.csv @@ -59,4 +59,6 @@ access_opendons_create_accounting_deposit_wizard,opendons_create_accounting_depo access_opendons_bank_deposit,opendons_bank_deposit,model_opendons_bankdeposit,donation.group_donation_manager,1,1,1,1 access_opendons_bank_deposit_template,opendons_bank_deposit_template,model_opendons_bankdeposit_template,donation.group_donation_manager,1,1,1,1 -access_opendons_accounting_deposit,opendons_accounting_deposit,model_opendons_accountingdeposit,donation.group_donation_manager,1,1,1,1 \ No newline at end of file +access_opendons_accounting_deposit,opendons_accounting_deposit,model_opendons_accountingdeposit,donation.group_donation_manager,1,1,1,1 + +access_fls,fls access,model_fls,base.group_system,1,1,1,1 \ No newline at end of file diff --git a/static/description/recurring_donation.png b/static/description/recurring_donation.png index 649558c..ebc7a47 100644 Binary files a/static/description/recurring_donation.png and b/static/description/recurring_donation.png differ diff --git a/views/fls.xml b/views/fls.xml new file mode 100644 index 0000000..d3c64fa --- /dev/null +++ b/views/fls.xml @@ -0,0 +1,20 @@ + + + + + + fls action + fls + tree,form + + + + + + + + + + \ No newline at end of file diff --git a/views/partner.xml b/views/partner.xml index e459446..db60e22 100644 --- a/views/partner.xml +++ b/views/partner.xml @@ -98,7 +98,7 @@ - +