from odoo import models, fields, api
|
|
from odoo.exceptions import UserError, ValidationError
|
|
from psycopg2 import sql, DatabaseError
|
|
|
|
from werkzeug import utils
|
|
import base64
|
|
|
|
|
|
|
|
|
|
class DonationDonation(models.Model):
|
|
_inherit = 'donation.donation'
|
|
|
|
operation_id = fields.Many2one(
|
|
'opendons.operation',
|
|
string='Operation',
|
|
track_visibility='onchange',
|
|
ondelete='restrict',
|
|
domain=[('state', '=', 'exported')]
|
|
|
|
)
|
|
# operation_state= fields.Char(related='operation_id.state')
|
|
|
|
segment_id = fields.Many2one(
|
|
'opendons.segment',
|
|
string='Segment',
|
|
track_visibility='onchange',
|
|
ondelete='restrict'
|
|
|
|
)
|
|
# #pour les prélèvements automatiques
|
|
# rum_direct_debit = fields.Char(
|
|
# 'RUM'
|
|
|
|
|
|
# )
|
|
# iban_direct_debit = fields.Char(
|
|
# 'iban'
|
|
# )
|
|
# bic_direct_debit = fields.Char(
|
|
# 'bic'
|
|
# )
|
|
# start_date_direct_debit = fields.Date(
|
|
# string='Start Date',
|
|
# index=True,
|
|
# track_visibility='onchange'
|
|
# )
|
|
# end_date_direct_debit = fields.Date(
|
|
# string='End Date',
|
|
# index=True,
|
|
# track_visibility='onchange'
|
|
# )
|
|
frequency =fields.Selection(
|
|
[('monthly','Monthly'), ('bimonthly','Bimonthly'),('quarterly','Quarterly'),('half-yearly','Half-yearly'),('annually','Annually')],
|
|
default='monthly'
|
|
)
|
|
|
|
# sepa_status_direct_debit=fields.Selection(
|
|
# [('done','Done'),('rejected','Rejected')]
|
|
# )
|
|
# rejected_date_direct_debit = fields.Date(
|
|
# string='rejected date',
|
|
# index=True,
|
|
# track_visibility='onchange'
|
|
# )
|
|
|
|
@api.onchange('operation_id')
|
|
def _onchange_operation_id(self):
|
|
res = {}
|
|
res['domain']={'segment_id':[('operation_id', '=', self.operation_id.id)]}
|
|
return res
|
|
|
|
# payment_batch_id = fields.Many2one(
|
|
# 'opendons_payment_batch',
|
|
# string='Payment Batch',
|
|
# ondelete='set null'
|
|
# )
|
|
|
|
# def _compute_rum(self):
|
|
# for rec in self:
|
|
# rec.rum_direct_debit=''
|
|
#if rec.recurring_template: rec.rum_direct_debit='GHGHH65767688899976'
|
|
#rec.rum_direct_debit='GHGHH65767688899976'
|
|
|