diff --git a/purchase_order_type/README.rst b/purchase_order_type/README.rst index e1941f4d782..78291991987 100644 --- a/purchase_order_type/README.rst +++ b/purchase_order_type/README.rst @@ -23,7 +23,7 @@ Purchase Order Type :target: https://runbot.odoo-community.org/runbot/142/14.0 :alt: Try me on Runbot -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| Adds a configurable *type* on the purchase orders. This type can be used in filters and groupbys. @@ -76,6 +76,7 @@ Contributors * Guewen Baconnier * Pimolnat Suntian +* Carlos Reyes Maintainers ~~~~~~~~~~~ diff --git a/purchase_order_type/__manifest__.py b/purchase_order_type/__manifest__.py index 0b7073e8885..e8f21719e01 100644 --- a/purchase_order_type/__manifest__.py +++ b/purchase_order_type/__manifest__.py @@ -3,11 +3,11 @@ { "name": "Purchase Order Type", - "version": "14.0.1.0.2", + "version": "14.0.1.1.0", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Purchase Management", - "depends": ["purchase"], + "depends": ["purchase", "stock"], "website": "https://github.com/OCA/purchase-workflow", "data": [ "security/ir.model.access.csv", diff --git a/purchase_order_type/i18n/es.po b/purchase_order_type/i18n/es.po index e471289b2ed..8253ec0d9bc 100644 --- a/purchase_order_type/i18n/es.po +++ b/purchase_order_type/i18n/es.po @@ -1,37 +1,19 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * purchase_order_type +# * purchase_order_type # -# Translators: -# Ahmet Altinisik , 2016 -# Ahmet Altinisik , 2016 -# Antonio Trueba, 2016 -# Armando Vulcano Junior , 2015 -# Carles Antoli , 2015 -# Carles Antoli , 2015 -# danimaribeiro , 2016 -# FIRST AUTHOR , 2012 -# Kostas Goutoudis , 2015 -# Kostas Goutoudis , 2015 -# Matjaž Mozetič , 2015-2016 -# Paolo Valier, 2016 -# Pedro M. Baeza , 2015 -# Rudolf Schnapka , 2016 -# SaFi J. , 2015 msgid "" msgstr "" -"Project-Id-Version: purchase-workflow (8.0)\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-16 12:06+0000\n" -"PO-Revision-Date: 2016-11-25 14:55+0000\n" -"Last-Translator: OCA Transbot \n" -"Language-Team: Spanish (http://www.transifex.com/oca/OCA-purchase-" -"workflow-8-0/language/es/)\n" -"Language: es\n" +"POT-Creation-Date: 2023-01-02 07:41+0000\n" +"PO-Revision-Date: 2023-01-02 07:41+0000\n" +"Last-Translator: \n" +"Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: \n" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__active @@ -46,18 +28,18 @@ msgstr "" #. module: purchase_order_type #: model_terms:ir.actions.act_window,help:purchase_order_type.action_purchase_order_type_view msgid "Click to set a new type for purchase order." -msgstr "" +msgstr "Haz click para fijar un nuevo tipo para los pedidos de compra" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__company_id #: model_terms:ir.ui.view,arch_db:purchase_order_type.view_purchase_order_type_search msgid "Company" -msgstr "" +msgstr "Compañía" #. module: purchase_order_type #: model:ir.model,name:purchase_order_type.model_res_partner msgid "Contact" -msgstr "" +msgstr "Contacto" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__create_uid @@ -72,7 +54,7 @@ msgstr "Creado en" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__description msgid "Description" -msgstr "" +msgstr "Descripción" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order__display_name @@ -83,27 +65,28 @@ msgstr "Nombre mostrado" #. module: purchase_order_type #: code:addons/purchase_order_type/models/purchase_order.py:0 +#: code:addons/purchase_order_type/models/purchase_order.py:0 #, python-format msgid "Document's company and type's company mismatch" -msgstr "" +msgstr "Documentos de la compañía y tipos de compañía no coinciden" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__sequence_id #: model_terms:ir.ui.view,arch_db:purchase_order_type.view_purchase_order_type_search msgid "Entry Sequence" -msgstr "" +msgstr "Secuencia de entrada" #. module: purchase_order_type #: model_terms:ir.ui.view,arch_db:purchase_order_type.view_purchase_order_type_search msgid "Group By" -msgstr "" +msgstr "Agrupar por" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order__id #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__id #: model:ir.model.fields,field_description:purchase_order_type.field_res_partner__id msgid "ID" -msgstr "ID" +msgstr "" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__incoterm_id @@ -136,24 +119,24 @@ msgstr "Nombre" #. module: purchase_order_type #: model_terms:ir.ui.view,arch_db:purchase_order_type.view_purchase_order_type_search msgid "Payment Term" -msgstr "" +msgstr "Plazo de pago" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__payment_term_id msgid "Payment Terms" -msgstr "" +msgstr "Plazos de pago" #. module: purchase_order_type #: model:ir.model,name:purchase_order_type.model_purchase_order msgid "Purchase Order" -msgstr "Orden de Compra" +msgstr "Pedido de compra" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_res_partner__purchase_type #: model:ir.model.fields,field_description:purchase_order_type.field_res_users__purchase_type #: model_terms:ir.ui.view,arch_db:purchase_order_type.res_partner_purchase_type_form_view msgid "Purchase Order Type" -msgstr "" +msgstr "Tipo de pedido de compra" #. module: purchase_order_type #: model:ir.actions.act_window,name:purchase_order_type.action_purchase_order_type_view @@ -161,12 +144,17 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:purchase_order_type.view_purchase_order_type_search #: model_terms:ir.ui.view,arch_db:purchase_order_type.view_purchase_order_type_tree msgid "Purchase Order Types" -msgstr "" +msgstr "Tipos de pedido de compra" + +#. module: purchase_order_type +#: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__picking_type_id +msgid "Send to" +msgstr "Entregar a" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__sequence msgid "Sequence" -msgstr "" +msgstr "Secuencia" #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order__order_type @@ -177,12 +165,5 @@ msgstr "Tipo" #. module: purchase_order_type #: model:ir.model,name:purchase_order_type.model_purchase_order_type -#, fuzzy msgid "Type of purchase order" msgstr "Orden de Compra" - -#~ msgid "Create Invoice" -#~ msgstr "Crear factura" - -#~ msgid "Partner" -#~ msgstr "Empresa" diff --git a/purchase_order_type/i18n/purchase_order_type.pot b/purchase_order_type/i18n/purchase_order_type.pot index aad8ed5fe8f..20ee832be98 100644 --- a/purchase_order_type/i18n/purchase_order_type.pot +++ b/purchase_order_type/i18n/purchase_order_type.pot @@ -6,6 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-01-02 07:40+0000\n" +"PO-Revision-Date: 2023-01-02 07:40+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -63,6 +65,7 @@ msgstr "" #. module: purchase_order_type #: code:addons/purchase_order_type/models/purchase_order.py:0 +#: code:addons/purchase_order_type/models/purchase_order.py:0 #, python-format msgid "Document's company and type's company mismatch" msgstr "" @@ -143,6 +146,11 @@ msgstr "" msgid "Purchase Order Types" msgstr "" +#. module: purchase_order_type +#: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__picking_type_id +msgid "Send to" +msgstr "" + #. module: purchase_order_type #: model:ir.model.fields,field_description:purchase_order_type.field_purchase_order_type__sequence msgid "Sequence" diff --git a/purchase_order_type/models/purchase_order.py b/purchase_order_type/models/purchase_order.py index 5bd34432826..6957cd7bd8a 100644 --- a/purchase_order_type/models/purchase_order.py +++ b/purchase_order_type/models/purchase_order.py @@ -27,7 +27,12 @@ def onchange_partner_id(self): or self.partner_id.commercial_partner_id.purchase_type ) if purchase_type: - self.order_type = purchase_type + self.write( + { + "order_type": purchase_type.id, + "picking_type_id": purchase_type.picking_type_id.id, + } + ) @api.onchange("order_type") def onchange_order_type(self): @@ -36,6 +41,8 @@ def onchange_order_type(self): order.payment_term_id = order.order_type.payment_term_id.id if order.order_type.incoterm_id: order.incoterm_id = order.order_type.incoterm_id.id + if order.order_type.picking_type_id: + order.picking_type_id = order.order_type.picking_type_id.id @api.model def create(self, vals): @@ -63,3 +70,5 @@ def _default_order_type(self): @api.onchange("company_id") def _onchange_company(self): self.order_type = self._default_order_type() + if self.order_type: + self.picking_type_id = self.order_type.picking_type_id.id diff --git a/purchase_order_type/models/purchase_order_type.py b/purchase_order_type/models/purchase_order_type.py index c97f000ef04..cd178f45a88 100644 --- a/purchase_order_type/models/purchase_order_type.py +++ b/purchase_order_type/models/purchase_order_type.py @@ -43,3 +43,6 @@ def _default_sequence_id(self): string="Company", default=lambda self: self.env.company, ) + picking_type_id = fields.Many2one( + comodel_name="stock.picking.type", string="Send to" + ) diff --git a/purchase_order_type/readme/CONTRIBUTORS.rst b/purchase_order_type/readme/CONTRIBUTORS.rst index 3b6c71a0f70..cd2d0ce495f 100644 --- a/purchase_order_type/readme/CONTRIBUTORS.rst +++ b/purchase_order_type/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Guewen Baconnier * Pimolnat Suntian +* Carlos Reyes diff --git a/purchase_order_type/tests/test_purchase_order_type.py b/purchase_order_type/tests/test_purchase_order_type.py index eb576f80c4d..3e1efa4e431 100644 --- a/purchase_order_type/tests/test_purchase_order_type.py +++ b/purchase_order_type/tests/test_purchase_order_type.py @@ -21,9 +21,12 @@ def setUpClass(cls): cls.product1 = cls.env.ref("product.product_product_7") cls.product2 = cls.env.ref("product.product_product_9") cls.product3 = cls.env.ref("product.product_product_11") + # Picking Type + cls.picking_type1 = cls.env.ref("stock.picking_type_in") # Purchase Type cls.type1 = cls.env.ref("purchase_order_type.po_type_regular") cls.type2 = cls.env.ref("purchase_order_type.po_type_planned") + cls.type2.write({"picking_type_id": cls.picking_type1.id}) # Payment Term cls.payterm = cls.env.ref("account.account_payment_term_immediate") # Incoterm @@ -42,6 +45,7 @@ def test_purchase_order_type(self): self.assertFalse(purchase.payment_term_id) purchase.onchange_partner_id() self.assertEqual(purchase.order_type, self.type2) + self.assertEqual(purchase.picking_type_id, self.picking_type1) purchase.onchange_order_type() self.assertEqual(purchase.incoterm_id, self.incoterm) self.assertEqual(purchase.payment_term_id, self.payterm) @@ -74,6 +78,7 @@ def test_purchase_order_change_company(self): order = self.po_obj.new({"partner_id": self.partner1.id}) order.onchange_partner_id() self.assertEqual(order.order_type, self.type2) + self.assertEqual(order.picking_type_id, self.picking_type1) order._onchange_company() self.assertEqual(order.order_type, order._default_order_type()) diff --git a/purchase_order_type/views/view_purchase_order_type.xml b/purchase_order_type/views/view_purchase_order_type.xml index 50a959b4468..491e0c3f7b2 100644 --- a/purchase_order_type/views/view_purchase_order_type.xml +++ b/purchase_order_type/views/view_purchase_order_type.xml @@ -37,6 +37,7 @@ +