Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 33 additions & 90 deletions purchase_sale_stock_inter_company/i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_sale_stock_inter_company
# * purchase_sale_stock_inter_company
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-05 13:15+0000\n"
"PO-Revision-Date: 2023-12-21 23:45+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"POT-Creation-Date: 2025-02-24 08:15+0000\n"
"PO-Revision-Date: 2025-02-24 08:15+0000\n"
"Last-Translator: \n"
"Language-Team: \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 4.17\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_sale_stock_inter_company
#: model:ir.model,name:purchase_sale_stock_inter_company.model_res_company
Expand Down Expand Up @@ -47,17 +43,42 @@ msgstr ""
"Valor por defecto a establecer en pedidos de venta que serán creados en base "
"a pedidos de compra realizados a esta compañía."

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_company__link_purchase_sale_picking
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_config_settings__link_purchase_sale_picking
msgid ""
"If checked, the pickings of the purchase and sale orders will be linked "
"together. This will validate the purchase pickings when the sale pickings "
"are validated."
msgstr "Si está marcado, los albaranes de compra y venta se vincularán."
"Eso validará los albaranes de compra cuando los albaranes de venta se validen."

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_stock_picking__intercompany_picking_id
msgid "Intercompany Picking"
msgstr "Albarán intercompañía"

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_company__link_purchase_sale_picking
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_config_settings__link_purchase_sale_picking
msgid "Link Purchase and Sale Pickings"
msgstr "Vincular albaranes de compra y venta"

#. module: purchase_sale_stock_inter_company
#: model:ir.model,name:purchase_sale_stock_inter_company.model_purchase_order
msgid "Purchase Order"
msgstr "Pedido de compra"

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_purchase_order__smart_search
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_company__smart_search
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_config_settings__smart_search
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_stock_picking__smart_search
msgid "Smart Search"
msgstr "Búsqueda inteligente"

#. module: purchase_sale_stock_inter_company
#. odoo-python
#: code:addons/purchase_sale_stock_inter_company/models/stock_picking.py:0
#, python-format
msgid ""
Expand All @@ -81,81 +102,3 @@ msgstr "Almacén para pedidos de venta"
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_config_settings__warehouse_id
msgid "Warehouse for Sale Orders"
msgstr "Almacén para pedidos de venta"

#~ msgid "Create Sale Orders when buying to this company"
#~ msgstr "Crear pedido de venta al comprar a esta compañía"

#~ msgid ""
#~ "Generate a Sale Order when a Purchase Order with this company as supplier "
#~ "is created.\n"
#~ " The intercompany user must at least be Sale User."
#~ msgstr ""
#~ "Generar un pedido de venta cuando se cree un pedido de compra con esta "
#~ "compañía como proveedor.\n"
#~ "El usuario intercompañía debe ser al menos Usuario de Ventas."

#~ msgid "Intercompany Sale User"
#~ msgstr "Usuario de venta intercompañía"

#~ msgid "Journal Entries"
#~ msgstr "Asientos contables"

#~ msgid "Purchase/Sale"
#~ msgstr "Compra/Venta"

#~ msgid "Sale Orders Auto Validation"
#~ msgstr "Auto confirmar pedidos de venta"

#~ msgid "Sale from purchase"
#~ msgstr "Venta desde compra"

#~ msgid "Sales Order"
#~ msgstr "Pedido de venta"

#~ msgid "Sales Order Line"
#~ msgstr "Línea de pedido de venta"

#~ msgid "Source Purchase Order"
#~ msgstr "Pedido de compra de origen"

#~ msgid "Source Purchase Order Line"
#~ msgstr "Línea pedido de compra origen"

#~ msgid "This vendor bill is related with: {}"
#~ msgstr "Esta factura de proveedor está relacionada con: {}"

#~ msgid ""
#~ "User used to create the sales order arising from a purchase order in "
#~ "another company."
#~ msgstr ""
#~ "El usuario solía crear los pedidos de venta que surgen de un pedido de "
#~ "compra en otra compañía."

#~ msgid ""
#~ "When a Sale Order is created by a multi company rule for this company, it "
#~ "will automatically validate it."
#~ msgstr ""
#~ "Cuando un pedido de venta es creado por una regla intercompañía para esta "
#~ "compañía, este sera confirmado automáticamente."

#~ msgid "You can't cancel an order that is %s"
#~ msgstr "No puede cancelar un pedido que es %s"

#~ msgid ""
#~ "You cannot create SO from PO because product '%s' is not intercompany"
#~ msgstr ""
#~ "No puede crear pedido de venta desde pedido de compra porque el producto "
#~ "'%s' no es intercompañía"

#~ msgid ""
#~ "You cannot create SO from PO because sale price list currency is "
#~ "different than purchase price list currency."
#~ msgstr ""
#~ "No puede crear pedido de venta desde pedido de compra porque la moneda de "
#~ "la tarifa de venta es distinta de la moneda de la tarifa de compra."

#~ msgid "Invoice"
#~ msgstr "Factura"

#~ msgid "Quotation"
#~ msgstr "Presupuesto"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-24 08:38+0000\n"
"PO-Revision-Date: 2025-02-24 08:38+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -37,19 +39,43 @@ msgid ""
"Orders made to this company."
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_company__link_purchase_sale_picking
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_config_settings__link_purchase_sale_picking
msgid ""
"If checked, the pickings of the purchase and sale orders will be linked "
"together. This will validate the purchase pickings when the sale pickings "
"are validated."
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_stock_picking__intercompany_picking_id
msgid "Intercompany Picking"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_company__link_purchase_sale_picking
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_config_settings__link_purchase_sale_picking
msgid "Link Purchase and Sale Pickings"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model,name:purchase_sale_stock_inter_company.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_purchase_order__smart_search
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_company__smart_search
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_config_settings__smart_search
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_stock_picking__smart_search
msgid "Smart Search"
msgstr ""

#. module: purchase_sale_stock_inter_company
#. odoo-python
#: code:addons/purchase_sale_stock_inter_company/models/stock_picking.py:0
#: code:addons/purchase_sale_stock_inter_company/models/stock_picking.py:0
#, python-format
msgid ""
"There's no corresponding line in PO %(po)s for assigning qty from "
Expand Down
6 changes: 6 additions & 0 deletions purchase_sale_stock_inter_company/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ class ResCompany(models.Model):
help="Default value to set on Sale Orders that "
"will be created based on Purchase Orders made to this company",
)
link_purchase_sale_picking = fields.Boolean(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this feature is already present in v17+ in a normalized way. Could you backport this feature from v17 instead of reworking it from scratch? You can take this PR as a starting point:
#856

The field name in v17 is different, but it is the same field name as in v14 because we forward-ported it during the migration to v17. Therefore, when thinking about the migration from v16 to v17, the best option is for this field to have the same name as in v14 and v17.

sync_picking = fields.Boolean(
string="Sync the receipt with the delivery",
help="Sync the receipt from the destination company with the "
"delivery from the source company",
)
sync_picking_failure_action = fields.Selection(
SELECTION_SYNC_FAILURE_ACTIONS,
string="On sync picking failure",
default="raise",
help="Pick action to perform on sync picking failure",
)
block_po_manual_picking_validation = fields.Boolean(
string="Block manual validation of picking in the destination company",
)
notify_user_id = fields.Many2one("res.users", "User to Notify")

Is there any reason to use a different field name?

Suggested change
link_purchase_sale_picking = fields.Boolean(
sync_picking = fields.Boolean(

string="Link Purchase and Sale Pickings",
help="If checked, the pickings of the purchase and sale "
"orders will be linked together. This will validate "
"the purchase pickings when the sale pickings are validated.",
)
9 changes: 9 additions & 0 deletions purchase_sale_stock_inter_company/models/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ class InterCompanyRulesConfig(models.TransientModel):
"based on Purchase Orders made to this company.",
readonly=False,
)

link_purchase_sale_picking = fields.Boolean(
related="company_id.link_purchase_sale_picking",
string="Link Purchase and Sale Pickings",
help="If checked, the pickings of the purchase and sale "
"orders will be linked together. This will validate "
"the purchase pickings when the sale pickings are validated.",
readonly=False,
)
2 changes: 2 additions & 0 deletions purchase_sale_stock_inter_company/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def _set_intercompany_picking_qty(self, purchase):

def _action_done(self):
# Only DropShip pickings
if not self.env.company.link_purchase_sale_picking:
return super()._action_done()
po_picks = self.browse()
for pick in self.filtered(
lambda x: x.location_dest_id.usage == "customer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2018-2019 Tecnativa - Carlos Dauden
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.tests.common import Form

from odoo.addons.purchase_sale_inter_company.tests.test_inter_company_purchase_sale import (
TestPurchaseSaleInterCompany,
Expand All @@ -23,9 +23,23 @@ def _create_warehouse(cls, code, company):
}
)

@classmethod
def _create_purchase_order_with_product(cls, partner):
po = Form(cls.env["purchase.order"])
po.company_id = cls.company_a
po.partner_id = partner

cls.product_a.invoice_policy = "order"

with po.order_line.new() as line_form:
line_form.product_id = cls.product_a
line_form.product_qty = 280
return po.save()

@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context={"test_queue_job_no_delay": 1})
# Configure 2 Warehouse per company
cls.warehouse_a = cls.env["stock.warehouse"].search(
[("company_id", "=", cls.company_a.id)]
Expand All @@ -37,6 +51,26 @@ def setUpClass(cls):
)
cls.warehouse_d = cls._create_warehouse("CB-WD", cls.company_b)
cls.company_b.warehouse_id = cls.warehouse_c
cls.product_a = cls.env["product.product"].create(
{
"name": "Product A",
"type": "product",
"categ_id": cls.env.ref("product.product_category_all").id,
}
)
# Configure User
cls.user_company_a.groups_id += cls.env.ref("stock.group_stock_user")
cls._configure_user(cls.user_company_a)
cls._configure_user(cls.user_company_b)

# Configure Company B (the supplier)
cls.company_b.so_from_po = True
cls.company_b.sale_auto_validation = 1

cls.intercompany_sale_user_id.company_ids |= cls.company_a
cls.company_b.intercompany_sale_user_id = cls.intercompany_sale_user_id
companies = cls.env["res.company"].search([])
companies.write({"link_purchase_sale_picking": True})

def test_deliver_to_warehouse_a(self):
self.purchase_company_a.picking_type_id = self.warehouse_a.in_type_id
Expand Down Expand Up @@ -67,6 +101,53 @@ def test_purchase_sale_stock_inter_company(self):
)
self.assertEqual(sale.warehouse_id, self.warehouse_c)

def test_purchase_sale_stock_inter_company_without_linking_pickings(self):
self.company_b.link_purchase_sale_picking = False
self.partner_company_b.company_id = self.company_a
purchase = self._create_purchase_order_with_product(self.partner_company_b)
purchase.with_user(self.user_company_a).sudo().button_approve()
sale = (
self.env["sale.order"]
.with_user(self.user_company_b)
.search([("auto_purchase_order_id", "=", purchase.id)])
)
sale.action_confirm()
self.assertEqual(
sale.partner_shipping_id,
purchase.picking_type_id.warehouse_id.partner_id,
)
self.assertEqual(sale.warehouse_id, self.warehouse_c)
purchase_picking_id = purchase.picking_ids
sale_picking_id = sale.picking_ids
for move_id in sale_picking_id.move_ids:
move_id.quantity_done = move_id.product_uom_qty
sale_picking_id._action_done()
self.assertEqual(purchase_picking_id.state, "assigned")
self.assertEqual(sale_picking_id.state, "done")

def test_purchase_sale_stock_inter_company_linking_pickings(self):
self.partner_company_b.company_id = self.company_a
purchase = self._create_purchase_order_with_product(self.partner_company_b)
purchase.with_user(self.user_company_a).sudo().button_approve()
sale = (
self.env["sale.order"]
.with_user(self.user_company_b)
.search([("auto_purchase_order_id", "=", purchase.id)])
)
sale.action_confirm()
self.assertEqual(
sale.partner_shipping_id,
purchase.picking_type_id.warehouse_id.partner_id,
)
self.assertEqual(sale.warehouse_id, self.warehouse_c)
purchase_picking_id = purchase.picking_ids
sale_picking_id = sale.picking_ids
for move_id in sale_picking_id.move_ids:
move_id.quantity_done = move_id.product_uom_qty
sale_picking_id._action_done()
self.assertEqual(purchase_picking_id.state, "done")
self.assertEqual(sale_picking_id.state, "done")

def test_sync_intercompany_picking_qty_with_backorder(self):
self.product.type = "product"
self.partner_company_b.company_id = False
Expand Down
4 changes: 4 additions & 0 deletions purchase_sale_stock_inter_company/views/res_config_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
class="oe_inline"
domain="[('company_id', '=', company_id)]"
/>
<div attrs="{'invisible': [('warehouse_id', '=', False)]}">
<field name="link_purchase_sale_picking" class="oe_inline" />
<label for="link_purchase_sale_picking" class="o_light_label" />
</div>
</xpath>
</field>
</record>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def setUpClass(cls):
line_form.product_qty = 3.0
line_form.price_unit = 450.0
cls.kit_po = po.save()
cls.company_a.write({"link_purchase_sale_picking": True})
cls.company_b.write({"link_purchase_sale_picking": True})

def test_purchase_sale_stock_inter_company_mrp_sale_kit(self):
self.kit_po.with_user(self.user_company_a).button_approve()
Expand Down