[MIG] account_payment_order_notification: Migration to 17.0

This commit is contained in:
Antoni Marroig Campomar
2024-08-19 08:14:31 +02:00
parent f386f70447
commit fc973300c8
11 changed files with 24 additions and 22 deletions

View File

@@ -102,6 +102,10 @@ Contributors
- Víctor Martínez
- Pedro M. Baeza
- `APSL-Nagarro <https://apsl.tech>`__:
- Antoni Marroig <amarroig@apsl.net>
Maintainers
-----------

View File

@@ -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)",

View File

@@ -36,7 +36,7 @@ class AccountPaymentOrder(models.Model):
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") % (

View File

@@ -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")

View File

@@ -1,3 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
- [APSL-Nagarro](https://apsl.tech):
- Antoni Marroig \<<amarroig@apsl.net>\>

View File

@@ -451,6 +451,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<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">

View File

@@ -24,7 +24,7 @@ class TestAccountPaymentOrderNotification(TransactionCase):
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(
@@ -40,7 +40,7 @@ class TestAccountPaymentOrderNotification(TransactionCase):
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)

View File

@@ -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>

View File

@@ -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"
@@ -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>

View File

@@ -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",
@@ -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")

View File

@@ -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>