Skip to content

Commit

Permalink
[MIG] account_payment_order_notification: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
peluko00 committed Aug 19, 2024
1 parent 058a361 commit 3524015
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 22 deletions.
4 changes: 4 additions & 0 deletions account_payment_order_notification/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ Contributors
- Víctor Martínez
- Pedro M. Baeza

- `APSL-Nagarro <https://apsl.tech>`__:

- Antoni Marroig <[email protected]>

Maintainers
-----------

Expand Down
2 changes: 1 addition & 1 deletion account_payment_order_notification/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Account Payment Order Notification",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"category": "Banking addons",
"website": "https://github.com/OCA/bank-payment",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def action_view_notifications(self):

Check warning on line 36 in account_payment_order_notification/models/account_payment_order.py

View check run for this annotation

Codecov / codecov/patch

account_payment_order_notification/models/account_payment_order.py#L33-L36

Added lines #L33 - L36 were not covered by tests
def _action_send_mail_notifications(self, template):
for notification in self.notification_ids:
notification.message_post_with_template(template.id)
notification.message_post_with_source(template)

def _action_create_note_from_notifications(self):
body = _("Email has been sent to the following partners: %s") % (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ class AccountPaymentOrderNotification(models.Model):
order_id = fields.Many2one(
comodel_name="account.payment.order",
required=True,
readonly=True,
)
company_id = fields.Many2one(related="order_id.company_id")
partner_id = fields.Many2one(
comodel_name="res.partner",
required=True,
readonly=True,
)
payment_line_ids = fields.Many2many(
comodel_name="account.payment.line", readonly=True
)
payment_line_ids = fields.Many2many(comodel_name="account.payment.line")
display_name = fields.Char(compute="_compute_display_name")

@api.depends("order_id", "partner_id")
Expand Down
2 changes: 2 additions & 0 deletions account_payment_order_notification/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
- [APSL-Nagarro](https://apsl.tech):
- Antoni Marroig \<<[email protected]>\>
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Pedro M. Baeza</li>
</ul>
</li>
<li><a class="reference external" href="https://apsl.tech">APSL-Nagarro</a>:<ul>
<li>Antoni Marroig &lt;<a class="reference external" href="mailto:amarroig&#64;apsl.net">amarroig&#64;apsl.net</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setUpClass(cls):
cls.product = cls.env["product.product"].create(
{"name": "Test product", "list_price": 100}
)
cls.mt_comment = cls.env.ref("mail.mt_comment")
cls.mt_note = cls.env.ref("mail.mt_note")

def _create_invoice(self, partner, move_type="out_invoice"):
invoice_form = Form(
Expand All @@ -40,7 +40,7 @@ def _test_notification_from_partner(self, po, partner, total):
notification = po.notification_ids.filtered(lambda x: x.partner_id == partner)
self.assertEqual(len(notification.payment_line_ids), total)
self.assertIn(partner, notification.mapped("message_follower_ids.partner_id"))
self.assertIn(self.mt_comment, notification.mapped("message_ids.subtype_id"))
self.assertIn(self.mt_note, notification.mapped("message_ids.subtype_id"))

def test_wizard_account_payment_order_notification(self):
self._create_invoice(self.partner_a_child)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
<sheet>
<div class="oe_title">
<h1>
<field name="order_id" />
<field name="order_id" readonly="1" />
</h1>
</div>
<group name="head" col="2">
<group name="head-left">
<field name="partner_id" />
<field name="partner_id" readonly="1" />
<field name="create_date" />
</group>
</group>
<notebook>
<page name="payment-lines" string="Transactions">
<field name="payment_line_ids" />
<field name="payment_line_ids" readonly="1" />
</page>
</notebook>
</sheet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
type="object"
class="oe_stat_button"
icon="fa-envelope"
attrs="{'invisible': [('notification_count', '=', 0)]}"
invisible="notification_count == 0"
>
<field
name="notification_count"
Expand All @@ -28,7 +28,7 @@
type="action"
name="%(wizard_account_payment_order_notification_action)d"
string="Send mails"
attrs="{'invisible': ['|', ('state', 'not in', ('uploaded','done')), ('notification_count', '>', 0)]}"
invisible="state not in ['uploaded','done'] or notification_count > 0"
/>
</button>
</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class WizardAccountPaymentOrderNotification(models.TransientModel):
order_id = fields.Many2one(
comodel_name="account.payment.order",
required=True,
readonly=True,
)
mail_template_id = fields.Many2one(
comodel_name="mail.template",
Expand Down Expand Up @@ -88,7 +87,7 @@ class WizardAccountPaymentOrderNotificationLine(models.TransientModel):
index=True,
)
partner_id = fields.Many2one(
comodel_name="res.partner", required=True, string="Partner", readonly=True
comodel_name="res.partner", required=True, string="Partner"
)
email = fields.Char()
to_send = fields.Boolean(string="To send")
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
<form>
<group name="main_group">
<group name="left_group">
<field name="order_id" />
<field name="order_id" readonly="1" />
<field name="mail_template_id" />
</group>
</group>
<group name="secondary_group" col="4">
<field name="line_ids" nolabel="1" colspan="4">
<tree editable="bottom" create="false" delete="false">
<field name="partner_id" force_save="1" />
<field name="partner_id" force_save="1" readonly="1" />
<field name="email" />
<field
name="to_send"
attrs="{'readonly':[('email','=',False)]}"
/>
<field name="to_send" readonly="not email" />
</tree>
</field>
</group>
Expand Down

0 comments on commit 3524015

Please sign in to comment.