Skip to content

Commit

Permalink
[MIG] sale_line_refund_to_invoice_qty: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Iniesta committed May 23, 2023
1 parent 54863ec commit dd1a67f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 13 deletions.
2 changes: 1 addition & 1 deletion sale_line_refund_to_invoice_qty/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Sale Line Refund To Invoice Qty",
"summary": """Allow deciding whether refunded quantity should be considered
as quantity to reinvoice""",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Sales",
"website": "https://github.com/OCA/account-invoicing",
"author": "ForgeFlow, Odoo Community Association (OCA)",
Expand Down
70 changes: 70 additions & 0 deletions sale_line_refund_to_invoice_qty/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_line_refund_to_invoice_qty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model,name:sale_line_refund_to_invoice_qty.model_account_move_reversal
msgid "Account Move Reversal"
msgstr "Reversión de asiento contable"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model,name:sale_line_refund_to_invoice_qty.model_account_move
msgid "Journal Entry"
msgstr "Asiento contable"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model,name:sale_line_refund_to_invoice_qty.model_account_move_line
msgid "Journal Item"
msgstr "Apunte contable"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model.fields,help:sale_line_refund_to_invoice_qty.field_account_move_line__sale_qty_to_reinvoice
msgid "Leave it marked if you will reinvoice the same sale order line"
msgstr "Déjelo marcado si va a volver a facturar la misma línea de pedido de venta"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model.fields,help:sale_line_refund_to_invoice_qty.field_account_move_reversal__sale_qty_to_reinvoice
msgid ""
"Leave it marked if you will reinvoice the same sale order line (standard "
"behaviour)"
msgstr "Déjelo marcado si va a volver a facturar la misma línea de pedido de venta "
"(comportamiento estándar)"

#. module: sale_line_refund_to_invoice_qty
#: model_terms:ir.ui.view,arch_db:sale_line_refund_to_invoice_qty.view_account_move_reversal
msgid ""
"Leave it marked when other customer invoices are expected for the quantities"
" in the credit note."
msgstr "Déjelo marcado cuando se esperen otras facturas de clientes por las "
"cantidades de la factura rectificativa."

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model.fields,field_description:sale_line_refund_to_invoice_qty.field_sale_order_line__qty_refunded_not_invoiceable
msgid "Quantity Refunded Not Invoiceable"
msgstr "Cantidad reembolsada no facturable"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model.fields,field_description:sale_line_refund_to_invoice_qty.field_account_move_line__sale_qty_to_reinvoice
msgid "Sale Qty To Reinvoice"
msgstr "Cantidad de venta a refacturar"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model,name:sale_line_refund_to_invoice_qty.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de pedido de venta"

#. module: sale_line_refund_to_invoice_qty
#: model:ir.model.fields,field_description:sale_line_refund_to_invoice_qty.field_account_move_reversal__sale_qty_to_reinvoice
msgid "This credit note will be reinvoiced"
msgstr "Esta factura rectificativa será refacturada"
16 changes: 7 additions & 9 deletions sale_line_refund_to_invoice_qty/models/account.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# Copyright 2021 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models
from odoo import api, fields, models


class AccountMove(models.Model):
_inherit = "account.move"

def _reverse_move_vals(self, default_values, cancel=True):
@api.returns("self", lambda value: value.id)
def copy(self, default=None):
# Set the sale_qty_to_reinvoice based on the boolean from the
# reversal wizard
move_vals = super(AccountMove, self)._reverse_move_vals(
default_values, cancel=cancel
)
if self.env.context.get("sale_qty_to_reinvoice", False):
for vals in move_vals["line_ids"]:
vals[2].update({"sale_qty_to_reinvoice": True})
return move_vals
res = super().copy(default=default)
if self.env.context.get("sale_qty_to_reinvoice"):
res.line_ids.write({"sale_qty_to_reinvoice": True})
return res


class AccountMoveLine(models.Model):
Expand Down
6 changes: 3 additions & 3 deletions sale_line_refund_to_invoice_qty/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class SaleOrderLine(models.Model):
"qty_invoiced",
"qty_delivered",
"product_uom_qty",
"order_id.state",
"state",
"invoice_lines.move_id.state",
"invoice_lines.quantity",
"invoice_lines.sale_qty_to_reinvoice",
)
def _get_to_invoice_qty(self):
res = super()._get_to_invoice_qty()
def _compute_qty_to_invoice(self):
res = super()._compute_qty_to_invoice()
for line in self:
qty_to_invoice = line.qty_to_invoice
for invoice_line in line.invoice_lines:
Expand Down

0 comments on commit dd1a67f

Please sign in to comment.