Skip to content

Commit

Permalink
Merge PR #162 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rousseldenis
  • Loading branch information
OCA-git-bot committed Jan 20, 2025
2 parents 85ff52e + b48d405 commit 72b443c
Show file tree
Hide file tree
Showing 16 changed files with 701 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_location_address/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,
)
86 changes: 86 additions & 0 deletions stock_location_address/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
======================
Stock Location address
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2ddab809c43b89c0fa4cd0a76b38bf4156e6b8b440058ee2b8bf9f4b4057368f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fstock--logistics--transport-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-transport/tree/16.0/stock_location_address
:alt: OCA/stock-logistics-transport
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-transport-16-0/stock-logistics-transport-16-0-stock_location_address
: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/stock-logistics-transport&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds an address on location so it can be used on purchases.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module you have to activate storage locations, going to
Configuration > settings > and activate Storage Locations.
then,
Go to 'Inventory > Settings > Locations' and select an address for the location.
If no address is selected, parent address will be used.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-transport/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 <https://github.com/OCA/stock-logistics-transport/issues/new?body=module:%20stock_location_address%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Creu Blanca

Contributors
~~~~~~~~~~~~

* Enric Tobella <etobella@creublanca.es>
* Joan Mateu <joan.mateu@forgeflow.com>

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/stock-logistics-transport <https://github.com/OCA/stock-logistics-transport/tree/16.0/stock_location_address>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_location_address/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions stock_location_address/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2018 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Stock Location address",
"summary": "Adds an address on locations",
"version": "16.0.1.0.0",
"author": "Creu Blanca, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-transport",
"category": "Warehouse Management",
"depends": ["stock"],
"data": ["views/stock_location_views.xml"],
"license": "AGPL-3",
"installable": True,
"application": False,
}
30 changes: 30 additions & 0 deletions stock_location_address/i18n/stock_location_address.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_location_address
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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: stock_location_address
#: model:ir.model.fields,field_description:stock_location_address.field_stock_location__address_id
#: model_terms:ir.ui.view,arch_db:stock_location_address.view_location_form
msgid "Address"
msgstr ""

#. module: stock_location_address
#: model:ir.model,name:stock_location_address.model_stock_location
msgid "Inventory Locations"
msgstr ""

#. module: stock_location_address
#: model:ir.model.fields,field_description:stock_location_address.field_stock_location__real_address_id
msgid "Real Address"
msgstr ""
1 change: 1 addition & 0 deletions stock_location_address/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_location
38 changes: 38 additions & 0 deletions stock_location_address/models/stock_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2018 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class StockLocation(models.Model):
_inherit = "stock.location"

address_id = fields.Many2one(comodel_name="res.partner", string="Address")
real_address_id = fields.Many2one(
comodel_name="res.partner",
string="Real Address",
compute="_compute_real_address_id",
recursive=True,
)

def _get_parent_address(self):
"""Recursively fetches the address from parent locations."""
if self.location_id and self.location_id.address_id:
return self.location_id.address_id
elif self.location_id:
return self.location_id._get_parent_address()
else:
return self.env["res.partner"].browse()

@api.depends("address_id", "location_id", "location_id.address_id")
def _compute_real_address_id(self):
"""
Computes the real_address_id field.
If the current location has an address, use it.
Otherwise, inherit from the nearest parent location.
"""
for record in self:
if record.address_id:
record.real_address_id = record.address_id
else:
record.real_address_id = record._get_parent_address()
2 changes: 2 additions & 0 deletions stock_location_address/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Enric Tobella <etobella@creublanca.es>
* Joan Mateu <joan.mateu@forgeflow.com>
1 change: 1 addition & 0 deletions stock_location_address/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds an address on location so it can be used on purchases.
5 changes: 5 additions & 0 deletions stock_location_address/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module you have to activate storage locations, going to
Configuration > settings > and activate Storage Locations.
then,
Go to 'Inventory > Settings > Locations' and select an address for the location.
If no address is selected, parent address will be used.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 72b443c

Please sign in to comment.