Browse Source

lots de paiement et template RF

master
root 3 years ago
parent
commit
17a9608132
11 changed files with 314 additions and 9 deletions
  1. +5
    -2
      __manifest__.py
  2. +2
    -0
      models/__init__.py
  3. +26
    -0
      models/donation_tax_receipt.py
  4. +1
    -1
      models/payment_batch.py
  5. +26
    -0
      models/template_rf.py
  6. +22
    -0
      report/report.xml
  7. +151
    -2
      report/report_donationtax.xml
  8. +3
    -0
      security/ir.model.access.csv
  9. +25
    -0
      views/donation_tax_receipt.xml
  10. +10
    -4
      views/payment_batch.xml
  11. +43
    -0
      views/template_rf.xml

+ 5
- 2
__manifest__.py View File

@ -40,9 +40,12 @@
'views/payment_batch.xml',
'views/website_sale.xml',
'views/aggregate.xml',
'views/duplicate.xml',
'views/duplicate.xml',
'views/template_rf.xml',
'wizard/operation_duplicate_wizard.xml',
'report/report_donationtax.xml'
'report/report_donationtax.xml',
'report/report.xml',
'views/donation_tax_receipt.xml'
#'views/website_donation.xml'


+ 2
- 0
models/__init__.py View File

@ -14,3 +14,5 @@ from . import sale_order
from . import product
from . import aggregate
from . import duplicate
from . import template_rf
from . import donation_tax_receipt

+ 26
- 0
models/donation_tax_receipt.py View File

@ -0,0 +1,26 @@
from odoo import api, fields, models
class DonationTaxReceipt(models.Model):
_inherit = "donation.tax.receipt"
template_rf_id=fields.Many2one('opendons.template_rf', 'RF template')
html_content=fields.Html('html content',compute='_html_content')
html_content_print=fields.Html('html content print')
def action_print_rf(self):
self.ensure_one()
html_content_print=self.html_content
html_content_print=html_content_print.replace('{{partner_id.name}}',self.partner_id.name)
html_content_print=html_content_print.replace('{{partner_id.firstname}}',self.partner_id.firstname)
self.html_content_print=html_content_print
#self.env['donation.tax_receipt'].write(vals)
#res=super(donation_tax_receipt, self).write(vals)
return self.env.ref("opendons.report_donation_tax_receipt").report_action(self)
#return True
def _html_content(self):
self.html_content=self.template_rf_id.html_content

+ 1
- 1
models/payment_batch.py View File

@ -25,7 +25,7 @@ class opendons_payment_batch(models.Model):
product_id = fields.Many2one(
'product.product',
'Product',
required=True,
domain=[('donation', '=', True)],
ondelete='restrict'


+ 26
- 0
models/template_rf.py View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import UserError, ValidationError
from psycopg2 import sql, DatabaseError
from odoo.tools.safe_eval import safe_eval, datetime
from werkzeug import utils
class opendons_template_rf(models.Model):
_name = 'opendons.template_rf'
_description = 'manage rf html template'
name=fields.Char('name')
description=fields.Text('description')
active=fields.Boolean('active')
html_content=fields.Html('Html content')
def action_update_receipts(self):
rf=self.env['donation.tax.receipt'].search([('template_rf_id','=',int(self.id))])
for r in rf:
r.html_content=self.html_content

+ 22
- 0
report/report.xml View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2014-2021 Barroux Abbey (www.barroux.org)
Copyright 2014-2021 Akretion France (www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="report_donation_tax_receipt" model="ir.actions.report">
<field name="name">Donation Tax Receipt</field>
<field name="model">donation.tax.receipt</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">opendons.report_donationtaxreceipt</field>
<field name="report_file">opendons.report_donationtaxreceipt</field>
<field
name="print_report_name"
>'Fiscal_receipt-'+(object.number or '').replace('/','')+'.pdf'</field>
<field name="binding_model_id" ref="model_donation_tax_receipt" />
<field name="attachment_use" eval="True" />
<field name="binding_type">report</field>
</record>
</odoo>

+ 151
- 2
report/report_donationtax.xml View File

@ -2,7 +2,29 @@
<odoo>
<template id="opendons_template_donation_tax_receipt" inherit_id="donation_base.report_donationtaxreceipt_document">
<template id="opendons.report_donationtaxreceipt_document">
<t t-foreach="docs" t-as="o">
<t t-call="web.internal_layout">
<div t-field="o.html_content_print"/>
</t>
</t>
</template>
<template id="report_donationtaxreceipt">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t
t-call="opendons.report_donationtaxreceipt_document"
t-lang="doc.partner_id.lang"
/>
</t>
</t>
</template>
<!-- <template id="opendons_template_donation_tax_receipt_old" inherit_id="donation_base.report_donationtaxreceipt_document">
<xpath expr="//div[@class='page']" position="replace">
<table border="1" cellspacing="0">
@ -74,6 +96,133 @@
</xpath>
</template>
</template> -->
<template id="opendons_template_donation_tax_receipt" inherit_id="donation_base.report_donationtaxreceipt_document">
<xpath expr="//div[@class='page']" position="replace">
<body class="o_in_iframe o_readonly">
<div id="iframe_target"><div class="o_layout o_default_theme" style="padding:0px 3% 0px 3%;color:rgb(121, 121, 121);font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;font-size:14px;background-color:rgb(245, 245, 245);min-height:100%;width:94%;box-sizing:content-box;overflow-y:initial;overflow-x:initial;"><table class="o_mail_wrapper" style="width:100%;border-collapse:separate;"><tbody><tr><td class="o_mail_no_resize o_not_editable" contenteditable="false" style="text-align:left;"> </td><td class="o_mail_no_options o_mail_wrapper_td oe_structure" style="border-style:solid;background-color:rgb(255, 255, 255);border-left-color:rgb(240, 240, 240);border-bottom-color:rgb(240, 240, 240);border-right-color:rgb(240, 240, 240);border-top-color:rgb(240, 240, 240);border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-width:1px;text-align:left;width:600px;"><div class="o_mail_block_header_text_social" data-snippet="s_mail_block_header_text_social" data-name="Left Text">
<div class="o_mail_snippet_general" style="margin:0px auto 0px auto;max-width:600px;width:100%;">
<table align="center" cellspacing="0" cellpadding="0" border="0" class="o_mail_table_styles" style="width:100%;border-collapse:separate;">
<tbody><tr>
<td width="30%" class="text-right o_mail_no_resize" style="vertical-align:middle;text-align:right;">
<div class="o_mail_header_social" style="margin:0 20px 0 0;">
</div>
</td>
<td width="30%" class="text-right o_mail_no_resize" style="vertical-align:middle;text-align:right;">
<div class="o_mail_header_social" style="margin:0 20px 0 0;">
</div>
</td>
</tr>
</tbody></table>
</div>
</div><div class="o_mail_block_header_logo mb16" data-snippet="s_mail_block_header_logo" style="margin:0 0 16px 0;">
<div class="o_mail_snippet_general" style="margin:0px auto 0px auto;max-width:600px;width:100%;">
<table align="center" cellspacing="0" cellpadding="0" border="0" class="o_mail_table_styles o_mail_h_padding" style="padding:0 20px 0 20px;width:100%;border-collapse:separate;">
<tbody><tr>
<td width="20%" style="text-align:left;vertical-align:middle;width: 0px;"></td>
<td valign="center" width="60%" class="o_mail_logo_container text-center o_mail_v_padding" style="padding:20px 0 20px 0;vertical-align:middle;text-align:center;width: 152.516px;">
<a style="font-weight:bold;background-color:transparent;color:rgb(100, 89, 116);text-decoration:none;" href="#">
<img border="0" src="/mass_mailing/static/src/img/theme_default/s_default_image_logo.png" style="border-style:none;width:auto;vertical-align:middle;height:auto;max-width:400px;" loading="lazy" class="" data-original-title="" title="" aria-describedby="tooltip601215" width="118" height="53"/>
</a>
</td>
<td width="20%" style="vertical-align:middle;text-align: right; width: 403.953px;" class=""><font style="font-size: 12px;">Paris, le 25 mars 2022</font></td>
</tr>
</tbody></table>
</div>
</div><div class="o_mail_block_title_sub" data-snippet="s_mail_block_title_sub" data-name="Title - Subtitle">
<div class="o_mail_snippet_general" style="margin:0px auto 0px auto;max-width:600px;width:100%;">
<table align="center" cellspacing="0" cellpadding="0" class="o_mail_table_styles" style="width:100%;border-collapse:separate;">
<tbody>
<tr>
<td style="text-align:left;vertical-align:top;"><br/></td><td class="o_mail_h_padding o_mail_v_padding o_mail_no_colorpicker pt0 pb0" style="padding:0px 20px 0px 20px;text-align:left;vertical-align:top;">
<h2 class="o_mail_no_margin" style="margin:0px;color:rgb(70, 70, 70);font-size:2rem;line-height:1.2;font-weight:500;font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;">Regardez ça !</h2>
<p class="o_mail_no_margin" style="margin:0px;color:rgb(121, 121, 121);font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;font-size:14px;">Des Apps qui vous aident à faire grandir votre business</p>
</td>
</tr>
</tbody>
</table>
</div>
</div><div class="o_mail_block_title_text" data-snippet="s_mail_block_title_text" data-name="Title Content">
<div class="o_mail_snippet_general" style="margin:0px auto 0px auto;max-width:600px;width:100%;">
<table align="center" cellspacing="0" cellpadding="0" border="0" class="o_mail_table_styles" style="width:100%;border-collapse:separate;">
<tbody>
<tr>
<td width="100%" class="o_mail_h_padding o_mail_v_padding o_mail_no_colorpicker" style="padding:20px;text-align:left;vertical-align:top;">
<h2 class="mt0 o_default_snippet_text" style="margin:0px 0 0.5rem 0;color:rgb(70, 70, 70);font-size:2rem;line-height:1.2;font-weight:500;font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;">Merci de vous joindre à nous! </h2>
<p class="o_default_snippet_text" style="margin:0px 0 1rem 0;color:rgb(121, 121, 121);font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;font-size:14px;">Nous en profitons pour vous accueillir dans notre communauté grandissante!<br/></p>
<p class="" style="margin:0px 0 1rem 0;color:rgb(121, 121, 121);font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;font-size:14px;">Votre espace est prêt à fonctionner. Il vous aidera à réduire vos coûts de présence électronique, à attirer de nouveaux clients et à augmenter vos ventes.</p>
<p class="o_default_snippet_text" style="margin:0px 0 1rem 0;color:rgb(121, 121, 121);font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;font-size:14px;">Profitez.</p>
<img src="/mass_mailing/static/src/img/theme_default//demo/signature.png" style="border-style:none;height:auto;max-width:100%;vertical-align:middle;width:125px; margin-top:8px;margin-bottom:-25px;" alt="Signature de démo" loading="lazy" class="" data-original-title="" title="" aria-describedby="tooltip255980" width="125" height="64.1562"/>
<p style="margin:0px 0 1rem 0;color:rgb(121, 121, 121);font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;font-size:14px;">
<small style="font-weight:400;font-size:80%;">
<strong class="" style="font-weight:bolder;">Michael Fletcher</strong><br/>
<small class="o_default_snippet_text" style="font-weight:400;font-size:80%;">Community Manager</small>
</small>
</p>
<div class="o_mail_v_padding text-center" style="padding:20px 0 20px 0;text-align:center;"><br/></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="o_mail_block_footer_social o_mail_footer_social_center" data-snippet="s_mail_block_footer_social" data-name="Footer Center">
<div class="o_mail_snippet_general" style="margin:0px auto 0px auto;max-width:600px;width:100%;">
<table align="center" cellspacing="0" cellpadding="0" class="o_mail_table_styles o_mail_full_width_padding" style="border-style:solid none none none;padding:20px 0 20px 0;border-top-color:rgb(245, 245, 245);border-top-width:2px;width:100%;border-collapse:separate;">
<tbody>
<tr>
<td class="o_mail_footer_social" style="text-align:center;vertical-align:middle;">
</td>
</tr>
<tr>
<td class="o_mail_footer_links o_default_snippet_text" style="padding:10px 0 10px 0;text-align:center;vertical-align:middle;">
<a role="button" href="/unsubscribe_from_list" class="btn btn-link o_default_snippet_text" style="text-decoration:none;border-radius:0.25rem;border-style:solid;padding:0px;cursor:pointer;font-family:&quot;Source Sans Pro&quot;, &quot;Odoo Unicode Support Noto&quot;, sans-serif;transition-property:color, background-color, border-color, box-shadow;transition-delay:0s, 0s, 0s, 0s;transition-timing-function:ease-in-out, ease-in-out, ease-in-out, ease-in-out;transition-duration:0.15s, 0.15s, 0.15s, 0.15s;line-height:1.5;font-size:12px;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;border-top-color:transparent;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-width:1px;user-select:none;vertical-align:middle;text-align:center;font-weight:bold;display:inline-block;background-color:transparent;color:rgb(100, 89, 116);">Se désabonner</a>
| <a role="button" href="/contactus" class="btn btn-link o_default_snippet_text" style="text-decoration:none;border-radius:0.25rem;border-style:solid;padding:0px;cursor:pointer;font-family:&quot;Source Sans Pro&quot;, &quot;Odoo Unicode Support Noto&quot;, sans-serif;transition-property:color, background-color, border-color, box-shadow;transition-delay:0s, 0s, 0s, 0s;transition-timing-function:ease-in-out, ease-in-out, ease-in-out, ease-in-out;transition-duration:0.15s, 0.15s, 0.15s, 0.15s;line-height:1.5;font-size:12px;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;border-top-color:transparent;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-width:1px;user-select:none;vertical-align:middle;text-align:center;font-weight:bold;display:inline-block;background-color:transparent;color:rgb(100, 89, 116);">Contact</a>
</td>
</tr>
<tr>
<td style="text-align:left;vertical-align:middle;">
<p class="o_mail_footer_copy o_default_snippet_text" style="margin:0px 0 1rem 0;text-align:center;font-weight:bold;color:rgb(147, 146, 146);font-family:-apple-system, HelveticaNeue, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, sans-serif;font-size:9px;"><img src="/web_editor/font_to_img/61945/rgb(147,146,146)/9" data-class="fa fa-copyright" class="" style="border-style:none;max-width:100%;width:100%;vertical-align:middle;height: auto; width: auto;" width="0" height="0"/> 2022 All Rights Reserved</p>
</td>
</tr>
</tbody>
</table>
</div>
</div></td></tr></tbody></table></div></div>
</body>
</xpath>
</template>
</odoo>

+ 3
- 0
security/ir.model.access.csv View File

@ -29,3 +29,6 @@ access_opendons_duplicate_rule,opendons_duplicate_rule,model_opendons_duplicate_
access_opendons_duplicate_rule_line,opendons_duplicate_rule_line,model_opendons_duplicate_rule_line,donation.group_donation_manager,1,1,1,1
access_opendons_duplicate_partner,opendons_duplicate_partner,model_opendons_duplicate_partner,donation.group_donation_manager,1,1,1,1
access_opendons_template_rf,opendons_template_rf,model_opendons_template_rf,donation.group_donation_manager,1,1,1,1

+ 25
- 0
views/donation_tax_receipt.xml View File

@ -0,0 +1,25 @@
<odoo>
<data>
</data>
<record id="view_opendons_donation_tax_receipt_form" model="ir.ui.view">
<field name="name">opendons.donation.tax_receipt.form</field>
<field name="model">donation.tax.receipt</field>
<field name="inherit_id" ref="donation_base.donation_tax_receipt_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='company_id']" position="after">
<field name="template_rf_id"/>
<field name="html_content"/>
</xpath>
<xpath expr="//button[@name='action_print']" position="replace">
<button name="action_print_rf" type="object" string="Print"/>
</xpath>
</field>
</record>
</odoo>

+ 10
- 4
views/payment_batch.xml View File

@ -43,7 +43,7 @@
<field name="input_mode"/>
<field name="assignment"/>
<field name="donation_amount" attrs="{'invisible':[('assignment','not in','single')]}"/>
<field name="product_id" attrs="{'invisible':[('assignment','not in','single')]}"/>
<field name="product_id" attrs="{'invisible':[('assignment','not in','single')],'required':[('assignment','=','single')]}"/>
<br></br>
<br></br>
<field name="payment_input" style="background:#7CC4F4;" attrs="{'invisible':[('input_mode','in','manual')]}"/>
@ -54,10 +54,16 @@
<field name="company_id" invisible="1"/>
</group>
<button name="action_add_payment" type="object" string="create donation" class="oe_highlight oe_edit_only"/>
<field name="donation_ids"/>
<button name="action_add_payment" type="object" string="create donation" attrs="{'invisible':['|','|','|',('payment_mode_id','=',False),('input_mode','=',False),('assignment','=',False),('partner_id','=',False)]}" class="oe_highlight oe_edit_only"/>
<field name="donation_ids">
<tree create="0">
<field name="number"/>
<field name="partner_id"/>
<field name="donation_date"/>
<field name="state"/>
</tree>
</field>


+ 43
- 0
views/template_rf.xml View File

@ -0,0 +1,43 @@
<odoo>
<record model="ir.ui.view" id="opendons.template_rf_form" >
<field name="name">opendons_template_rf Form</field>
<field name="model">opendons.template_rf</field>
<field name="arch" type="xml">
<form>
<header>
<!-- <button name="action_update_receipts" type="object" string="Update receipts" class="oe_highlight" confirm="Voulez-vous modifier les RF liés à ce template ?"/> -->
</header>
<sheet>
<group name="main">
<field name="name"/>
<field name="description"/>
<field name="active"/>
<field name="html_content"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="template_rf_action">
<field name="name">Receipts letters Templates </field>
<field name="res_model">opendons.template_rf</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="opendons_template_rf"
action="template_rf_action"
parent="donation.donation_config_menu"
sequence="30"
/>
</odoo>

Loading…
Cancel
Save