Skip to content

Commit

Permalink
[ADD] stock_product_shelfinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
kanda999 committed Mar 23, 2023
1 parent 506b9dd commit aaea7d7
Show file tree
Hide file tree
Showing 18 changed files with 660 additions and 0 deletions.
54 changes: 54 additions & 0 deletions stock_storage/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
=============
Stock Storage
=============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-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_storage
:alt: qrtl/axls-custom

|badge1| |badge2| |badge3|

This module does the following:

*

**Table of contents**

.. contents::
:local:

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_storage%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_storage>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions stock_storage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions stock_storage/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Stock Storage",
"version": "16.0.1.0.0",
"author": "Quartile Limited",
"website": "https://www.quartile.co",
"category": "Stock",
"license": "LGPL-3",
"depends": ["product","stock"],
"data": [
"security/ir.model.access.csv",
"views/stock_move_line_views.xml",
"views/stock_move_views.xml",
"views/product_template_views.xml",
"views/stock_storage_views.xml",
],
"installable": True,
}
Empty file added stock_storage/i18n/ja.po
Empty file.
4 changes: 4 additions & 0 deletions stock_storage/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import product_template
from . import stock_move
from . import stock_storage
from . import stock_move_line
10 changes: 10 additions & 0 deletions stock_storage/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2022 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import models, fields


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

storage_ids = fields.Many2many("stock.storage", domain=lambda self: [('product_id', '=', self.id)])
10 changes: 10 additions & 0 deletions stock_storage/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2022 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


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

storage_ids = fields.Many2many("stock.storage", domain=lambda self: [('product_id', '=', self.id)])
20 changes: 20 additions & 0 deletions stock_storage/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import api, models, fields


class StockMove(models.Model):
_inherit = "stock.move"

generated_id = fields.Char(compute="compute_generated_id",store=True)

@api.depends("location_id","product_id")
def compute_generated_id(self):
for rec in self:
storage_id = self.env["stock.storage"].search([('location_id', '=', rec.location_dest_id.id), ('product_id', '=', rec.product_id.id)],limit=1)
if storage_id:
self.generated_id = storage_id.generated_id
else:
self.generated_id = False

20 changes: 20 additions & 0 deletions stock_storage/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import api, models, fields


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

generated_id = fields.Char(compute="compute_generated_id",store=True)

@api.depends("location_id","product_id")
def compute_generated_id(self):
for rec in self:
storage_id = self.env["stock.storage"].search([('location_id', '=', rec.location_dest_id.id), ('product_id', '=', rec.product_id.id)],limit=1)
if storage_id:
self.generated_id = storage_id.generated_id
else:
self.generated_id = False

25 changes: 25 additions & 0 deletions stock_storage/models/stock_storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import api, models , fields


class StockStorage(models.Model):
_name = "stock.storage"
_description = "Stock Storage"

company_id = fields.Many2one("res.company")
product_id = fields.Many2one("product.product")
location_id = fields.Many2one("stock.location")
shelf = fields.Char()
bucket = fields.Char()
position = fields.Char()
memo = fields.Char()
ref = fields.Char("Internal Reference")
generated_id = fields.Char(compute="compute_generated_id")

@api.depends('shelf', 'bucket', 'position')
def compute_generated_id(self):
for record in self:
record.generated_id = '-'.join([record.shelf or '', record.bucket or '', record.position or ''])

3 changes: 3 additions & 0 deletions stock_storage/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module does the following:

*
3 changes: 3 additions & 0 deletions stock_storage/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_storage_manager,access.stock.storage.manager,model_stock_storage,stock.group_stock_manager,1,1,1,1
access_stock_storage_user,access.stock.storage.user,model_stock_storage,stock.group_stock_user,1,0,0,0
Loading

0 comments on commit aaea7d7

Please sign in to comment.