Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Copyright 2021 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import account_move
from . import account_move_line
from . import res_company
from . import res_config_settings
from . import sale_order_line

View File

@@ -0,0 +1,15 @@
# Copyright 2021 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class AccountMove(models.Model):
_inherit = "account.move"
def copy(self, default=None):
# Set the sale_qty_to_reinvoice based on the boolean from the
# reversal wizard
res = super().copy(default=default)
sale_qty_to_reinvoice = self.env.context.get("sale_qty_to_reinvoice", False)
res.line_ids.write({"sale_qty_to_reinvoice": sale_qty_to_reinvoice})
return res

View File

@@ -0,0 +1,13 @@
# 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
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
sale_qty_to_reinvoice = fields.Boolean(
default=lambda self: self.env.company.reinvoice_credit_note_default,
help="Leave it marked if you will reinvoice the same sale order line",
copy=False,
)

View File

@@ -0,0 +1,9 @@
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
reinvoice_credit_note_default = fields.Boolean(
"Reinvoice credit notes by default", default=True
)

View File

@@ -0,0 +1,10 @@
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
reinvoice_credit_note_default = fields.Boolean(
related="company_id.reinvoice_credit_note_default",
readonly=False,
)

View File

@@ -0,0 +1,58 @@
# Copyright 2021 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
qty_refunded_not_invoiceable = fields.Float(
compute="_compute_qty_refunded_not_invoiceable",
string="Quantity Refunded Not Invoiceable",
digits="Product Unit of Measure",
)
@api.depends(
"invoice_lines.move_id.state",
"invoice_lines.quantity",
"untaxed_amount_to_invoice",
"invoice_lines.sale_qty_to_reinvoice",
)
def _compute_qty_invoiced(self):
res = super()._compute_qty_invoiced()
# Revert effect of refunds in invoice_qty when `sale_qty_to_reinvoice`
# is not set.
for line in self:
qty_invoiced = line.qty_invoiced
for invoice_line in line.invoice_lines:
if (
invoice_line.move_id.state != "cancel"
and invoice_line.move_id.move_type == "out_refund"
and not invoice_line.sale_qty_to_reinvoice
):
qty_invoiced += invoice_line.product_uom_id._compute_quantity(
invoice_line.quantity, line.product_uom
)
if line.qty_invoiced != qty_invoiced:
line.qty_invoiced = qty_invoiced
return res
@api.depends(
"product_uom_qty",
"invoice_lines.move_id.state",
"invoice_lines.quantity",
"invoice_lines.sale_qty_to_reinvoice",
)
def _compute_qty_refunded_not_invoiceable(self):
for line in self:
qty_ref_not_inv = 0.0
for invoice_line in line.invoice_lines:
if (
invoice_line.move_id.state != "cancel"
and invoice_line.move_id.move_type == "out_refund"
and not invoice_line.sale_qty_to_reinvoice
):
qty_ref_not_inv += invoice_line.product_uom_id._compute_quantity(
invoice_line.quantity, line.product_uom
)
line.qty_refunded_not_invoiceable = qty_ref_not_inv