Skip to content

Commit

Permalink
Merge pull request #19 from qrtl/16.0-add-stock_storage
Browse files Browse the repository at this point in the history
[3104][ADD] stock_product_shelfinfo
  • Loading branch information
kanda999 authored Mar 23, 2023
2 parents 506b9dd + d393d76 commit 1462fa1
Show file tree
Hide file tree
Showing 20 changed files with 1,010 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_product_shelfinfo/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,
)
65 changes: 65 additions & 0 deletions stock_product_shelfinfo/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
===============================
Stock Product Shelf Information
===============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-qrtl%2Faxls--custom-lightgray.png?logo=github
:target: https://github.com/qrtl/axls-custom/tree/16.0/stock_product_shelfinfo
:alt: qrtl/axls-custom

|badge1| |badge2| |badge3|

This module adds a new model Product Shelf Information (product.shelfinfo) to keep
the static shelf details per product per location, and show the information in
relevant transactions and reports to facilitate warehouse operations.

**Table of contents**

.. contents::
:local:

Usage
=====

Go to *Inventory > Products > Product Shelf Information* and create records for
combinations of product, location and company. These records show in product forms
(Inventory tab) as well.

Generated ID (name) of the Shelf Information record should show for relevant internal
locations in the stock move records of the picking form, as well as in the picking
report, to facilitate the picking/store operations.

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

Bugs are tracked on `GitHub Issues <https://github.com/qrtl/axls-custom/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/qrtl/axls-custom/issues/new?body=module:%20stock_product_shelfinfo%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
~~~~~~~

* Quartile Limited

Maintainers
~~~~~~~~~~~

This module is part of the `qrtl/axls-custom <https://github.com/qrtl/axls-custom/tree/16.0/stock_product_shelfinfo>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions stock_product_shelfinfo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions stock_product_shelfinfo/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Product Shelf Information",
"version": "16.0.1.0.0",
"author": "Quartile Limited",
"website": "https://www.quartile.co",
"category": "Warehouse",
"license": "AGPL-3",
"depends": ["stock"],
"data": [
"security/ir.model.access.csv",
"security/product_shelfinfo_security.xml",
"reports/report_stockpicking_operations.xml",
"views/product_shelfinfo_views.xml",
"views/product_template_views.xml",
"views/stock_picking_views.xml",
],
"installable": True,
}
163 changes: 163 additions & 0 deletions stock_product_shelfinfo/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_product_shelfinfo
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-20 05:24+0000\n"
"PO-Revision-Date: 2023-03-20 05:24+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: stock_product_shelfinfo
#. odoo-python
#: code:addons/stock_product_shelfinfo/models/product_shelfinfo.py:0
#, python-format
msgid ""
"Another record already exists for the given combination of product, location"
" and company."
msgstr "そのプロダクト、ロケーション、会社の組み合わせに対するレコードは既に存在しています。"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__area1
msgid "Area1"
msgstr "場所1"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__area2
msgid "Area2"
msgstr "場所2"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__company_id
msgid "Company"
msgstr "会社"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__create_uid
msgid "Created by"
msgstr "作成者"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__create_date
msgid "Created on"
msgstr "作成日"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__display_name
msgid "Display Name"
msgstr "表示名"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__name
msgid "Generated ID"
msgstr "生成されたID"

#. module: stock_product_shelfinfo
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Group By"
msgstr "グループ化"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__id
msgid "ID"
msgstr "ID"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__ref
msgid "Internal Reference"
msgstr "内部参照"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo____last_update
msgid "Last Modified on"
msgstr "最終更新日"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__write_uid
msgid "Last Updated by"
msgstr "最終更新者"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__write_date
msgid "Last Updated on"
msgstr "最終更新日"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__location_id
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Location"
msgstr "ロケーション"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__memo
msgid "Memo"
msgstr "メモ"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__position
msgid "Position"
msgstr "位置"

#. module: stock_product_shelfinfo
#: model:ir.model,name:stock_product_shelfinfo.model_product_template
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__product_id
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Product"
msgstr "プロダクト"

#. module: stock_product_shelfinfo
#: model:ir.actions.act_window,name:stock_product_shelfinfo.action_product_shelfinfo_view
#: model:ir.ui.menu,name:stock_product_shelfinfo.menu_product_shelfinfo
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.view_product_shelfinfo_form
msgid "Product Shelf Information"
msgstr "棚情報"

#. module: stock_product_shelfinfo
#: model:ir.model,name:stock_product_shelfinfo.model_product_shelfinfo
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Product Shelfinfo"
msgstr "棚情報"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__product_tmpl_id
msgid "Product Template"
msgstr "プロダクトテンプレート"

#. module: stock_product_shelfinfo
#: model:ir.model,name:stock_product_shelfinfo.model_product_product
msgid "Product Variant"
msgstr "プロダクトバリアント"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__sequence
msgid "Sequence"
msgstr "シークエンス"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_stock_move__shelfinfo_src_id
msgid "Shelf Info. (From)"
msgstr "棚情報(移動元)"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_stock_move__shelfinfo_dest_id
msgid "Shelf Info. (To)"
msgstr "棚情報(移動先)"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_product__shelfinfo_ids
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_template__shelfinfo_ids
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_template_form_view
msgid "Shelf Information"
msgstr "棚情報"

#. module: stock_product_shelfinfo
#: model:ir.model,name:stock_product_shelfinfo.model_stock_move
msgid "Stock Move"
msgstr "在庫移動"
4 changes: 4 additions & 0 deletions stock_product_shelfinfo/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import product_product
from . import product_shelfinfo
from . import product_template
from . import stock_move
14 changes: 14 additions & 0 deletions stock_product_shelfinfo/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductProduct(models.Model):
_inherit = "product.product"

shelfinfo_ids = fields.One2many(
"product.shelfinfo",
"product_id",
string="Shelf Information",
)
70 changes: 70 additions & 0 deletions stock_product_shelfinfo/models/product_shelfinfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class ProductShelfinfo(models.Model):
_name = "product.shelfinfo"
_description = "Product Shelfinfo"
_order = "sequence"

name = fields.Char("Generated ID", compute="_compute_name")
product_id = fields.Many2one(
"product.product",
required=True,
domain="[('detailed_type', '!=', 'service')]",
)
product_tmpl_id = fields.Many2one(
"product.template",
related="product_id.product_tmpl_id",
store=True,
)
location_id = fields.Many2one(
"stock.location",
required=True,
domain="[('usage', '=', 'internal')]",
)
company_id = fields.Many2one(
"res.company",
default=lambda self: self.env.company,
required=True,
)
area1 = fields.Char(required=True)
area2 = fields.Char()
position = fields.Char()
memo = fields.Char()
ref = fields.Char("Internal Reference")
sequence = fields.Integer(default=1)

@api.constrains("product_id", "location_id", "company_id")
def _check_product_location_unique(self):
for record in self:
existing_rec = self.search(
[
("product_id", "=", record.product_id.id),
("location_id", "=", record.location_id.id),
("company_id", "=", record.company_id.id),
("id", "!=", self.id),
]
)
if existing_rec:
raise ValidationError(
_(
"Another record already exists for the given combination of "
"product, location and company."
)
)

@api.depends("area1", "area2", "position")
def _compute_name(self):
for record in self:
record.name = record.area1
record.name = ""
if record.area1:
record.name += record.area1
if record.area2:
record.name += "-" + record.area2
if record.position:
record.name += "-" + record.position
14 changes: 14 additions & 0 deletions stock_product_shelfinfo/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

shelfinfo_ids = fields.One2many(
"product.shelfinfo",
"product_tmpl_id",
string="Shelf Information",
)
Loading

0 comments on commit 1462fa1

Please sign in to comment.