From 483deba7ae9358199740b172d509c1908ba1f3fb Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Jun 2022 12:46:00 +0000 Subject: [PATCH] remise en banque --- controllers/controllers.py | 19 +++++++++++++++++++ models/donation.py | 6 ++++-- models/payment_batch.py | 1 + views/donation.xml | 5 +++-- wizard/create_accounting_deposit_wizard.py | 1 + wizard/create_bank_deposit_wizard.py | 7 ------- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/controllers/controllers.py b/controllers/controllers.py index ee4ed69..ecb55f0 100644 --- a/controllers/controllers.py +++ b/controllers/controllers.py @@ -8,6 +8,25 @@ import json class opendons(http.Controller): + + @http.route(['/opendons/object'], type='http', auth='public', website=True, sitemap=False,csrf=False) + def object(self,model,id,*args,**kw): + + field_list=request.env[model].sudo().fields_get() + objet=request.env[model].search([('id','=',int(id))]) + + # result=[] + # for key in field_list: + + + # result.append((key,str(objet[key]))) + # result.sort() + # return json.dumps(result) + result="" + for key in field_list: + result=result+str(key)+':'+str(objet[key])+'
' + return result + @http.route(['/opendons/cp'],type='json', methods=['GET','POST'],auth="public",csrf=False) def index(self, **post): name = post.get('name', False) diff --git a/models/donation.py b/models/donation.py index 4667ef4..292eae2 100644 --- a/models/donation.py +++ b/models/donation.py @@ -85,8 +85,10 @@ class DonationDonation(models.Model): ondelete='set null' ) - bank_deposit_date=fields.Datetime('Bank deposit date', related='payment_batch_id.bank_deposit_date') - accounting_deposit_date=fields.Datetime('Accounting deposit date' , related='payment_batch_id.accountingdeposit_date') + #bank_deposit_date=fields.Datetime(related='payment_batch_id.bank_deposit_date') + payment_state=fields.Selection(related='payment_batch_id.state') + + #accounting_deposit_date=fields.Datetime(related='payment_batch_id.accounting_deposit_date') year_donation_date=fields.Integer('Year donation date',compute='_compute_year_donation_date',store=True) print_email_history_ids=fields.One2many( diff --git a/models/payment_batch.py b/models/payment_batch.py index f0f81de..2de0221 100644 --- a/models/payment_batch.py +++ b/models/payment_batch.py @@ -151,6 +151,7 @@ class opendons_payment_batch(models.Model): currency_field='currency_id',compute="_compute_total" ) + deposited_in_bank=fields.Boolean('deposited in bank') @api.onchange('operation_id') diff --git a/views/donation.xml b/views/donation.xml index dcd7fda..844af89 100644 --- a/views/donation.xml +++ b/views/donation.xml @@ -8,8 +8,9 @@ - - + + + diff --git a/wizard/create_accounting_deposit_wizard.py b/wizard/create_accounting_deposit_wizard.py index b961cc7..b102f4a 100644 --- a/wizard/create_accounting_deposit_wizard.py +++ b/wizard/create_accounting_deposit_wizard.py @@ -23,6 +23,7 @@ class CreateaccountingDeposit(models.TransientModel): #add accounting deposit to payment p.accountingdeposit_id=bd.id + p.accounting_deposit_date=bd.create_date p.state='deposited_in_accounting' diff --git a/wizard/create_bank_deposit_wizard.py b/wizard/create_bank_deposit_wizard.py index 53f4a20..d91c1cb 100644 --- a/wizard/create_bank_deposit_wizard.py +++ b/wizard/create_bank_deposit_wizard.py @@ -30,10 +30,3 @@ class CreateBankDeposit(models.TransientModel): p.bank_deposit_date=bd.create_date - # #creation de l'opération sans les segments - # vals={} - # vals['name']='copy of ' + record.name - # vals['chanel']=record.chanel - # vals['user_id']=self._uid - # vals['state']='draft' - # dup_operation=super(opendons_operation, self).create(vals)