@ -0,0 +1,19 @@ | |||
from odoo import models, fields, api | |||
from odoo.exceptions import UserError, ValidationError | |||
from psycopg2 import sql, DatabaseError | |||
from werkzeug import utils | |||
class opendons_direct_debit(models.Model): | |||
_name = 'opendons_direct_debit' | |||
_description = 'manage direct debit' | |||
partner_id = fields.Many2one( | |||
'res.partner', | |||
string='partner', | |||
required=True, | |||
index=True, | |||
readonly=True, | |||
track_visibility='onchange', | |||
ondelete='restrict' | |||
) |
@ -0,0 +1,72 @@ | |||
from odoo import models, fields, api | |||
from odoo.exceptions import UserError, ValidationError | |||
from psycopg2 import sql, DatabaseError | |||
from werkzeug import utils | |||
class opendons_payment_batch(models.Model): | |||
_name = 'opendons_payment_batch' | |||
_description = 'manage payment batch' | |||
payment_mode=fields.Selection([('check', 'Check'),('credit card', 'Credit Card'),('pa', 'Prélèvement automatique') ],'Payment mode', default='check', required=True) | |||
# product_id=fields.Many2one( | |||
# 'product.product', | |||
# string='Product', | |||
# index=True, | |||
# track_visibility='onchange', | |||
# ondelete='restrict' | |||
# ) | |||
operation_id=fields.Many2one( | |||
'opendons.operation', | |||
string='Operation', | |||
index=True, | |||
track_visibility='onchange', | |||
ondelete='restrict' | |||
) | |||
segment_id=fields.Many2one( | |||
'opendons.segment', | |||
string='Segment', | |||
index=True, | |||
track_visibility='onchange', | |||
ondelete='restrict' | |||
) | |||
# donation_ids = fields.One2many( | |||
# 'donation.donation', | |||
# 'payment_batch_id', | |||
# string='donation', | |||
# track_visibility='onchange') | |||
payment_count=fields.Integer(string='payments count', readonly=True) | |||
payment_input=fields.Char('Input field') | |||
# payment_lines = fields.One2many( | |||
# 'opendons_payment_batch.lines', | |||
# 'payment_batch_id', | |||
# string='Payment lines', | |||
# track_visibility='onchange') | |||
def action_ajouter_payment(self): | |||
return True | |||
class opendons_payment_batch_lines(models.Model): | |||
_name = 'opendons_payment_batch.lines' | |||
_description = 'manage payment batch lines' | |||
_inherits = { | |||
'donation.donation': 'donation_id', | |||
} | |||
# payment_batch_id = fields.Many2one( | |||
# 'opendons_payment_batch', | |||
# string='Payment Batch', | |||
# ondelete='set null' | |||
# ) | |||
@ -0,0 +1,84 @@ | |||
# -*- coding: utf-8 -*- | |||
from odoo import models, fields, api | |||
from odoo.exceptions import UserError, ValidationError | |||
from psycopg2 import sql, DatabaseError | |||
from werkzeug import utils | |||
class opendons_returnmail(models.Model): | |||
_name = 'opendons_returnmail' | |||
_description = 'manage return mail' | |||
return_type=fields.Selection(string='Type', | |||
selection=[ | |||
('npai', 'NPAI'), | |||
('decedee','Décédée'), | |||
('refusee','Refusée') | |||
],default='npai') | |||
return_count=fields.Integer(string='returns count', readonly=True) | |||
return_input=fields.Char('Input field') | |||
npai_lines = fields.One2many( | |||
'opendons_returnmail.npai', | |||
'returnmail_id', | |||
string='NPAI', | |||
track_visibility='onchange') | |||
#related_npai_partner_id = fields.Many2one(related='returnmailnpai_ids.partner_id') | |||
def action_ajouter_npai(self): | |||
data=self.return_input.split(';') | |||
vals={} | |||
vals['partner_id']=data[0] | |||
vals['operation_id']=data[1] | |||
vals['segment_id']=data[2] | |||
vals['returnmail_id']=self.id | |||
p=self.env['res.partner'].search_count([('id','=',int(vals['partner_id']))]) | |||
if p==0 : raise UserError("ce contact n'existe pas") | |||
op=self.env['opendons.operation'].search_count([('id','=',int(vals['operation_id']))]) | |||
if op==0 : raise UserError("cette operation n'existe pas") | |||
seg=self.env['opendons.segment'].search_count([('id','=',int(vals['segment_id']))]) | |||
if seg==0 : raise UserError("ce segment n'existe pas") | |||
res=self.env['opendons_returnmail.npai'].create(vals) | |||
self.env.cr.commit() | |||
class opendons_returnmailNpai(models.Model): | |||
_name = 'opendons_returnmail.npai' | |||
_description = 'gestion des retours NPAI' | |||
returnmail_id = fields.Many2one( | |||
'opendons_returnmail', | |||
string='return mail', | |||
ondelete='set null' | |||
) | |||
partner_id=fields.Many2one( | |||
'res.partner', | |||
string='Partner', | |||
required=True, | |||
index=True, | |||
track_visibility='onchange', | |||
ondelete='restrict' | |||
) | |||
operation_id=fields.Many2one( | |||
'opendons.operation', | |||
string='Operation', | |||
required=True, | |||
index=True, | |||
track_visibility='onchange', | |||
ondelete='restrict' | |||
) | |||
segment_id=fields.Many2one( | |||
'opendons.segment', | |||
string='Segment', | |||
required=True, | |||
index=True, | |||
track_visibility='onchange', | |||
ondelete='restrict' | |||
) | |||
@ -0,0 +1,64 @@ | |||
<odoo> | |||
<data> | |||
<record model="ir.ui.view" id="opendons.payment_batch"> | |||
<field name="name">opendons_payment_batch list</field> | |||
<field name="model">opendons_payment_batch</field> | |||
<field name="arch" type="xml"> | |||
<tree> | |||
<field name="create_date"/> | |||
<field name="create_uid"/> | |||
<field name="payment_mode"/> | |||
</tree> | |||
</field> | |||
</record> | |||
<record model="ir.ui.view" id="opendons.payment_batch_form"> | |||
<field name="name">opendons_payment_batch Form</field> | |||
<field name="model">opendons_payment_batch</field> | |||
<field name="arch" type="xml"> | |||
<form string="payment_batch_form"> | |||
<header> | |||
</header> | |||
<sheet> | |||
<group name="payment_batch"> | |||
<field name="create_date"/> | |||
<field name="create_uid"/> | |||
<field name="payment_mode"/> | |||
<field name="operation_id"/> | |||
<field name="segment_id"/> | |||
<field name="payment_input"/> | |||
</group> | |||
<button name="action_ajouter_payment" type="object" string="Ajouter" class="oe_highlight"/> | |||
</sheet> | |||
</form> | |||
</field> | |||
</record> | |||
<record model="ir.actions.act_window" id="payment_batch_action"> | |||
<field name="name">Payment batch</field> | |||
<field name="res_model">opendons_payment_batch</field> | |||
<field name="view_mode">tree,form</field> | |||
</record> | |||
<menuitem id="payment_batch_top_menu" sequence="16" | |||
name="Payments batchs"/> | |||
<menuitem id="payment_batch_title_menu" parent="payment_batch_top_menu" | |||
sequence="15" name="Payments batchs"/> | |||
<menuitem id="payment_batch_menu" action="payment_batch_action" | |||
parent="payment_batch_title_menu" sequence="10"/> | |||
</data> | |||
</odoo> |
@ -0,0 +1,63 @@ | |||
<odoo> | |||
<data> | |||
<record model="ir.ui.view" id="opendons.returnmail"> | |||
<field name="name">opendons_returnmail list</field> | |||
<field name="model">opendons_returnmail</field> | |||
<field name="arch" type="xml"> | |||
<tree> | |||
<field name="create_date"/> | |||
<field name="create_uid"/> | |||
<field name="return_type"/> | |||
<field name="return_count"/> | |||
</tree> | |||
</field> | |||
</record> | |||
<record model="ir.ui.view" id="opendons.returnmail_form" > | |||
<field name="name">opendons_returnmail Form</field> | |||
<field name="model">opendons_returnmail</field> | |||
<field name="arch" type="xml"> | |||
<form string="returnmail_form"> | |||
<header> | |||
</header> | |||
<sheet> | |||
<group name="returnmail"> | |||
<field name="create_date"/> | |||
<field name="create_uid"/> | |||
<field name="return_type"/> | |||
<field name="return_count"/> | |||
<field name="return_input"/> | |||
</group> | |||
<button name="action_ajouter_npai" type="object" string="Ajouter" class="oe_highlight"/> | |||
<field name="npai_lines"> | |||
<tree editable="bottom"> | |||
<field name="returnmail_id" invisible="1"/> | |||
<field name="partner_id"/> | |||
<field name="operation_id"/> | |||
<field name="segment_id"/> | |||
</tree> | |||
</field> | |||
</sheet> | |||
</form> | |||
</field> | |||
</record> | |||
<record model="ir.actions.act_window" id="returnmail_action"> | |||
<field name="name">return mail</field> | |||
<field name="res_model">opendons_returnmail</field> | |||
<field name="view_mode">tree,form</field> | |||
</record> | |||
<menuitem id="returnmail_menu" action="returnmail_action" | |||
parent="returnmail_title_menu" sequence="10"/> | |||
</data> | |||
</odoo> |