Skip to content

Commit

Permalink
[FIX] account_invoice_view_payment: Validate & View payments was
Browse files Browse the repository at this point in the history
creating as many payments as invoices and it was not reconciling
the invoices.
The solution is to remove the Validate & View Payments button because
the standard button "Create Payments" already returns the action
to see the payments involved
  • Loading branch information
AaronHForgeFlow committed Apr 19, 2024
1 parent f3939eb commit 3a22a02
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 43 deletions.
25 changes: 0 additions & 25 deletions account_invoice_view_payment/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,3 @@ def post_and_open_payment(self):
"type": "ir.actions.act_window",
}
return res


class AccountPaymentRegister(models.TransientModel):
_inherit = "account.payment.register"

def create_payment_and_open(self):
account_move_model = self.env["account.move"]
payment_model = self.env["account.payment"]
payments = payment_model
for _payment_vals in account_move_model.search(
[("id", "in", self.env.context.get("active_ids", False))]
):
vals = self._create_payment_vals_from_wizard()
payments += payment_model.create(vals)
payments.action_post()
res = {
"domain": [("id", "in", payments.ids), ("state", "=", "posted")],
"name": _("Payments"),
"view_mode": "tree,form",
"res_model": "account.payment",
"view_id": False,
"context": False,
"type": "ir.actions.act_window",
}
return res
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_view_account_payment_register_form(self):
}
)

res = wiz.create_payment_and_open()
res = wiz.action_create_payments()

expect = {"type": "ir.actions.act_window", "res_model": "account.payment"}
self.assertDictEqual(
Expand Down
17 changes: 0 additions & 17 deletions account_invoice_view_payment/views/account_payment_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,4 @@
</field>
</record>

<record id="view_account_payment_form_multi" model="ir.ui.view">
<field name="name">account.payment.form.multi</field>
<field name="model">account.payment.register</field>
<field name="inherit_id" ref="account.view_account_payment_register_form" />
<field name="arch" type="xml">
<button name="action_create_payments" position="after">
<button
name="create_payment_and_open"
string="Validate &amp; View Payment"
type="object"
class="oe_highlight"
groups="account.group_account_invoice"
/>
</button>
</field>
</record>

</odoo>

0 comments on commit 3a22a02

Please sign in to comment.