Skip to content

Commit

Permalink
[16.0][ADD] purchase_stock_picking_type_location_src: In purchase ord…
Browse files Browse the repository at this point in the history
…er if the picking type has a default source location defined, use that location to create the picking.
  • Loading branch information
alfredoavanzosc committed Dec 5, 2024
1 parent 94fd724 commit ddcbe08
Show file tree
Hide file tree
Showing 14 changed files with 301 additions and 0 deletions.
29 changes: 29 additions & 0 deletions purchase_stock_picking_type_location_src/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

========================================
Purchase Stock Picking Type Location Src
========================================

* When creating a picking from a purchase order, if the picking type has a
default source location defined, use that location to create the picking.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

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

Credits
=======

Contributors
------------

* Ana Juaristi <anajuaristi@avanzosc.es>
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
1 change: 1 addition & 0 deletions purchase_stock_picking_type_location_src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions purchase_stock_picking_type_location_src/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Purchase Stock Picking Type Location Src",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Avanzosc",
"category": "Inventory/Purchase",
"website": "https://github.com/avanzosc/odoo-addons",
"depends": ["purchase", "stock"],
"data": [],
"installable": True,
}
36 changes: 36 additions & 0 deletions purchase_stock_picking_type_location_src/i18n/en_US.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_type_location_src
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-03 10:36+0000\n"
"PO-Revision-Date: 2024-12-03 10:36+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__display_name
msgid "Display Name"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__id
msgid "ID"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order____last_update
msgid "Last Modified on"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model,name:purchase_stock_picking_type_location_src.model_purchase_order
msgid "Purchase Order"
msgstr ""
36 changes: 36 additions & 0 deletions purchase_stock_picking_type_location_src/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_type_location_src
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-03 10:37+0000\n"
"PO-Revision-Date: 2024-12-03 10:37+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__display_name
msgid "Display Name"
msgstr "Nombre mostrado"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__id
msgid "ID"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order____last_update
msgid "Last Modified on"
msgstr "Última modificación el"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model,name:purchase_stock_picking_type_location_src.model_purchase_order
msgid "Purchase Order"
msgstr "Pedido de compra"
36 changes: 36 additions & 0 deletions purchase_stock_picking_type_location_src/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_type_location_src
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-03 10:36+0000\n"
"PO-Revision-Date: 2024-12-03 10:36+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__id
msgid "ID"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model,name:purchase_stock_picking_type_location_src.model_purchase_order
msgid "Purchase Order"
msgstr "Ordine di acquisto"
36 changes: 36 additions & 0 deletions purchase_stock_picking_type_location_src/i18n/pt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_type_location_src
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-03 10:36+0000\n"
"PO-Revision-Date: 2024-12-03 10:36+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__display_name
msgid "Display Name"
msgstr "Nome"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__id
msgid "ID"
msgstr "Id."

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order____last_update
msgid "Last Modified on"
msgstr "Última Modificação em"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model,name:purchase_stock_picking_type_location_src.model_purchase_order
msgid "Purchase Order"
msgstr "Ordem de Compra"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_type_location_src
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-03 10:35+0000\n"
"PO-Revision-Date: 2024-12-03 10:35+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__display_name
msgid "Display Name"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__id
msgid "ID"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order____last_update
msgid "Last Modified on"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model,name:purchase_stock_picking_type_location_src.model_purchase_order
msgid "Purchase Order"
msgstr ""
36 changes: 36 additions & 0 deletions purchase_stock_picking_type_location_src/i18n/zh_CN.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_type_location_src
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-03 10:35+0000\n"
"PO-Revision-Date: 2024-12-03 10:35+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__display_name
msgid "Display Name"
msgstr "显示名称"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order__id
msgid "ID"
msgstr ""

#. module: purchase_stock_picking_type_location_src
#: model:ir.model.fields,field_description:purchase_stock_picking_type_location_src.field_purchase_order____last_update
msgid "Last Modified on"
msgstr "最后修改日"

#. module: purchase_stock_picking_type_location_src
#: model:ir.model,name:purchase_stock_picking_type_location_src.model_purchase_order
msgid "Purchase Order"
msgstr "采购订单"
2 changes: 2 additions & 0 deletions purchase_stock_picking_type_location_src/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import purchase_order
from . import purchase_order_line
13 changes: 13 additions & 0 deletions purchase_stock_picking_type_location_src/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

def _prepare_picking(self):
result = super(PurchaseOrder, self)._prepare_picking()
if self.picking_type_id.default_location_src_id:
result["location_id"] = self.picking_type_id.default_location_src_id.id
return result
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

def _prepare_stock_move_vals(
self, picking, price_unit, product_uom_qty, product_uom
):
self.ensure_one()
vals = super(PurchaseOrderLine, self)._prepare_stock_move_vals(
picking, price_unit, product_uom_qty, product_uom
)
if self.order_id.picking_type_id.default_location_src_id:
vals[
"location_id"
] = self.order_id.picking_type_id.default_location_src_id.id
return vals
6 changes: 6 additions & 0 deletions setup/purchase_stock_picking_type_location_src/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit ddcbe08

Please sign in to comment.