chore: import enterprise addons 19.0 bulk snapshot

This commit is contained in:
1b-agent committed 2026-09-16 10:13:08 +00:00
commit ca4af030d3
39951 files changed
+15570005

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
+1
View File
@@ -0,0 +1 @@
{'name': 'Brazilian Accounting EDI for stock', 'version': '1.0', 'description': '\nBrazilian Accounting EDI for stock\n==================================\nAdds delivery-related information to the NF-e.\n', 'category': 'Accounting/Localizations/EDI', 'author': 'Odoo S.A.', 'license': 'LGPL-3', 'depends': ['sale_stock'], 'data': ['views/account_move_views.xml', 'views/stock_package_type_views.xml'], 'auto_install': True}
@@ -0,0 +1,128 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_br_edi_stock
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-30 19:05+0000\n"
"PO-Revision-Date: 2025-12-30 19:05+0000\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: l10n_br_edi_stock
#. odoo-python
#: code:addons/l10n_br_edi_stock/models/account_move.py:0
msgid "%(amount)s of %(total)s"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package_type__l10n_br_brand
msgid "Brand"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_stock_package_type__l10n_br_brand
msgid "Brazil: brand of the packaging."
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_package_ids
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_move__l10n_br_package_ids
msgid ""
"Brazil: packages to include in the NF-e used on the deliveries linked to "
"this sales transaction."
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_plate_number
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_move__l10n_br_plate_number
msgid "Brazil: vehicle plate number of the delivery vehicle."
msgstr ""
#. module: l10n_br_edi_stock
#: model_terms:ir.ui.view,arch_db:l10n_br_edi_stock.view_move_form
msgid "Delivery"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__display_name
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_sale_order__display_name
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package__display_name
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package_type__display_name
msgid "Display Name"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__id
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_sale_order__id
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package__id
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package_type__id
msgid "ID"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_account_move
msgid "Journal Entry"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package__l10n_br_move_id
msgid "L10N Br Move"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_picking_count
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_picking_count
msgid "L10N Br Picking Count"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_stock_package
msgid "Package"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_package_ids
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_package_ids
msgid "Packages"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_plate_number
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_plate_number
msgid "Plate Number"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_related_package_ids
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_related_package_ids
msgid "Related Packages"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_sale_order
msgid "Sales Order"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_stock_package_type
msgid "Stock package type"
msgstr ""
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_stock_package__l10n_br_move_id
msgid ""
"Technical field that assigns this package to an invoice for Brazilian EDI."
msgstr ""
#. module: l10n_br_edi_stock
#. odoo-python
#: code:addons/l10n_br_edi_stock/models/account_move.py:0
msgid "Volume"
msgstr ""
+134
View File
@@ -0,0 +1,134 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_br_edi_stock
#
# Weblate <[email protected]>, 2025, 2026.
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-30 19:05+0000\n"
"PO-Revision-Date: 2026-04-20 07:24+0000\n"
"Last-Translator: Anonymous <[email protected]>\n"
"Language-Team: Portuguese (Brazil) <https://translate.odoo.com/projects/odoo-"
"19-l10n/l10n_br_edi_stock/pt_BR/>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.16.2\n"
#. module: l10n_br_edi_stock
#. odoo-python
#: code:addons/l10n_br_edi_stock/models/account_move.py:0
msgid "%(amount)s of %(total)s"
msgstr "%(amount)s de %(total)s"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package_type__l10n_br_brand
msgid "Brand"
msgstr "Marca"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_stock_package_type__l10n_br_brand
msgid "Brazil: brand of the packaging."
msgstr "Brasil: marca da embalagem."
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_package_ids
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_move__l10n_br_package_ids
msgid ""
"Brazil: packages to include in the NF-e used on the deliveries linked to "
"this sales transaction."
msgstr ""
"Brasil: pacotes a incluir na NF-e usada em entregas vinculadas e essa "
"transação de venda."
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_plate_number
#: model:ir.model.fields,help:l10n_br_edi_stock.field_account_move__l10n_br_plate_number
msgid "Brazil: vehicle plate number of the delivery vehicle."
msgstr "Brasil: número da placa do veículo de entrega."
#. module: l10n_br_edi_stock
#: model_terms:ir.ui.view,arch_db:l10n_br_edi_stock.view_move_form
msgid "Delivery"
msgstr "Entrega"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__display_name
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_sale_order__display_name
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package__display_name
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package_type__display_name
msgid "Display Name"
msgstr "Exibir nome"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__id
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_sale_order__id
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package__id
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package_type__id
msgid "ID"
msgstr "ID"
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_account_move
msgid "Journal Entry"
msgstr "Lançamento no diário"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_stock_package__l10n_br_move_id
msgid "L10N Br Move"
msgstr "Movimentação L10N BR"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_picking_count
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_picking_count
msgid "L10N Br Picking Count"
msgstr "Total de separações L10N Br"
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_stock_package
msgid "Package"
msgstr "Embalagem"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_package_ids
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_package_ids
msgid "Packages"
msgstr "Pacotes"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_plate_number
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_plate_number
msgid "Plate Number"
msgstr "Número da placa"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_bank_statement_line__l10n_br_related_package_ids
#: model:ir.model.fields,field_description:l10n_br_edi_stock.field_account_move__l10n_br_related_package_ids
msgid "Related Packages"
msgstr "Pacotes relacionados"
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venda"
#. module: l10n_br_edi_stock
#: model:ir.model,name:l10n_br_edi_stock.model_stock_package_type
msgid "Stock package type"
msgstr "Tipo de pacote do estoque"
#. module: l10n_br_edi_stock
#: model:ir.model.fields,help:l10n_br_edi_stock.field_stock_package__l10n_br_move_id
msgid ""
"Technical field that assigns this package to an invoice for Brazilian EDI."
msgstr "Campo técnico que atribui este pacote a uma fatura de EDI brasileiro."
#. module: l10n_br_edi_stock
#. odoo-python
#: code:addons/l10n_br_edi_stock/models/account_move.py:0
msgid "Volume"
msgstr "Volume"
+5
View File
@@ -0,0 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_move
from . import sale_order
from . import stock_package_type
from . import stock_package
+90
View File
@@ -0,0 +1,90 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, _, api, Command
from odoo.tools import float_round
class AccountMove(models.Model):
_inherit = "account.move"
l10n_br_plate_number = fields.Char("Plate Number", help="Brazil: vehicle plate number of the delivery vehicle.")
l10n_br_picking_count = fields.Integer(compute="_compute_l10n_br_picking_count")
l10n_br_related_package_ids = fields.Many2many("stock.package", string="Related Packages", compute="_compute_l10n_br_related_package_ids")
l10n_br_package_ids = fields.One2many(
"stock.package",
"l10n_br_move_id",
string="Packages",
domain="[('id', 'in', l10n_br_related_package_ids), ('l10n_br_move_id', '=', False)]",
help="Brazil: packages to include in the NF-e used on the deliveries linked to this sales transaction."
)
@api.depends("line_ids")
def _compute_l10n_br_related_package_ids(self):
"""Consider packages belonging to the last validated pickings. We do this so the invoice can be validated before
products are fully shipped out."""
for invoice in self:
invoice.l10n_br_related_package_ids = self.env["stock.package"]
# Only consider the last validated pickings in each chain.
for picking in self._l10n_br_get_pickings():
if picking.state != "done":
continue
next_transfers = picking._get_next_transfers()
# Include the packages if it's the last in the chain or has any next transfer not done.
if not next_transfers or any(transfer.state != "done" for transfer in next_transfers):
# Only allow packs with content.
invoice.l10n_br_related_package_ids |= picking.move_line_ids.result_package_id.filtered("quant_ids")
@api.depends("line_ids")
def _compute_l10n_br_picking_count(self):
for move in self:
move.l10n_br_picking_count = len(move._l10n_br_get_pickings())
def action_l10n_br_view_pickings(self):
return self.env["sale.order"]._get_action_view_picking(self._l10n_br_get_pickings())
def _l10n_br_get_pickings(self):
return self.line_ids.sale_line_ids.move_ids.picking_id
def _l10n_br_type_specific_header(self, tax_data_header):
"""Override."""
res = super()._l10n_br_type_specific_header(tax_data_header)
if self.l10n_br_is_service_transaction or not self.l10n_br_edi_freight_model:
return res
# The API specifies no precision, but round to avoid e.g. 2.999999... which would look bad on the PDF.
stock_weight_dp = self.env.ref("product.decimal_stock_weight")
uom_kg = self.env.ref("uom.product_uom_kgm")
weight_uom = self.env["product.template"]._get_weight_uom_id_from_ir_config_parameter()
volumes = []
package_type_to_packages = self.l10n_br_package_ids.grouped("package_type_id")
for index, (package_type, packages) in enumerate(package_type_to_packages.items()):
weight_kg = 0
for package in packages:
for quant in package.quant_ids:
product = quant.product_id
weight_kg += weight_uom._compute_quantity(product.weight, uom_kg) * quant.quantity
package_weight_kg = weight_uom._compute_quantity(package_type.base_weight, uom_kg) * len(packages)
volume = {
"volumeNumeration": _("%(amount)s of %(total)s", amount=index + 1, total=len(package_type_to_packages)),
"netWeight": float_round(weight_kg, precision_digits=stock_weight_dp.digits),
"grossWeight": float_round(weight_kg + package_weight_kg, precision_digits=stock_weight_dp.digits),
"qVol": len(packages),
"specie": package_type.name or _("Volume"),
}
# Conditionally add to make sure we don't add falsy values. deep_clean in l10n_br_edi won't clean lists.
if package_type.l10n_br_brand:
volume["brand"] = package_type.l10n_br_brand
volumes.append(volume)
res["goods"]["transport"]["volumes"] = volumes
res["goods"]["transport"]["vehicle"] = {
"automobile": {"licensePlate": self.l10n_br_plate_number},
}
return res
+21
View File
@@ -0,0 +1,21 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class SaleOrder(models.Model):
_inherit = "sale.order"
def _create_invoices(self, grouped=False, final=False, date=None):
"""Override to automatically populate all not yet used packages of the latest validated picking. Don't set a
default if there are backorders or split pickings."""
invoices = super()._create_invoices(grouped=grouped, final=final, date=date)
for invoice in invoices:
root_pickings = invoice._l10n_br_get_pickings()
root_pickings -= root_pickings.mapped(lambda picking: picking._get_next_transfers())
is_simple = len(root_pickings) == 1 and all(len(picking._get_next_transfers()) <= 1 for picking in invoice._l10n_br_get_pickings())
if is_simple:
invoice.l10n_br_package_ids = invoice.l10n_br_related_package_ids.filtered(
lambda package: not package.l10n_br_move_id
)
return invoices
@@ -0,0 +1,8 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class StockPackage(models.Model):
_inherit = "stock.package"
l10n_br_move_id = fields.Many2one("account.move", help="Technical field that assigns this package to an invoice for Brazilian EDI.")
@@ -0,0 +1,8 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class StockPackageType(models.Model):
_inherit = "stock.package.type"
l10n_br_brand = fields.Char("Brand", help="Brazil: brand of the packaging.")
+2
View File
@@ -0,0 +1,2 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_l10n_br_edi_stock
@@ -0,0 +1,77 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
from odoo import Command
from odoo.addons.l10n_br_edi.tests.test_l10n_br_edi import TestL10nBREDICommon
from odoo.tests import tagged
@tagged("post_install_l10n", "-at_install", "post_install")
class TestL10nBrEDIStock(TestL10nBREDICommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.product_screens.barcode = "12345678"
cls.product_screens.is_storable = True
cls.product_screens.product_variant_id.weight = 7
cls.package_type = cls.env["stock.package.type"].create(
{"name": "Box", "l10n_br_brand": "BR brand", "base_weight": 3}
)
cls.sale_order = cls.env["sale.order"].sudo().create(
{
"partner_id": cls.partner_customer.id,
"order_line": [
Command.create(
{
"product_id": cls.product_screens.product_variant_id.id,
"tax_ids": False,
"product_uom_qty": 12,
}
),
],
"l10n_br_edi_freight_model": "CIF",
}
).sudo(False)
def test_01_nfe_with_transport_info(self):
self.env.user.group_ids |= self.env.ref("sales_team.group_sale_salesman")
self.sale_order.action_confirm()
picking = self.sale_order.order_line.move_ids.picking_id[0]
picking.move_ids[0].quantity = picking.move_ids[0].product_uom_qty
picking.action_put_in_pack()
picking.move_line_ids.result_package_id.package_type_id = self.package_type
picking.button_validate()
invoice = self.sale_order._create_invoices()
invoice.fiscal_position_id = self.avatax_fp # only set it on the invoice to avoid patching out calls on sale order
invoice.l10n_br_package_ids = invoice.l10n_br_related_package_ids # select all related packages
self.partner_customer.property_account_position_id = self.avatax_fp
with self.with_patched_account_move("_l10n_br_iap_request"), self.with_patched_account_move("_get_and_set_external_taxes_on_eligible_records"):
invoice.action_post()
invoice.l10n_br_edi_avatax_data = json.dumps({"header": {}}) # normally set by account.external.tax.mixin
invoice.l10n_br_plate_number = "12345678"
wizard = self.env["account.move.send.wizard"].create({"move_id": invoice.id})
with self.with_patched_account_move("_l10n_br_iap_request") as patched_submit:
wizard.action_send_and_print(allow_fallback_pdf=True) # allow_fallback_pdf to avoid raising on errors
sent_request = patched_submit.call_args.args[3]
self.assertIn("volumes", sent_request["header"]["goods"]["transport"], "Transport data wasn't sent in request.")
self.assertEqual(len(sent_request["header"]["goods"]["transport"]["volumes"]), 1, "Exactly one volume should be sent.")
self.assertDictEqual(
sent_request["header"]["goods"]["transport"]["vehicle"], {"automobile": {"licensePlate": "12345678"}}
)
self.assertDictEqual(
sent_request["header"]["goods"]["transport"]["volumes"][0],
{
"qVol": 1,
"volumeNumeration": "1 of 1",
"netWeight": 7.0 * 12,
"grossWeight": 7.0 * 12 + 3,
"brand": "BR brand",
"specie": "Box",
},
)
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form.inherit</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="priority">10</field>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button"
name="action_l10n_br_view_pickings"
type="object"
icon="fa-truck"
invisible="country_code != 'BR' or not l10n_br_edi_freight_model or l10n_br_is_service_transaction or l10n_br_picking_count == 0">
<field string="Delivery" name="l10n_br_picking_count" widget="statinfo"/>
</button>
</div>
<field name="incoterm_location" position="after">
<field name="l10n_br_is_service_transaction" invisible="1"/>
<field name="l10n_br_plate_number"
invisible="country_code != 'BR' or not l10n_br_edi_freight_model or l10n_br_is_service_transaction"
readonly="state in ['cancel', 'posted']"/>
<field name="l10n_br_package_ids"
widget="many2many_tags"
invisible="country_code != 'BR' or not l10n_br_edi_freight_model or l10n_br_is_service_transaction"
readonly="state in ['cancel', 'posted']"
options="{'no_create': True, 'edit_tags': True}"/>
</field>
</field>
</record>
</odoo>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="stock_package_type_form" model="ir.ui.view">
<field name="name">stock.package.type.form.inherit</field>
<field name="model">stock.package.type</field>
<field name="inherit_id" ref="stock.stock_package_type_form"/>
<field name="arch" type="xml">
<field name="barcode" position="after">
<field name="l10n_br_brand"/>
</field>
</field>
</record>
</odoo>