diff --git a/purchase_sale_inter_company/README.rst b/purchase_sale_inter_company/README.rst new file mode 100644 index 00000000000..ab131563d06 --- /dev/null +++ b/purchase_sale_inter_company/README.rst @@ -0,0 +1,138 @@ +=============================================== +Inter Company Module for Purchase to Sale Order +=============================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:8afec057f60529d15735ab62ab11ca70230885d40c35f8279df36b888066b8a0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github + :target: https://github.com/OCA/multi-company/tree/17.0/purchase_sale_inter_company + :alt: OCA/multi-company +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/multi-company-17-0/multi-company-17-0-purchase_sale_inter_company + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/multi-company&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is useful if there are multiple companies in the same Odoo +database and those companies sell goods or services among themselves. It +allows to create a sale order in company A from a purchase order in +company B. + +Imagine you have company A and company B in the same Odoo database: + +- Company A purchase goods from company B. +- Company A will create a purchase order with company B as supplier. +- This module automate the creation of the sale order in company B with + company A as customer. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +If you want also to have different warehouses for your sales orders you +can install stock and then purchase_sale_stock_inter_company will be +auto installed. + +Configuration +============= + +To configure this module, you need to: #. go to the menu *General +Settings > Companies > Companies*. #. Select one of the companies. #. Go +to the tab *Inter-Company* then the group *Purchase To Sale*. #. If you +check the option *Sale Auto Validation* in the configuration of company +B, then when you validate a *Purchase Order* in company A with company B +as supplier, the *Sale Order* will be automatically validated in company +B with company A as customer. + +Known issues / Roadmap +====================== + +- No synchronization is made from the generated sale order back to the + purchase order. This would be interesting in the case of price + changes and discounts, that would be transmitted to the purchase so + both documents couldn't have different total amounts, taxes, etc. A + mechanism for synching from the sale to the purchase order would be + needed. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Odoo SA +* Akretion +* Tecnativa + +Contributors +------------ + +- Odoo S.A. (original module inter_company_rules) +- Andrea Stirpe +- Adria Gil Sorribes +- Christopher Ormaza +- \`Akretion \`: + + - Chafique Delli + - Alexis de Lattre + - David Beal + +- \`Tecnativa \`: + + - Jairo Llopis + - David Vidal + - Pedro M. Baeza + +- \`Camptocamp \`: + + - Maksym Yankin + +- \`Komit \`: + + - Cuong Nguyen Mtm + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/multi-company `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_sale_inter_company/__init__.py b/purchase_sale_inter_company/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/purchase_sale_inter_company/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/purchase_sale_inter_company/__manifest__.py b/purchase_sale_inter_company/__manifest__.py new file mode 100644 index 00000000000..7748a37db3a --- /dev/null +++ b/purchase_sale_inter_company/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Inter Company Module for Purchase to Sale Order", + "summary": "Intercompany PO/SO rules", + "version": "17.0.1.0.0", + "category": "Purchase Management", + "website": "https://github.com/OCA/multi-company", + "author": "Odoo SA, Akretion, Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": ["sale", "purchase", "account_invoice_inter_company"], + "data": ["views/res_config_view.xml"], +} diff --git a/purchase_sale_inter_company/i18n/de.po b/purchase_sale_inter_company/i18n/de.po new file mode 100644 index 00000000000..66a4b29ca96 --- /dev/null +++ b/purchase_sale_inter_company/i18n/de.po @@ -0,0 +1,173 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +# Translators: +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-04 15:47+0000\n" +"PO-Revision-Date: 2017-04-22 02:48+0000\n" +"Last-Translator: Rudolf Schnapka , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "Unternehmen" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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 "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Purchase/Sale" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "" +"User used to create the sales order arising from a purchase order in another " +"company." +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "" +"When a Sale Order is created by a multi company rule for this company, it " +"will automatically validate it." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "You cannot create SO from PO because product '%s' is not intercompany" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "" +"You cannot create SO from PO because sale price list currency is different " +"than purchase price list currency." +msgstr "" diff --git a/purchase_sale_inter_company/i18n/es.po b/purchase_sale_inter_company/i18n/es.po new file mode 100644 index 00000000000..d7ba5bd7bc0 --- /dev/null +++ b/purchase_sale_inter_company/i18n/es.po @@ -0,0 +1,189 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-04 15:47+0000\n" +"PO-Revision-Date: 2024-01-02 20:36+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\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" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "Ajustes Configuración" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "Crear pedido de venta al comprar a esta compañía" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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." + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "Línea de venta entre empresas" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "Orden de venta entre empresas" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "Usuario de venta intercompañía" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "Entrada diaria" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "Pedido de compra" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Línea de Orden de Compra" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Purchase/Sale" +msgstr "Compra/Venta" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "Auto confirmar pedidos de venta" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "Venta desde compra" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "Línea de pedido de venta" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "Pedido de compra de origen" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "Línea pedido de compra origen" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" +"Los pedidos de venta generados con referencia %(orders)s no pueden ser " +"modificados. Están sin confirmar o bloqueados para modificaciones." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "Esta factura de vendedor está relacionada con: {}" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +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." + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +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." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "No puede cancelar un pedido que es %s" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" +"No puede cambiar esta orden de compra ya que la venta correspondiente es " +"%(state)s" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +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" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +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." diff --git a/purchase_sale_inter_company/i18n/fr.po b/purchase_sale_inter_company/i18n/fr.po new file mode 100644 index 00000000000..e92937b9415 --- /dev/null +++ b/purchase_sale_inter_company/i18n/fr.po @@ -0,0 +1,181 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-04 15:47+0000\n" +"PO-Revision-Date: 2017-10-19 00:51+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "Sociétés" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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 "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "Bon de commande" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +#, fuzzy +msgid "Purchase/Sale" +msgstr "Achat vers Vente" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "Auto Validation des commandes de vente" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +#, fuzzy +msgid "Sales Order" +msgstr "Commande de ventes" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "Ligne de commandes de vente" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "Commande d'achat source" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "Ligne de commande d'achat source" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "" +"User used to create the sales order arising from a purchase order in another " +"company." +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "" +"When a Sale Order is created by a multi company rule for this company, it " +"will automatically validate it." +msgstr "" +"Quand une commande de vente est créé en mode multi-société pour cette " +"société, elle sera automatiquement validé." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "You cannot create SO from PO because product '%s' is not intercompany" +msgstr "" +"Vous ne pouvez pas créer la SO à partir de la PO car le produit '%s' n'est " +"pas multi-société" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, fuzzy, python-format +msgid "" +"You cannot create SO from PO because sale price list currency is different " +"than purchase price list currency." +msgstr "" +"Vous ne pouvez pas créer la SO à partir de la PO car la devise sur la liste " +"de prix de vente est différente de la devise sur la liste de prix d'achat." diff --git a/purchase_sale_inter_company/i18n/fr_FR.po b/purchase_sale_inter_company/i18n/fr_FR.po new file mode 100644 index 00000000000..36702904b57 --- /dev/null +++ b/purchase_sale_inter_company/i18n/fr_FR.po @@ -0,0 +1,182 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-04 15:47+0000\n" +"PO-Revision-Date: 2017-10-19 00:51+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (France) (https://www.transifex.com/oca/teams/23907/" +"fr_FR/)\n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "Sociétés" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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 "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "Commande d'achat" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +#, fuzzy +msgid "Purchase/Sale" +msgstr "Achat vers Vente" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "Auto Validation des commandes de vente" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +#, fuzzy +msgid "Sales Order" +msgstr "Commandes de vente" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "Ligne de commandes de vente" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "Commande d'achat source" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "Ligne de commande d'achat source" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "" +"User used to create the sales order arising from a purchase order in another " +"company." +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "" +"When a Sale Order is created by a multi company rule for this company, it " +"will automatically validate it." +msgstr "" +"Quand une commande de vente est créé en mode inter-société pour cette " +"société, elle sera automatiquement validé." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "You cannot create SO from PO because product '%s' is not intercompany" +msgstr "" +"Vous ne pouvez pas créer la SO à partir de la PO car le produit '%s' n'est " +"pas multi-société" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, fuzzy, python-format +msgid "" +"You cannot create SO from PO because sale price list currency is different " +"than purchase price list currency." +msgstr "" +"Vous ne pouvez pas créer la SO à partir de la PO car la devise sur la liste " +"de prix de vente est différente de la devise sur la liste de prix d'achat." diff --git a/purchase_sale_inter_company/i18n/it.po b/purchase_sale_inter_company/i18n/it.po new file mode 100644 index 00000000000..4279f821ea2 --- /dev/null +++ b/purchase_sale_inter_company/i18n/it.po @@ -0,0 +1,187 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-04 15:47+0000\n" +"PO-Revision-Date: 2024-02-02 13:35+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "Aziende" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni di configurazione" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "Creare ordini di vendita quando si acquista da questa azienda" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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 "" +"Generare un ordine di vendita quando un ordine d'acquisto viene creato con " +"questa azienda come fornitore.\n" +" L'utente interaziendale deve essere almeno un utente vendite." + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "Riga di vendita interaziendale" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "Ordine di vendita interaziendale" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "Utente vendite interaziendale" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "Registrazione contabile" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "Ordine di acquisto" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Riga ordine di acquisto" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Purchase/Sale" +msgstr "Acquisto/Vendita" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "Validazione automatica ordini di vendita" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "Vendita da acquisto" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +msgid "Sales Order" +msgstr "Ordine di vendita" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "Riga ordine di vendita" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "Ordine d'acquisto di origine" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "Riga ordine d'acquisto di origine" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" +"Gli ordini di vendita generati con riferimento %(orders)s non possono essere " +"modificati. Sono non confermati o bloccati per modifiche." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "Questa fattura fornitore è relativa a: {}" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "" +"User used to create the sales order arising from a purchase order in another " +"company." +msgstr "" +"Utente usato per creare gli ordini di vendita derivanti da un ordine di " +"acquisto interaziendale." + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "" +"When a Sale Order is created by a multi company rule for this company, it " +"will automatically validate it." +msgstr "" +"Quando un ordine di vendita viene creato da una regola multi azienda per " +"questa azienda, verrà automaticamente validato." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "Impossibile annullare un ordine che è %s" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" +"Non si può modificare questo ordine di acquisto perchè la vendita " +"corrispondente è %(state)s" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "You cannot create SO from PO because product '%s' is not intercompany" +msgstr "" +"Impossibile creare l'ordine di vendita dall'ordine d'acquisto perchè il " +"prodotto '%s' non è interaziendale" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "" +"You cannot create SO from PO because sale price list currency is different " +"than purchase price list currency." +msgstr "" +"Impossibile creare l'ordine di vendita dall'ordine d'acquisto perchè la " +"valuta del listino di vendita è diversa dalla valuta del listino d'acquisto." diff --git a/purchase_sale_inter_company/i18n/purchase_sale_inter_company.pot b/purchase_sale_inter_company/i18n/purchase_sale_inter_company.pot new file mode 100644 index 00000000000..bb0709e0b42 --- /dev/null +++ b/purchase_sale_inter_company/i18n/purchase_sale_inter_company.pot @@ -0,0 +1,167 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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 "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Purchase/Sale" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "" +"User used to create the sales order arising from a purchase order in another" +" company." +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "" +"When a Sale Order is created by a multi company rule for this company, it " +"will automatically validate it." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "You cannot create SO from PO because product '%s' is not intercompany" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "" +"You cannot create SO from PO because sale price list currency is different " +"than purchase price list currency." +msgstr "" diff --git a/purchase_sale_inter_company/i18n/sl.po b/purchase_sale_inter_company/i18n/sl.po new file mode 100644 index 00000000000..59044cac1a6 --- /dev/null +++ b/purchase_sale_inter_company/i18n/sl.po @@ -0,0 +1,182 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +# Translators: +# Matjaž Mozetič , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-04 15:47+0000\n" +"PO-Revision-Date: 2017-10-19 00:51+0000\n" +"Last-Translator: Matjaž Mozetič , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "Družbe" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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 "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "Nabavni nalog" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +#, fuzzy +msgid "Purchase/Sale" +msgstr "Nabava v prodajo" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "Samodejno overjanje prodajnih nalogov" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +#, fuzzy +msgid "Sales Order" +msgstr "Prodajni nalog" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "Postavka prodajnega naloga" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "Izvorni nabavni nalog" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "Postavka izvornega prodajnega naloga" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "" +"User used to create the sales order arising from a purchase order in another " +"company." +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "" +"When a Sale Order is created by a multi company rule for this company, it " +"will automatically validate it." +msgstr "" +"Ko se ustvari prodajni nalog iz pravila konsolidiranja za to družbo, se le-" +"ta samodejno overi." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "You cannot create SO from PO because product '%s' is not intercompany" +msgstr "" +"Prodajnega naloga ni mogoče ustvariti na osnovi nabavnega, ker proizvoda " +"'%s' ni v sklopu strukturiranih družb." + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, fuzzy, python-format +msgid "" +"You cannot create SO from PO because sale price list currency is different " +"than purchase price list currency." +msgstr "" +"Prodajnega naloga ni mogoče ustvariti na osnovi nabavnega, ker je valuta " +"prodajnega cenika drugačna od valute nabavnega." diff --git a/purchase_sale_inter_company/i18n/zh_CN.po b/purchase_sale_inter_company/i18n/zh_CN.po new file mode 100644 index 00000000000..4f0ff5fae5f --- /dev/null +++ b/purchase_sale_inter_company/i18n/zh_CN.po @@ -0,0 +1,172 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_sale_inter_company +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-08-04 15:47+0000\n" +"PO-Revision-Date: 2020-04-07 18:19+0000\n" +"Last-Translator: Dong \n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.10\n" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_company +msgid "Companies" +msgstr "公司" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_res_config_settings +msgid "Config Settings" +msgstr "配置设定" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__so_from_po +msgid "Create Sale Orders when buying to this company" +msgstr "当关联公司向该公司采购时自动创建销售订单" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__so_from_po +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__so_from_po +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 "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order_line__intercompany_sale_line_id +msgid "Intercompany Sale Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_purchase_order__intercompany_sale_order_id +msgid "Intercompany Sale Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__intercompany_sale_user_id +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "Intercompany Sale User" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Purchase/Sale" +msgstr "公司间交易" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "Sale Orders Auto Validation" +msgstr "" + +#. module: purchase_sale_inter_company +#: model_terms:ir.ui.view,arch_db:purchase_sale_inter_company.res_config_settings_view_form +msgid "Sale from purchase" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model,name:purchase_sale_inter_company.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order__auto_purchase_order_id +msgid "Source Purchase Order" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,field_description:purchase_sale_inter_company.field_sale_order_line__auto_purchase_line_id +msgid "Source Purchase Order Line" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"The generated sale orders with reference %(orders)s can't be modified. " +"They're either unconfirmed or locked for modifications." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/account_move.py:0 +#, python-format +msgid "This vendor bill is related with: {}" +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__intercompany_sale_user_id +msgid "" +"User used to create the sales order arising from a purchase order in another " +"company." +msgstr "" + +#. module: purchase_sale_inter_company +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_company__sale_auto_validation +#: model:ir.model.fields,help:purchase_sale_inter_company.field_res_config_settings__sale_auto_validation +msgid "" +"When a Sale Order is created by a multi company rule for this company, it " +"will automatically validate it." +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "You can't cancel an order that is %s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "" +"You can't change this purchase order as the corresponding sale is %(state)s" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order_line.py:0 +#, python-format +msgid "You cannot create SO from PO because product '%s' is not intercompany" +msgstr "" + +#. module: purchase_sale_inter_company +#. odoo-python +#: code:addons/purchase_sale_inter_company/models/purchase_order.py:0 +#, python-format +msgid "" +"You cannot create SO from PO because sale price list currency is different " +"than purchase price list currency." +msgstr "" diff --git a/purchase_sale_inter_company/models/__init__.py b/purchase_sale_inter_company/models/__init__.py new file mode 100644 index 00000000000..853b3e57105 --- /dev/null +++ b/purchase_sale_inter_company/models/__init__.py @@ -0,0 +1,7 @@ +from . import account_move +from . import purchase_order +from . import purchase_order_line +from . import res_company +from . import res_config +from . import sale_order +from . import sale_order_line diff --git a/purchase_sale_inter_company/models/account_move.py b/purchase_sale_inter_company/models/account_move.py new file mode 100644 index 00000000000..da9ffb7ac02 --- /dev/null +++ b/purchase_sale_inter_company/models/account_move.py @@ -0,0 +1,33 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from markupsafe import Markup + +from odoo import _, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + def _inter_company_create_invoice(self, dest_company): + res = super()._inter_company_create_invoice(dest_company) + if res["dest_invoice"].move_type == "in_invoice": + self._link_invoice_purchase(res["dest_invoice"]) + return res + + def _link_invoice_purchase(self, dest_invoice): + self.ensure_one() + orders = self.env["purchase.order"] + for line in dest_invoice.invoice_line_ids: + line.purchase_line_id = ( + line.auto_invoice_line_id.sale_line_ids.auto_purchase_line_id + ) + orders = dest_invoice.invoice_line_ids.purchase_line_id.order_id + if orders: + ref = "{}" + message = _("This vendor bill is related with: {}").format( + ",".join([ref.format(o.id, o.name) for o in orders]) + ) + dest_invoice.message_post(body=Markup(message)) diff --git a/purchase_sale_inter_company/models/purchase_order.py b/purchase_sale_inter_company/models/purchase_order.py new file mode 100644 index 00000000000..0b3f2bec331 --- /dev/null +++ b/purchase_sale_inter_company/models/purchase_order.py @@ -0,0 +1,188 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, fields, models +from odoo.exceptions import UserError + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + intercompany_sale_order_id = fields.Many2one( + comodel_name="sale.order", + compute="_compute_intercompany_sale_order_id", + compute_sudo=True, + ) + + def _compute_intercompany_sale_order_id(self): + """A One2many would be simpler, but the record rules make unaccesible for + regular users so the logic doesn't work properly""" + ids_dict_list = self.env["sale.order"].search_read( + [("auto_purchase_order_id", "in", self.ids)], + ["id", "auto_purchase_order_id"], + ) + ids_dict = {d["auto_purchase_order_id"][0]: d["id"] for d in ids_dict_list} + for order in self: + order.intercompany_sale_order_id = ids_dict.get(order.id, False) + + def button_approve(self, force=False): + """Generate inter company sale order base on conditions.""" + res = super().button_approve(force) + for purchase_order in self.sudo(): + # get the company from partner then trigger action of + # intercompany relation + dest_company = ( + purchase_order.partner_id.commercial_partner_id.ref_company_ids + ) + if dest_company and dest_company.so_from_po: + purchase_order.with_company( + dest_company.id + )._inter_company_create_sale_order(dest_company) + return res + + def _get_user_domain(self, dest_company): + self.ensure_one() + group_purchase_user = self.env.ref("purchase.group_purchase_user") + return [ + ("id", "!=", 1), + ("company_id", "=", dest_company.id), + ("id", "in", group_purchase_user.users.ids), + ] + + def _check_intercompany_product(self, dest_company): + domain = self._get_user_domain(dest_company) + dest_user = self.env["res.users"].search(domain, limit=1) + if dest_user: + for purchase_line in self.order_line: + purchase_line._check_intercompany_product(dest_user, dest_company) + + def _inter_company_create_sale_order(self, dest_company): + """Create a Sale Order from the current PO (self) + Note : In this method, reading the current PO is done as sudo, + and the creation of the derived + SO as intercompany_user, minimizing the access right required + for the trigger user. + :param dest_company : the company of the created PO + :rtype dest_company : res.company record + """ + self.ensure_one() + # Check intercompany user + intercompany_user = dest_company.intercompany_sale_user_id + if not intercompany_user: + intercompany_user = self.env.user + # check intercompany product + self._check_intercompany_product(dest_company) + # Accessing to selling partner with selling user, so data like + # property_account_position can be retrieved + company_partner = self.company_id.partner_id + # check pricelist currency should be same with PO/SO document + if self.currency_id.id != ( + company_partner.property_product_pricelist.currency_id.id + or dest_company.currency_id.id + ): + raise UserError( + _( + "You cannot create SO from PO because " + "sale price list currency is different than " + "purchase price list currency." + ) + ) + # create the SO and generate its lines from the PO lines + sale_order_data = self._prepare_sale_order_data( + self.name, company_partner, dest_company, self.dest_address_id + ) + sale_order = ( + self.env["sale.order"] + .with_user(intercompany_user.id) + .sudo() + .create(sale_order_data) + ) + for purchase_line in self.order_line: + sale_line_data = self._prepare_sale_order_line_data( + purchase_line, dest_company, sale_order + ) + self.env["sale.order.line"].with_user(intercompany_user.id).sudo().create( + sale_line_data + ) + # write supplier reference field on PO + if not self.partner_ref: + self.partner_ref = sale_order.name + # Validation of sale order + if dest_company.sale_auto_validation: + sale_order.with_user(intercompany_user.id).sudo().action_confirm() + return sale_order + + def _prepare_sale_order_data( + self, name, partner, dest_company, direct_delivery_address + ): + """Generate the Sale Order values from the PO + :param name : the origin client reference + :rtype name : string + :param partner : the partner reprenseting the company + :rtype partner : res.partner record + :param dest_company : the company of the created SO + :rtype dest_company : res.company record + :param direct_delivery_address : the address of the SO + :rtype direct_delivery_address : res.partner record + """ + self.ensure_one() + delivery_address = direct_delivery_address or partner or False + new_order = self.env["sale.order"].new( + { + "company_id": dest_company.id, + "client_order_ref": name, + "partner_id": partner.id, + "date_order": self.date_approve, + "auto_purchase_order_id": self.id, + } + ) + for onchange_method in new_order._onchange_methods["partner_id"]: + onchange_method(new_order) + new_order.user_id = False + if delivery_address: + new_order.partner_shipping_id = delivery_address + if self.notes: + new_order.note = self.notes + new_order.commitment_date = self.date_planned + return new_order._convert_to_write(new_order._cache) + + def _prepare_sale_order_line_data(self, purchase_line, dest_company, sale_order): + """Generate the Sale Order Line values from the PO line + :param purchase_line : the origin Purchase Order Line + :rtype purchase_line : purchase.order.line record + :param dest_company : the company of the created SO + :rtype dest_company : res.company record + :param sale_order : the Sale Order + """ + new_line = self.env["sale.order.line"].new( + { + "order_id": sale_order.id, + "product_id": purchase_line.product_id.id, + "product_uom": purchase_line.product_uom.id, + "product_uom_qty": purchase_line.product_qty, + "auto_purchase_line_id": purchase_line.id, + "display_type": purchase_line.display_type, + } + ) + for onchange_method in new_line._onchange_methods["product_id"]: + onchange_method(new_line) + new_line.update({"product_uom": purchase_line.product_uom.id}) + if new_line.display_type in ["line_section", "line_note"]: + new_line.update({"name": purchase_line.name}) + return new_line._convert_to_write(new_line._cache) + + def button_cancel(self): + sale_orders = ( + self.env["sale.order"] + .sudo() + .search([("auto_purchase_order_id", "in", self.ids)]) + ) + for so in sale_orders: + if so.state not in ["draft", "sent", "cancel"]: + raise UserError(_("You can't cancel an order that is %s") % so.state) + for so in sale_orders: + so.action_cancel() + self.write({"partner_ref": False}) + return super().button_cancel() diff --git a/purchase_sale_inter_company/models/purchase_order_line.py b/purchase_sale_inter_company/models/purchase_order_line.py new file mode 100644 index 00000000000..2cc3979ae74 --- /dev/null +++ b/purchase_sale_inter_company/models/purchase_order_line.py @@ -0,0 +1,125 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class PurchaseOrderLine(models.Model): + _inherit = "purchase.order.line" + + intercompany_sale_line_id = fields.Many2one( + comodel_name="sale.order.line", + compute="_compute_intercompany_sale_line_id", + compute_sudo=True, + ) + + def _compute_intercompany_sale_line_id(self): + """A One2many would be simpler, but the record rules make unaccesible for + regular users so the logic doesn't work properly""" + ids_dict_list = self.env["sale.order.line"].search_read( + [("auto_purchase_line_id", "in", self.ids)], ["id", "auto_purchase_line_id"] + ) + ids_dict = {d["auto_purchase_line_id"][0]: d["id"] for d in ids_dict_list} + for line in self: + line.intercompany_sale_line_id = ids_dict.get(line.id, False) + + @api.model_create_multi + def create(self, vals_list): + """Sync lines between an confirmed unlocked purchase and a confirmed unlocked + sale order""" + lines = super().create(vals_list) + for order in lines.order_id.filtered( + lambda x: x.state == "purchase" and x.intercompany_sale_order_id + ): + if order.intercompany_sale_order_id.sudo().state in {"cancel", "done"}: + raise UserError( + _( + "You can't change this purchase order as the corresponding " + "sale is %(state)s", + state=order.state, + ) + ) + intercompany_user = ( + order.intercompany_sale_order_id.sudo().company_id.intercompany_sale_user_id + or self.env.user + ) + sale_lines = [] + for purchase_line in lines.filtered(lambda x, o=order: x.order_id == o): + sale_lines.append( + order._prepare_sale_order_line_data( + purchase_line, + order.intercompany_sale_order_id.sudo().company_id, + order.intercompany_sale_order_id.sudo(), + ) + ) + self.env["sale.order.line"].with_user(intercompany_user.id).sudo().create( + sale_lines + ) + return lines + + @api.model + def _get_purchase_sale_line_sync_fields(self): + """Map purchase line fields to the synced sale line peer""" + return { + "product_qty": "product_uom_qty", + } + + def write(self, vals): + """Sync values of confirmed unlocked sales""" + res = super().write(vals) + sync_map = self._get_purchase_sale_line_sync_fields() + update_vals = { + sync_map.get(field): value + for field, value in vals.items() + if sync_map.get(field) + } + if not update_vals: + return res + intercompany_user = ( + self.intercompany_sale_line_id.sudo().company_id.intercompany_sale_user_id + or self.env.user + ) + sale_lines = self.intercompany_sale_line_id.with_user( + intercompany_user.id + ).sudo() + if not sale_lines: + return res + closed_sale_lines = sale_lines.filtered(lambda x: x.state != "sale") + if closed_sale_lines: + raise UserError( + _( + "The generated sale orders with reference %(orders)s can't be " + "modified. They're either unconfirmed or locked for modifications.", + orders=",".join(closed_sale_lines.order_id.mapped("name")), + ) + ) + # Update directly the sale order so we can trigger the decreased qty exceptions + for sale in sale_lines.order_id: + sale.write( + { + "order_line": [ + (1, line.id, update_vals) + for line in sale_lines.filtered( + lambda x, s=sale: x.order_id == s + ) + ] + } + ) + return res + + @api.model + def _check_intercompany_product(self, dest_user, dest_company): + if ( + self.product_id.company_id + and self.product_id.company_id not in dest_user.company_ids + ): + raise UserError( + _( + "You cannot create SO from PO because product '%s' " + "is not intercompany" + ) + % self.product_id.name + ) diff --git a/purchase_sale_inter_company/models/res_company.py b/purchase_sale_inter_company/models/res_company.py new file mode 100644 index 00000000000..b9079fa559f --- /dev/null +++ b/purchase_sale_inter_company/models/res_company.py @@ -0,0 +1,27 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + so_from_po = fields.Boolean( + string="Create Sale Orders when buying to this company", + help="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.", + ) + sale_auto_validation = fields.Boolean( + string="Sale Orders Auto Validation", + default=True, + help="When a Sale Order is created by a multi company rule for " + "this company, it will automatically validate it.", + ) + intercompany_sale_user_id = fields.Many2one( + comodel_name="res.users", + string="Intercompany Sale User", + ) diff --git a/purchase_sale_inter_company/models/res_config.py b/purchase_sale_inter_company/models/res_config.py new file mode 100644 index 00000000000..b118af7553c --- /dev/null +++ b/purchase_sale_inter_company/models/res_config.py @@ -0,0 +1,34 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class InterCompanyRulesConfig(models.TransientModel): + _inherit = "res.config.settings" + + so_from_po = fields.Boolean( + related="company_id.so_from_po", + string="Create Sale Orders when buying to this company", + help="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.", + readonly=False, + ) + sale_auto_validation = fields.Boolean( + related="company_id.sale_auto_validation", + string="Sale Orders Auto Validation", + help="When a Sale Order is created by a multi company rule for " + "this company, it will automatically validate it.", + readonly=False, + ) + intercompany_sale_user_id = fields.Many2one( + comodel_name="res.users", + related="company_id.intercompany_sale_user_id", + string="Intercompany Sale User", + help="User used to create the sales order arising from a purchase " + "order in another company.", + readonly=False, + ) diff --git a/purchase_sale_inter_company/models/sale_order.py b/purchase_sale_inter_company/models/sale_order.py new file mode 100644 index 00000000000..4f4fd17c377 --- /dev/null +++ b/purchase_sale_inter_company/models/sale_order.py @@ -0,0 +1,24 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + auto_purchase_order_id = fields.Many2one( + comodel_name="purchase.order", + string="Source Purchase Order", + readonly=True, + copy=False, + ) + + def action_confirm(self): + for order in self.filtered("auto_purchase_order_id"): + for line in order.order_line.sudo(): + if line.auto_purchase_line_id: + line.auto_purchase_line_id.price_unit = line.price_unit + return super().action_confirm() diff --git a/purchase_sale_inter_company/models/sale_order_line.py b/purchase_sale_inter_company/models/sale_order_line.py new file mode 100644 index 00000000000..4b46651f4f6 --- /dev/null +++ b/purchase_sale_inter_company/models/sale_order_line.py @@ -0,0 +1,17 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2016-2019 Chafique DELLI @ Akretion +# Copyright 2018-2019 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + auto_purchase_line_id = fields.Many2one( + comodel_name="purchase.order.line", + string="Source Purchase Order Line", + readonly=True, + copy=False, + ) diff --git a/purchase_sale_inter_company/pyproject.toml b/purchase_sale_inter_company/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/purchase_sale_inter_company/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/purchase_sale_inter_company/readme/CONFIGURE.md b/purchase_sale_inter_company/readme/CONFIGURE.md new file mode 100644 index 00000000000..60f50bff81e --- /dev/null +++ b/purchase_sale_inter_company/readme/CONFIGURE.md @@ -0,0 +1,7 @@ +To configure this module, you need to: \#. go to the menu *General +Settings \> Companies \> Companies*. \#. Select one of the companies. +\#. Go to the tab *Inter-Company* then the group *Purchase To Sale*. \#. +If you check the option *Sale Auto Validation* in the configuration of +company B, then when you validate a *Purchase Order* in company A with +company B as supplier, the *Sale Order* will be automatically validated +in company B with company A as customer. diff --git a/purchase_sale_inter_company/readme/CONTRIBUTORS.md b/purchase_sale_inter_company/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..749ae1919da --- /dev/null +++ b/purchase_sale_inter_company/readme/CONTRIBUTORS.md @@ -0,0 +1,16 @@ +- Odoo S.A. (original module inter_company_rules) +- Andrea Stirpe \<\> +- Adria Gil Sorribes \<\> +- Christopher Ormaza \<\> +- \`Akretion \<\>\`: + - Chafique Delli \<\> + - Alexis de Lattre \<\> + - David Beal \<\> +- \`Tecnativa \<\>\`: + - Jairo Llopis + - David Vidal + - Pedro M. Baeza +- \`Camptocamp \<\>\`: + - Maksym Yankin \<\> +- \`Komit \<\>\`: + - Cuong Nguyen Mtm \<\> diff --git a/purchase_sale_inter_company/readme/DESCRIPTION.md b/purchase_sale_inter_company/readme/DESCRIPTION.md new file mode 100644 index 00000000000..726356c4a5f --- /dev/null +++ b/purchase_sale_inter_company/readme/DESCRIPTION.md @@ -0,0 +1,11 @@ +This module is useful if there are multiple companies in the same Odoo +database and those companies sell goods or services among themselves. It +allows to create a sale order in company A from a purchase order in +company B. + +Imagine you have company A and company B in the same Odoo database: + +- Company A purchase goods from company B. +- Company A will create a purchase order with company B as supplier. +- This module automate the creation of the sale order in company B with + company A as customer. diff --git a/purchase_sale_inter_company/readme/INSTALL.md b/purchase_sale_inter_company/readme/INSTALL.md new file mode 100644 index 00000000000..4fec76d793a --- /dev/null +++ b/purchase_sale_inter_company/readme/INSTALL.md @@ -0,0 +1,3 @@ +If you want also to have different warehouses for your sales orders you +can install stock and then purchase_sale_stock_inter_company will be +auto installed. diff --git a/purchase_sale_inter_company/readme/ROADMAP.md b/purchase_sale_inter_company/readme/ROADMAP.md new file mode 100644 index 00000000000..9608e90b72a --- /dev/null +++ b/purchase_sale_inter_company/readme/ROADMAP.md @@ -0,0 +1,6 @@ +- No synchronization is made from the generated sale order back to the + purchase order. This would be interesting in the case of price changes + and discounts, that would be transmitted to the purchase so both + documents couldn't have different total amounts, taxes, etc. A + mechanism for synching from the sale to the purchase order would be + needed. diff --git a/purchase_sale_inter_company/static/description/icon.png b/purchase_sale_inter_company/static/description/icon.png new file mode 100644 index 00000000000..b3de330666d Binary files /dev/null and b/purchase_sale_inter_company/static/description/icon.png differ diff --git a/purchase_sale_inter_company/static/description/index.html b/purchase_sale_inter_company/static/description/index.html new file mode 100644 index 00000000000..f16b52c0877 --- /dev/null +++ b/purchase_sale_inter_company/static/description/index.html @@ -0,0 +1,488 @@ + + + + + +Inter Company Module for Purchase to Sale Order + + + +
+

Inter Company Module for Purchase to Sale Order

+ + +

Beta License: AGPL-3 OCA/multi-company Translate me on Weblate Try me on Runboat

+

This module is useful if there are multiple companies in the same Odoo +database and those companies sell goods or services among themselves. It +allows to create a sale order in company A from a purchase order in +company B.

+

Imagine you have company A and company B in the same Odoo database:

+
    +
  • Company A purchase goods from company B.
  • +
  • Company A will create a purchase order with company B as supplier.
  • +
  • This module automate the creation of the sale order in company B with +company A as customer.
  • +
+

Table of contents

+ +
+

Installation

+

If you want also to have different warehouses for your sales orders you +can install stock and then purchase_sale_stock_inter_company will be +auto installed.

+
+
+

Configuration

+

To configure this module, you need to: #. go to the menu General +Settings > Companies > Companies. #. Select one of the companies. #. Go +to the tab Inter-Company then the group Purchase To Sale. #. If you +check the option Sale Auto Validation in the configuration of company +B, then when you validate a Purchase Order in company A with company B +as supplier, the Sale Order will be automatically validated in company +B with company A as customer.

+
+
+

Known issues / Roadmap

+
    +
  • No synchronization is made from the generated sale order back to the +purchase order. This would be interesting in the case of price +changes and discounts, that would be transmitted to the purchase so +both documents couldn’t have different total amounts, taxes, etc. A +mechanism for synching from the sale to the purchase order would be +needed.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Odoo SA
  • +
  • Akretion
  • +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/multi-company project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/purchase_sale_inter_company/tests/__init__.py b/purchase_sale_inter_company/tests/__init__.py new file mode 100644 index 00000000000..0dabb106139 --- /dev/null +++ b/purchase_sale_inter_company/tests/__init__.py @@ -0,0 +1 @@ +from . import test_inter_company_purchase_sale diff --git a/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py b/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py new file mode 100644 index 00000000000..3e7844cdbda --- /dev/null +++ b/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py @@ -0,0 +1,335 @@ +# Copyright 2013-Today Odoo SA +# Copyright 2019-2019 Chafique DELLI @ Akretion +# 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.exceptions import UserError +from odoo.tests.common import Form + +from odoo.addons.account_invoice_inter_company.tests.test_inter_company_invoice import ( + TestAccountInvoiceInterCompanyBase, +) + + +class TestPurchaseSaleInterCompany(TestAccountInvoiceInterCompanyBase): + @classmethod + def _configure_user(cls, user): + for xml in [ + "account.group_account_manager", + "base.group_partner_manager", + "sales_team.group_sale_manager", + "purchase.group_purchase_manager", + ]: + user.groups_id |= cls.env.ref(xml) + + @classmethod + def _create_purchase_order(cls, partner): + po = Form(cls.env["purchase.order"]) + po.company_id = cls.company_a + po.partner_id = partner + + cls.product.invoice_policy = "order" + + with po.order_line.new() as line_form: + line_form.product_id = cls.product + line_form.product_qty = 3.0 + line_form.name = "Service Multi Company" + line_form.price_unit = 450.0 + return po.save() + + @classmethod + def setUpClass(cls): + super().setUpClass() + # no job: avoid issue if account_invoice_inter_company_queued is installed + cls.env = cls.env(context={"test_queue_job_no_delay": 1}) + + cls.product = cls.product_consultant_multi_company + cls.service_product_2 = cls.env["product.product"].create( + { + "name": "Service Product 2", + "type": "service", + } + ) + # if product_multi_company is installed + if "company_ids" in cls.env["product.template"]._fields: + # We have to do that because the default method added a company + cls.service_product_2.company_ids = False + + if "company_ids" in cls.env["res.partner"]._fields: + # Intercompany contacts should not have a company set + cls.partner_company_a.company_ids = False + cls.partner_company_b.company_ids = False + + # Configure Company B (the supplier) + cls.company_b.so_from_po = True + cls.company_b.sale_auto_validation = 1 + + cls.intercompany_sale_user_id = cls.user_company_b.copy() + cls.intercompany_sale_user_id.company_ids |= cls.company_a + cls.company_b.intercompany_sale_user_id = cls.intercompany_sale_user_id + + # Configure User + cls._configure_user(cls.user_company_a) + cls._configure_user(cls.user_company_b) + + # Create purchase order + cls.purchase_company_a = cls._create_purchase_order(cls.partner_company_b) + + # Create account + income_account = cls.env["account.account"].create( + { + "name": "test_account_income", + "code": "987", + "account_type": "income", + "company_id": cls.company_b.id, + } + ) + expense_account = cls.env["account.account"].create( + { + "name": "test account_expenses", + "code": "765", + "account_type": "expense", + "reconcile": True, + "company_id": cls.company_a.id, + } + ) + # Create journal + cls.env["account.journal"].create( + { + "name": "Customer Invoices - Test", + "code": "TEST1", + "type": "sale", + "company_id": cls.company_b.id, + "default_account_id": income_account.id, + } + ) + cls.env["account.journal"].create( + { + "name": "Vendor Bills - Test", + "code": "TEST2", + "type": "purchase", + "company_id": cls.company_a.id, + "default_account_id": expense_account.id, + } + ) + + def _approve_po(self): + """Confirm the PO in company A and return the related sale of Company B""" + parnter_company = self.purchase_company_a.company_id.partner_id.company_id + assert not parnter_company, ( + "The partner should not have a company set, otherwise the " + "intercompany_sale_order_id will not be computed properly. Current " + f"partner company_id: {parnter_company.name}" + ) + self.purchase_company_a.with_user(self.user_company_a).button_approve() + return ( + self.env["sale.order"] + .with_user(self.user_company_b) + .search([("auto_purchase_order_id", "=", self.purchase_company_a.id)]) + ) + + def test_purchase_sale_inter_company(self): + self.purchase_company_a.notes = "Test note" + sale = self._approve_po() + self.assertEqual(len(sale), 1) + self.assertEqual(sale.state, "sale") + self.assertEqual(sale.partner_id, self.partner_company_a) + self.assertEqual(len(sale.order_line), len(self.purchase_company_a.order_line)) + self.assertEqual(sale.order_line.product_id, self.product) + self.assertEqual(str(sale.note), "

Test note

") + + def test_not_auto_validate(self): + self.company_b.sale_auto_validation = False + sale = self._approve_po() + self.assertEqual(sale.state, "draft") + + # TODO FIXME + def xxtest_date_planned(self): + # Install sale_order_dates module + module = self.env["ir.module.module"].search( + [("name", "=", "sale_order_dates")] + ) + if not module: + return False + module.button_install() + self.purchase_company_a.date_planned = "2070-12-31" + sale = self._approve_po() + self.assertEqual(sale.requested_date, "2070-12-31") + + def test_raise_product_access(self): + product_rule = self.env.ref("product.product_comp_rule") + product_rule.active = True + # if product_multi_company is installed + if "company_ids" in self.env["product.template"]._fields: + self.product.company_ids = [(6, 0, [self.company_a.id])] + self.product.company_id = self.company_a + with self.assertRaises(UserError): + self._approve_po() + + def test_raise_currency(self): + currency = self.env.ref("base.EUR") + self.purchase_company_a.currency_id = currency + with self.assertRaises(UserError): + self._approve_po() + + def test_purchase_invoice_relation(self): + self.partner_company_a.company_id = False + self.partner_company_b.company_id = False + sale = self._approve_po() + sale_invoice = sale._create_invoices()[0] + sale_invoice.action_post() + self.assertEqual(len(self.purchase_company_a.invoice_ids), 1) + self.assertEqual( + self.purchase_company_a.invoice_ids.auto_invoice_id, + sale_invoice, + ) + self.assertEqual(len(self.purchase_company_a.order_line.invoice_lines), 1) + self.assertEqual(self.purchase_company_a.order_line.qty_invoiced, 3) + + def test_cancel(self): + self.company_b.sale_auto_validation = False + sale = self._approve_po() + self.assertEqual(self.purchase_company_a.partner_ref, sale.name) + self.purchase_company_a.with_user(self.user_company_a).button_cancel() + self.assertFalse(self.purchase_company_a.partner_ref) + self.assertEqual(sale.state, "cancel") + + def test_cancel_confirmed_po_so(self): + self.company_b.sale_auto_validation = True + self._approve_po() + with self.assertRaises(UserError): + self.purchase_company_a.with_user(self.user_company_a).button_cancel() + + def test_so_change_price(self): + self.company_b.sale_auto_validation = False + sale = self._approve_po() + sale.order_line.price_unit = 10 + sale.action_confirm() + self.assertEqual(self.purchase_company_a.order_line.price_unit, 10) + + def test_po_with_contact_as_partner(self): + contact = self.env["res.partner"].create( + {"name": "Test contact", "parent_id": self.partner_company_b.id} + ) + self.purchase_company_a = self._create_purchase_order(contact) + sale = self._approve_po() + self.assertEqual(len(sale), 1) + self.assertEqual(sale.state, "sale") + self.assertEqual(sale.partner_id, self.partner_company_a) + + def test_update_open_sale_order(self): + """ + When the purchase user request extra product, the sale order gets synched if + it's open. + """ + self.company_b.sale_auto_validation = False + purchase = self.purchase_company_a + sale = self._approve_po() + sale.action_confirm() + # Now we add an extra product to the PO and it will show up in the SO + po_form = Form(purchase) + with po_form.order_line.new() as line: + line.product_id = self.service_product_2 + line.product_qty = 6 + po_form.save() + # It's synched and the values match + synched_order_line = sale.order_line.filtered( + lambda x: x.product_id == self.service_product_2 + ) + self.assertTrue( + bool(synched_order_line), + "The line should have been created in the sale order", + ) + self.assertEqual( + synched_order_line.product_uom_qty, + 6, + "The quantity should be equal to the one set in the purchase order", + ) + # The quantity is synched as well + purchase_line = purchase.order_line.filtered( + lambda x: x.product_id == self.service_product_2 + ).sudo() + purchase_line.product_qty = 8 + self.assertEqual( + synched_order_line.product_uom_qty, + 8, + "The quantity should be equal to the one set in the purchase order", + ) + # Let's decrease the quantity + purchase_line.product_qty = 3 + self.assertEqual( + synched_order_line.product_uom_qty, + 3, + "The quantity should decrease as it was in the purchase order", + ) + + def test_default_intercompany_sale_user_id(self): + """ + When the intercompany_sale_user_id is not set, the current user that creates the + purchase order is used, this impacts the salesperson value on the sale order. + Following the _compute_user_id method on sale.order model, if there is no + salesperson set, the salesperson will be the user set on the Sale's customer, + or customer's company, or the current user if he is a salesman. + """ + self.company_b.intercompany_sale_user_id = False + self.company_b.sale_auto_validation = False + sale = self._approve_po() + self.assertEqual(sale.create_uid, self.user_company_a) + self.assertNotEqual(sale.user_id, self.user_company_b) + expected_salesperson = ( + sale.partner_id.user_id + or sale.partner_id.parent_id.user_id + or ( + self.user_company_a + if self.user_company_a.has_group("sales_team.group_sale_manager") + else False + ) + ) + self.assertNotEqual(sale.user_id, expected_salesperson) + + def test_sale_order_line_note_sync(self): + """ + When a purchase order line has a note, it should be copied to the sale order + line. + """ + self.purchase_company_a.order_line = [ + (0, 0, {"name": "Test Note", "display_type": "line_note", "product_qty": 0}) + ] + sale = self._approve_po() + self.assertEqual( + sale.order_line.filtered(lambda x: x.display_type == "line_note").name, + "Test Note", + ) + + def test_cannot_modify_pol_of_related_so_is_cancel(self): + """ + When the related sale order is cancel, the purchase order lines cannot be + created or modified. + """ + self.company_b.sale_auto_validation = False + sale = self._approve_po() + sale.action_confirm() + purchase_line = self.purchase_company_a.order_line + sale._action_cancel() + with self.assertRaises(UserError): + purchase_line[0].product_qty = 5 + with self.assertRaises(UserError): + self.env["purchase.order.line"].create( + { + "order_id": self.purchase_company_a.id, + "product_id": self.service_product_2.id, + "product_qty": 5, + "name": "Test", + } + ) + sale.action_draft() + sale.action_confirm() + purchase_line[0].product_qty = 5 + self.env["purchase.order.line"].create( + { + "order_id": self.purchase_company_a.id, + "product_id": self.service_product_2.id, + "product_qty": 5, + "name": "Test", + } + ) diff --git a/purchase_sale_inter_company/views/res_config_view.xml b/purchase_sale_inter_company/views/res_config_view.xml new file mode 100644 index 00000000000..2a42c9c5c39 --- /dev/null +++ b/purchase_sale_inter_company/views/res_config_view.xml @@ -0,0 +1,42 @@ + + + + res.config.settings + + + +
Purchase / Sale
+
+
+
+
+
+
+
+
+
+