Skip to content

Commit

Permalink
fix pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
brendaf committed Apr 22, 2024
1 parent 17159d0 commit 30d046a
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 32 deletions.
2 changes: 1 addition & 1 deletion donation_certificate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"views/donation_send_cert_button.xml",
"views/py3o_certificate_report.xml",
"wizard/tax_receipt_annual_create_view.xml",
"wizard/tax_receipt_print_view.xml"
"wizard/tax_receipt_print_view.xml",
],
}
2 changes: 1 addition & 1 deletion donation_certificate/models/donation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def _get_mail_template(self):
"""
:return: the correct mail template based on the current move type
"""
return 'donation_certificate.email_template_donation_certificate'
return "donation_certificate.email_template_donation_certificate"
8 changes: 6 additions & 2 deletions donation_certificate/models/donation_tax_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ def _compute_amounts(self):
if line.product_id.detailed_type == "donation":
amount_donation = amount_donation + line.amount
elif line.product_id.detailed_type == "donation_in_kind_consu":
amount_donation_in_kind_consu = amount_donation_in_kind_consu + line.amount
amount_donation_in_kind_consu = (
amount_donation_in_kind_consu + line.amount
)
else:
amount_donation_in_kind_service = amount_donation_in_kind_service + line.amount
amount_donation_in_kind_service = (
amount_donation_in_kind_service + line.amount
)
rec.amount_donation = round(amount_donation, 2)
rec.amount_donation_in_kind_consu = round(amount_donation_in_kind_consu, 2)
rec.amount_donation_in_kind_service = round(
Expand Down
11 changes: 8 additions & 3 deletions donation_certificate/views/donation_certificate_send_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@
<label for="is_email" />
</b>
</div>
<div class="text-start d-inline-block mr8" attrs="{'invisible': ['|', ('is_email','=', False), ('donation_without_email', '=', False)]}">
<field name="donation_without_email" class="mr4"/>
<div
class="text-start d-inline-block mr8"
attrs="{'invisible': ['|', ('is_email','=', False), ('donation_without_email', '=', False)]}"
>
<field name="donation_without_email" class="mr4" />
</div>
<div name="mail_form" attrs="{'invisible': [('is_email', '=', False)]}">
<div attrs="{'invisible': [('composition_mode', '=', 'mass_mail')]}">
<div
attrs="{'invisible': [('composition_mode', '=', 'mass_mail')]}"
>
<group>
<label
for="partner_ids"
Expand Down
6 changes: 4 additions & 2 deletions donation_certificate/views/py3o_certificate_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@
<field name="binding_model_id" />
</record>

<record id="py3o_template_configuration_form_view_inherit_report_py3o" model="ir.ui.view">
<field name="name">py3o.template.view.form.inherit</field>
<record
id="py3o_template_configuration_form_view_inherit_report_py3o"
model="ir.ui.view"
> <field name="name">py3o.template.view.form.inherit</field>
<field name="model">py3o.template</field>
<field
name="inherit_id"
Expand Down
42 changes: 26 additions & 16 deletions donation_certificate/wizard/donation_certificate_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ def default_get(self, fields):
if not tax_receipts:
raise UserError(_("You can only send invoices."))

composer = self.env["mail.compose.message"].create({
"composition_mode": "comment" if len(res_ids) == 1 else "mass_mail",
})
res.update({
"tax_receipt_ids": res_ids,
"composer_id": composer.id,
})
composer = self.env["mail.compose.message"].create(
{
"composition_mode": "comment" if len(res_ids) == 1 else "mass_mail",
}
)
res.update(
{
"tax_receipt_ids": res_ids,
"composer_id": composer.id,
}
)
return res

@api.onchange("tax_receipt_ids")
Expand All @@ -74,7 +78,7 @@ def get_ref_report_name(self, wizard_template_id_lang):
"es_ES": "donation_certificate.donation_certificate_report_py3o_ES",
"ca_ES": "donation_certificate.donation_certificate_report_py3o_CAT",
"fr_FR": "donation_certificate.donation_certificate_report_py3o_FR",
"en_GB": "donation_certificate.donation_certificate_report_py3o_EN"
"en_GB": "donation_certificate.donation_certificate_report_py3o_EN",
}
report_name = report_names.get(
lang, "donation_certificate.donation_certificate_report_py3o_EN"
Expand Down Expand Up @@ -110,7 +114,7 @@ def onchange_is_email(self):
res_ids = self._context.get("active_ids")
data = {
"composition_mode": "comment" if len(res_ids) == 1 else "mass_mail",
"template_id": self.template_id.id
"template_id": self.template_id.id,
}
if not self.composer_id:
self.composer_id = self.env["mail.compose.message"].create(data)
Expand All @@ -123,10 +127,12 @@ def onchange_is_email(self):
def _compute_donation_without_email(self):
for wizard in self:
if wizard.is_email and len(wizard.tax_receipt_ids) > 1:
tax_receipts = self.env["donation.tax.receipt"].search([
("id", "in", self.env.context.get("active_ids")),
("partner_id.email", "=", False)
])
tax_receipts = self.env["donation.tax.receipt"].search(
[
("id", "in", self.env.context.get("active_ids")),
("partner_id.email", "=", False),
]
)
if tax_receipts:
wizard.donation_without_email = "%s\n%s" % (
_(
Expand Down Expand Up @@ -175,8 +181,12 @@ def send_and_print_action(self):
active_records = self.env[self.model].browse(active_ids)
langs = set(active_records.mapped("partner_id.lang"))
for lang in langs:
active_ids_lang = active_records.filtered(lambda r: r.partner_id.lang == lang).ids
self_lang = self.with_context(active_ids=active_ids_lang, lang=get_lang(self.env, lang).code)
active_ids_lang = active_records.filtered(
lambda r: r.partner_id.lang == lang
).ids
self_lang = self.with_context(
active_ids=active_ids_lang, lang=get_lang(self.env, lang).code
)
self_lang.onchange_template_id()
self_lang._send_email()
else:
Expand All @@ -196,7 +206,7 @@ def save_as_template(self):
return action

def _print_document(self):
""" to override for each type of models that will use this composer."""
"""to override for each type of models that will use this composer."""
self.ensure_one()
action = self.tax_receipt_ids.action_print_tax_receipt()
action.update({"close_on_report_download": True})
Expand Down
6 changes: 4 additions & 2 deletions donation_certificate/wizard/tax_receipt_print_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
<field name="model">donation.tax.receipt.print</field>
<field name="inherit_id" ref="donation_base.donation_tax_receipt_print_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='main']/field[@name='receipt_ids']" position="attributes">
<attribute name="invisible">1</attribute>
<xpath
expr="//group[@name='main']/field[@name='receipt_ids']"
position="attributes"
> <attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group[@name='main']" position="inside">
<field name="lang" widget="label_selection" />
Expand Down
2 changes: 1 addition & 1 deletion donation_letter/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"summary": "Donation Thanks Letter",
"version": "16.0.1.0.0",
"category": "Custom",
"website": "https://www.qubiq.es",
"website": "https://github.com/OCA/donation",
"author": "Brenda Fernández Alayo",
"license": "AGPL-3",
"installable": True,
Expand Down
9 changes: 6 additions & 3 deletions donation_letter/views/donation_letter_send_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<record id="donation_letter_send_wizard_form" model="ir.ui.view">
<field name="name">donation.letter.send.form</field>
<field name="model">donation.letter.send</field>
<field name="groups_id" eval="[(4,ref('base.group_user'))]"/>
<field name="groups_id" eval="[(4,ref('base.group_user'))]" />
<field name="arch" type="xml">
<form string="Thanks Letter send &amp; Print">
<!-- truly invisible fields for control and options -->
Expand All @@ -30,8 +30,11 @@
<label for="is_email" />
</b>
</div>
<div class="text-start d-inline-block mr8" attrs="{'invisible': ['|', ('is_email','=', False), ('donation_without_email', '=', False)]}">
<field name="donation_without_email" class="mr4"/>
<div
class="text-start d-inline-block mr8"
attrs="{'invisible': ['|', ('is_email','=', False), ('donation_without_email', '=', False)]}"
>
<field name="donation_without_email" class="mr4" />
</div>
<div name="mail_form" attrs="{'invisible': [('is_email', '=', False)]}">
<div
Expand Down
2 changes: 1 addition & 1 deletion donation_summary/data/mail_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/>
<br
/> We want to express our sincere gratitude for your suport and generosity towards our mission. <br
/> We are pleased to inform you that attached you will find a detailed summary of all
/> We are pleased to inform you that attached you will find a detailed summary of all
the donations you have made from <t
t-out="object.start_date or ''"
>01/01/2023</t>
Expand Down

0 comments on commit 30d046a

Please sign in to comment.