diff --git a/stock_storage/README.rst b/stock_storage/README.rst new file mode 100644 index 00000000..18a29aae --- /dev/null +++ b/stock_storage/README.rst @@ -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 `_. +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 `_. + +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 `_ project on GitHub. + +You are welcome to contribute. diff --git a/stock_storage/__init__.py b/stock_storage/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/stock_storage/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_storage/__manifest__.py b/stock_storage/__manifest__.py new file mode 100644 index 00000000..358d2207 --- /dev/null +++ b/stock_storage/__manifest__.py @@ -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, +} diff --git a/stock_storage/i18n/ja.po b/stock_storage/i18n/ja.po new file mode 100644 index 00000000..e69de29b diff --git a/stock_storage/models/__init__.py b/stock_storage/models/__init__.py new file mode 100644 index 00000000..2acaf747 --- /dev/null +++ b/stock_storage/models/__init__.py @@ -0,0 +1,4 @@ +from . import product_template +from . import stock_move +from . import stock_storage +from . import stock_move_line diff --git a/stock_storage/models/product_product.py b/stock_storage/models/product_product.py new file mode 100644 index 00000000..d9fe7417 --- /dev/null +++ b/stock_storage/models/product_product.py @@ -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)]) \ No newline at end of file diff --git a/stock_storage/models/product_template.py b/stock_storage/models/product_template.py new file mode 100644 index 00000000..044fb436 --- /dev/null +++ b/stock_storage/models/product_template.py @@ -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)]) \ No newline at end of file diff --git a/stock_storage/models/stock_move.py b/stock_storage/models/stock_move.py new file mode 100644 index 00000000..9d28e8fb --- /dev/null +++ b/stock_storage/models/stock_move.py @@ -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 + diff --git a/stock_storage/models/stock_move_line.py b/stock_storage/models/stock_move_line.py new file mode 100644 index 00000000..cc8c6066 --- /dev/null +++ b/stock_storage/models/stock_move_line.py @@ -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 + diff --git a/stock_storage/models/stock_storage.py b/stock_storage/models/stock_storage.py new file mode 100644 index 00000000..9cc6e9b2 --- /dev/null +++ b/stock_storage/models/stock_storage.py @@ -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 '']) + diff --git a/stock_storage/readme/DESCRIPTION.rst b/stock_storage/readme/DESCRIPTION.rst new file mode 100644 index 00000000..0b06411e --- /dev/null +++ b/stock_storage/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module does the following: + +* \ No newline at end of file diff --git a/stock_storage/security/ir.model.access.csv b/stock_storage/security/ir.model.access.csv new file mode 100644 index 00000000..73191faa --- /dev/null +++ b/stock_storage/security/ir.model.access.csv @@ -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 diff --git a/stock_storage/static/description/index.html b/stock_storage/static/description/index.html new file mode 100644 index 00000000..c2d11880 --- /dev/null +++ b/stock_storage/static/description/index.html @@ -0,0 +1,410 @@ + + + + + + +Stock Storage + + + +
+

Stock Storage

+ + +

Beta License: LGPL-3 qrtl/axls-custom

+

This module does the following:

+
    +
  • +
+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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 project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/stock_storage/views/product_product_views.xml b/stock_storage/views/product_product_views.xml new file mode 100644 index 00000000..0d298ad7 --- /dev/null +++ b/stock_storage/views/product_product_views.xml @@ -0,0 +1,3 @@ + + + diff --git a/stock_storage/views/product_template_views.xml b/stock_storage/views/product_template_views.xml new file mode 100644 index 00000000..b479d8a7 --- /dev/null +++ b/stock_storage/views/product_template_views.xml @@ -0,0 +1,15 @@ + + + + product.template.product.form + product.template + + + + + + + + + + diff --git a/stock_storage/views/stock_move_line_views.xml b/stock_storage/views/stock_move_line_views.xml new file mode 100644 index 00000000..686c6213 --- /dev/null +++ b/stock_storage/views/stock_move_line_views.xml @@ -0,0 +1,15 @@ + + + + stock.move.line.tree + stock.move.line + + + + + + + + diff --git a/stock_storage/views/stock_move_views.xml b/stock_storage/views/stock_move_views.xml new file mode 100644 index 00000000..9098fdba --- /dev/null +++ b/stock_storage/views/stock_move_views.xml @@ -0,0 +1,15 @@ + + + + stock.move.tree + stock.move + + + + + + + + diff --git a/stock_storage/views/stock_storage_views.xml b/stock_storage/views/stock_storage_views.xml new file mode 100644 index 00000000..7f07780e --- /dev/null +++ b/stock_storage/views/stock_storage_views.xml @@ -0,0 +1,33 @@ + + + + stock.storage.tree + stock.storage + tree + + + + + + + + + + + + + + + + Stock Storage + stock.storage + tree,form + + + +