Skip to content

Commit

Permalink
[3409][IMP] stock_product_shelfinfo: create new model area1 & area2 a…
Browse files Browse the repository at this point in the history
…nd change the fields type to many2one on product.shelfinfo model #24

[IMP] stock_product_shelfinfo: create new model area1 & area2 and change the fields type to many2one on product.shelfinfo model
  • Loading branch information
rinaldifirdaus authored May 9, 2023
1 parent 278506c commit 99ae12a
Show file tree
Hide file tree
Showing 17 changed files with 339 additions and 38 deletions.
7 changes: 7 additions & 0 deletions stock_product_shelfinfo/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ relevant transactions and reports to facilitate warehouse operations.
.. contents::
:local:

Configuration
=============

Go to the menu items under *Inventory > Settings > Product Shelf Info* and create
area 1, area 2 and position records to be selected in the product shelf information
accordingly.

Usage
=====

Expand Down
4 changes: 4 additions & 0 deletions stock_product_shelfinfo/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
"license": "AGPL-3",
"depends": ["stock"],
"data": [
"data/menuitem_data.xml",
"security/ir.model.access.csv",
"security/product_shelfinfo_security.xml",
"reports/report_stockpicking_operations.xml",
"views/product_shelf_area1_views.xml",
"views/product_shelf_area2_views.xml",
"views/product_shelf_position_views.xml",
"views/product_shelfinfo_views.xml",
"views/product_template_views.xml",
"views/stock_picking_views.xml",
Expand Down
9 changes: 9 additions & 0 deletions stock_product_shelfinfo/data/menuitem_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<menuitem
id="menu_stock_product_shelfinfo"
parent="stock.menu_stock_config_settings"
name="Product Shelf Info"
sequence="20"
/>
</odoo>
104 changes: 96 additions & 8 deletions stock_product_shelfinfo/i18n/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,49 @@ 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"
"POT-Creation-Date: 2023-05-07 02:02+0000\n"
"PO-Revision-Date: 2023-05-07 02:02+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
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area1__active
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2__active
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position__active
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__active
msgid "Active"
msgstr "有効"

#. 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 "そのプロダクト、ロケーション、会社の組み合わせに対するレコードは既に存在しています。"
msgstr "指定のプロダクト・ロケーション・会社の組み合わせで既にレコードが存在しています。"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__area1
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelf_area1_search_view
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelf_area2_search_view
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelf_position_search_view
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Archived"
msgstr "アーカイブ済"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__area1_id
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Area1"
msgstr "場所1"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__area2
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__area2_id
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Area2"
msgstr "場所2"

Expand All @@ -40,16 +58,25 @@ msgid "Company"
msgstr "会社"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area1__create_uid
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2__create_uid
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position__create_uid
#: 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_shelf_area1__create_date
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2__create_date
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position__create_date
#: 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_shelf_area1__display_name
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2__display_name
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position__display_name
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__display_name
msgid "Display Name"
msgstr "表示名"
Expand All @@ -65,26 +92,38 @@ msgid "Group By"
msgstr "グループ化"

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

#. 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_shelf_area1____last_update
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2____last_update
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position____last_update
#: 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_shelf_area1__write_uid
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2__write_uid
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position__write_uid
#: 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_shelf_area1__write_date
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2__write_date
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position__write_date
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__write_date
msgid "Last Updated on"
msgstr "最終更新日"
Expand All @@ -101,7 +140,15 @@ msgid "Memo"
msgstr "メモ"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__position
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area1__name
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_area2__name
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelf_position__name
msgid "Name"
msgstr "名称"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__position_id
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelfinfo_search_view
msgid "Position"
msgstr "位置"

Expand All @@ -112,13 +159,33 @@ msgstr "位置"
msgid "Product"
msgstr "プロダクト"

#. module: stock_product_shelfinfo
#: model:ir.model,name:stock_product_shelfinfo.model_product_shelf_area1
msgid "Product Shelf Area 1"
msgstr "プロダクト棚場所1"

#. module: stock_product_shelfinfo
#: model:ir.model,name:stock_product_shelfinfo.model_product_shelf_area2
msgid "Product Shelf Area 2"
msgstr "プロダクト棚場所2"

#. module: stock_product_shelfinfo
#: model:ir.ui.menu,name:stock_product_shelfinfo.menu_stock_product_shelfinfo
msgid "Product Shelf Info"
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_shelf_position
msgid "Product Shelf Position"
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
Expand All @@ -138,7 +205,21 @@ msgstr "プロダクトバリアント"
#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_product_shelfinfo__sequence
msgid "Sequence"
msgstr "シークエンス"
msgstr "順序"

#. module: stock_product_shelfinfo
#: model:ir.actions.act_window,name:stock_product_shelfinfo.action_product_shelf_area1_view
#: model:ir.ui.menu,name:stock_product_shelfinfo.menu_product_shelf_area1_config
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelf_area1_search_view
msgid "Shelf Area 1"
msgstr "棚場所1"

#. module: stock_product_shelfinfo
#: model:ir.actions.act_window,name:stock_product_shelfinfo.action_product_shelf_area2_view
#: model:ir.ui.menu,name:stock_product_shelfinfo.menu_product_shelf_area2_config
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelf_area2_search_view
msgid "Shelf Area 2"
msgstr "棚場所2"

#. module: stock_product_shelfinfo
#: model:ir.model.fields,field_description:stock_product_shelfinfo.field_stock_move__shelfinfo_src_id
Expand All @@ -157,6 +238,13 @@ msgstr "棚情報(移動先)"
msgid "Shelf Information"
msgstr "棚情報"

#. module: stock_product_shelfinfo
#: model:ir.actions.act_window,name:stock_product_shelfinfo.action_product_shelf_position_view
#: model:ir.ui.menu,name:stock_product_shelfinfo.menu_product_shelf_position_config
#: model_terms:ir.ui.view,arch_db:stock_product_shelfinfo.product_shelf_position_search_view
msgid "Shelf Position"
msgstr "棚位置"

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

from odoo import fields, models


class ProductShelfArea1(models.Model):
_name = "product.shelf.area1"
_description = "Product Shelf Area 1"
_order = "name"

name = fields.Char(required=True)
active = fields.Boolean(default=True)
13 changes: 13 additions & 0 deletions stock_product_shelfinfo/models/product_shelf_area2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductShelfArea2(models.Model):
_name = "product.shelf.area2"
_description = "Product Shelf Area 2"
_order = "name"

name = fields.Char(required=True)
active = fields.Boolean(default=True)
13 changes: 13 additions & 0 deletions stock_product_shelfinfo/models/product_shelf_position.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductShelfPosition(models.Model):
_name = "product.shelf.position"
_description = "Product Shelf Position"
_order = "name"

name = fields.Char(required=True)
active = fields.Boolean(default=True)
22 changes: 11 additions & 11 deletions stock_product_shelfinfo/models/product_shelfinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ class ProductShelfinfo(models.Model):
default=lambda self: self.env.company,
required=True,
)
area1 = fields.Char(required=True)
area2 = fields.Char()
position = fields.Char()
area1_id = fields.Many2one("product.shelf.area1", required=True)
area2_id = fields.Many2one("product.shelf.area2")
position_id = fields.Many2one("product.shelf.position")
memo = fields.Char()
ref = fields.Char("Internal Reference")
sequence = fields.Integer(default=1)
active = fields.Boolean(default=True)

@api.constrains("product_id", "location_id", "company_id")
def _check_product_location_unique(self):
Expand All @@ -57,14 +58,13 @@ def _check_product_location_unique(self):
)
)

@api.depends("area1", "area2", "position")
@api.depends("area1_id", "area2_id", "position_id")
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
if record.area1_id:
record.name += record.area1_id.name
if record.area2_id:
record.name += "-" + record.area2_id.name
if record.position_id:
record.name += "-" + record.position_id.name
3 changes: 3 additions & 0 deletions stock_product_shelfinfo/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Go to the menu items under *Inventory > Settings > Product Shelf Info* and create
area 1, area 2 and position records to be selected in the product shelf information
accordingly.
6 changes: 6 additions & 0 deletions stock_product_shelfinfo/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_shelfinfo_user,access.product.shelfinfo.user,model_product_shelfinfo,stock.group_stock_user,1,0,0,0
access_product_shelfinfo_manager,access.product.shelfinfo.manager,model_product_shelfinfo,stock.group_stock_manager,1,1,1,1
access_product_shelf_area1_user,access.product.shelf.area1.user,model_product_shelf_area1,stock.group_stock_user,1,0,0,0
access_product_shelf_area1_manager,access.product.shelf.area1.manager,model_product_shelf_area1,stock.group_stock_manager,1,1,1,1
access_product_shelf_area2_user,access.product.shelf.area2.user,model_product_shelf_area2,stock.group_stock_user,1,0,0,0
access_product_shelf_area2_manager,access.product.shelf.area2.manager,model_product_shelf_area2,stock.group_stock_manager,1,1,1,1
access_product_shelf_position_user,access.product.shelf.position.user,model_product_shelf_position,stock.group_stock_user,1,0,0,0
access_product_shelf_position_manager,access.product.shelf.position.manager,model_product_shelf_position,stock.group_stock_manager,1,1,1,1
Loading

0 comments on commit 99ae12a

Please sign in to comment.