Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] purchase_order_type: picking_type_id #1692

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions purchase_order_type/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Contributors

* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Carlos Reyes <carlos@studio73.es>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion purchase_order_type/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"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",
Expand Down
44 changes: 17 additions & 27 deletions purchase_order_type/i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_type
# * purchase_order_type
#
# Translators:
# Ahmet Altinisik <aaltinisik@altinkaya.com.tr>, 2016
# Ahmet Altinisik <aaltinisik@altinkaya.com.tr>, 2016
# Antonio Trueba, 2016
# Armando Vulcano Junior <vulcano@uol.com.br>, 2015
# Carles Antoli <carlesantoli@hotmail.com>, 2015
# Carles Antoli <carlesantoli@hotmail.com>, 2015
# danimaribeiro <danimaribeiro@gmail.com>, 2016
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012
# Kostas Goutoudis <goutoudis@gmail.com>, 2015
# Kostas Goutoudis <goutoudis@gmail.com>, 2015
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015-2016
# Paolo Valier, 2016
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2015
# Rudolf Schnapka <rs@techno-flex.de>, 2016
# SaFi J. <safi2266@gmail.com>, 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: 2024-04-16 19:34+0000\n"
Expand Down Expand Up @@ -53,7 +37,7 @@ msgstr "Haga clic para establecer un nuevo tipo de orden de compra."
#: 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 "Companía"
msgstr "Compañía"

#. module: purchase_order_type
#: model:ir.model,name:purchase_order_type.model_res_partner
Expand Down Expand Up @@ -84,6 +68,7 @@ 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 ""
Expand All @@ -94,19 +79,19 @@ msgstr ""
#: 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 "Secuencia de Entrada"
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 "Agrupado Por"
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
Expand Down Expand Up @@ -139,31 +124,36 @@ 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 "Término de Pago"
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 "Términos del Pago"
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 "Tipo de Orden de Compra"
msgstr "Tipo de pedido de compra"

#. module: purchase_order_type
#: model:ir.actions.act_window,name:purchase_order_type.action_purchase_order_type_view
#: model:ir.ui.menu,name:purchase_order_type.menu_purchase_order_type
#: model_terms:ir.ui.view,arch_db:purchase_order_type.view_purchase_order_type_search
msgid "Purchase Order Types"
msgstr "Tipos de Orden de Compra"
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
Expand Down
8 changes: 8 additions & 0 deletions purchase_order_type/i18n/purchase_order_type.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""
Expand Down Expand Up @@ -142,6 +145,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"
Expand Down
9 changes: 8 additions & 1 deletion purchase_order_type/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions purchase_order_type/models/purchase_order_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
1 change: 1 addition & 0 deletions purchase_order_type/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Carlos Reyes <carlos@studio73.es>
5 changes: 5 additions & 0 deletions purchase_order_type/tests/test_purchase_order_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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, self.type2)
order.write({"order_type": False})
Expand Down
1 change: 1 addition & 0 deletions purchase_order_type/views/view_purchase_order_type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<group>
<group>
<field name="sequence_id" />
<field name="picking_type_id" />
<field
name="company_id"
groups="base.group_multi_company"
Expand Down
Loading