Skip to content

Commit

Permalink
[MIG] account_invoice_merge: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
acsonefho committed Dec 31, 2024
1 parent 48883df commit d583cc3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions account_invoice_merge/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numbers

from odoo import api, models
from odoo import Command, api, models
from odoo.tools import float_is_zero


Expand Down Expand Up @@ -51,16 +51,16 @@ def _get_invoice_line_key_cols(self):
@api.model
def _get_first_invoice_fields(self, invoice):
return {
"invoice_origin": "%s" % (invoice.invoice_origin or "",),
"invoice_origin": f"{invoice.invoice_origin or ''}",
"partner_id": invoice.partner_id.id,
"journal_id": invoice.journal_id.id,
"user_id": invoice.user_id.id,
"currency_id": invoice.currency_id.id,
"company_id": invoice.company_id.id,
"move_type": invoice.move_type,
"state": "draft",
"payment_reference": "%s" % (invoice.payment_reference or "",),
"name": "%s" % (invoice.name or "",),
"payment_reference": "{invoice.payment_reference or ''}",
"name": f"{invoice.name or ''}",
"fiscal_position_id": invoice.fiscal_position_id.id,
"invoice_payment_term_id": invoice.invoice_payment_term_id.id,
"invoice_line_ids": {},
Expand Down Expand Up @@ -194,7 +194,7 @@ def do_merge(
qty_prec = self.env["decimal.precision"].precision_get(
"Product Unit of Measure"
)
for invoice_key, (invoice_data, old_ids) in new_invoices.items():
for _invoice_key, (invoice_data, old_ids) in new_invoices.items():
# skip merges with only one invoice
if len(old_ids) < 2:
allinvoices += old_ids or []
Expand Down Expand Up @@ -233,7 +233,7 @@ def order_line_update_invoice_lines(todos, all_old_inv_line):
lambda x: x.parent_state != "cancel" or x.id not in all_old_inv_line
)
if invoice_line:
line.write({"invoice_lines": [(6, 0, invoice_line.ids)]})
line.write({"invoice_lines": [Command.set(invoice_line.ids)]})

@api.model
def merge_callback(self, invoices_info, old_invoices):
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_merge/wizard/invoice_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def default_get(self, default_fields):
there are chances that we typed the account code
instead of its name. In that case, switch both fields values.
"""
res = super(InvoiceMerge, self).default_get(default_fields)
res = super().default_get(default_fields)
if "error_message" in default_fields:
msg = self._check_error()
res["error_message"] = msg
Expand Down
6 changes: 3 additions & 3 deletions account_invoice_merge/wizard/invoice_merge_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="model">invoice.merge</field>
<field name="arch" type="xml">
<form string="Merge Partner Invoice">
<group attrs="{'invisible': [('error_message', '!=', False)]}">
<group invisible="error_message">
<group>
<separator
string="Are you sure you want to merge these invoices?"
Expand All @@ -28,7 +28,7 @@
</group>
</group>
</group>
<group attrs="{'invisible': [('error_message', '=', False)]}">
<group invisible="not error_message">
<field
name="error_message"
readonly="1"
Expand All @@ -45,7 +45,7 @@
string="Merge Invoices"
type="object"
class="oe_highlight"
attrs="{'invisible': [('error_message', '!=', False)]}"
invisible="not error_message"
/>
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
Expand Down

0 comments on commit d583cc3

Please sign in to comment.