diff --git a/stock_inventory_justification/README.rst b/stock_inventory_justification/README.rst index bc871daeb..93273f38f 100644 --- a/stock_inventory_justification/README.rst +++ b/stock_inventory_justification/README.rst @@ -7,7 +7,7 @@ Stock Inventory Justification !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:b624399bb433dd741db2a04bb55900518718b19e884671ae25e015cc2eceecfa + !! source digest: sha256:077ccd4ba446ba2259f07d5c199568e4210d8fbd33febc071b7c66a52320674b !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,18 +17,18 @@ Stock Inventory Justification :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--warehouse-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_justification + :target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_inventory_justification :alt: OCA/stock-logistics-warehouse .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_inventory_justification + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_inventory_justification :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-warehouse&target_branch=13.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module allows to set justification on inventories +This module allows to set justifications on inventories. **Table of contents** @@ -38,8 +38,9 @@ This module allows to set justification on inventories Usage ===== -* Create a Stock Adjustement -* Fill in justification +* In the stock inventory list view, fill in justification(s) +* Validate the inventory, the justifications will be added to the stock moves + and displayed on the move lines Bug Tracker =========== @@ -47,7 +48,7 @@ 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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -81,11 +82,14 @@ promote its widespread use. .. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px :target: https://github.com/rousseldenis :alt: rousseldenis +.. |maintainer-ThomasBinsfeld| image:: https://github.com/ThomasBinsfeld.png?size=40px + :target: https://github.com/ThomasBinsfeld + :alt: ThomasBinsfeld -Current `maintainer `__: +Current `maintainers `__: -|maintainer-rousseldenis| +|maintainer-rousseldenis| |maintainer-ThomasBinsfeld| -This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_inventory_justification/__manifest__.py b/stock_inventory_justification/__manifest__.py index 267dba230..3f7081114 100644 --- a/stock_inventory_justification/__manifest__.py +++ b/stock_inventory_justification/__manifest__.py @@ -5,15 +5,16 @@ "name": "Stock Inventory Justification", "summary": """ This module allows to set justification on inventories""", - "version": "13.0.1.0.0", + "version": "16.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-warehouse", - "maintainers": ["rousseldenis"], + "maintainers": ["rousseldenis", "ThomasBinsfeld"], "depends": ["stock"], "data": [ - "security/security.xml", - "views/stock_inventory.xml", + "security/acl_stock_inventory_justification.xml", + "views/stock_move_line.xml", + "views/stock_quant.xml", "views/stock_inventory_justification.xml", ], } diff --git a/stock_inventory_justification/i18n/stock_inventory_justification.pot b/stock_inventory_justification/i18n/stock_inventory_justification.pot index 1bb9be2b7..4b35ce43b 100644 --- a/stock_inventory_justification/i18n/stock_inventory_justification.pot +++ b/stock_inventory_justification/i18n/stock_inventory_justification.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/stock_inventory_justification/models/__init__.py b/stock_inventory_justification/models/__init__.py index 48b6b849c..61f4ec10e 100644 --- a/stock_inventory_justification/models/__init__.py +++ b/stock_inventory_justification/models/__init__.py @@ -1,2 +1,4 @@ from . import stock_inventory_justification -from . import stock_inventory +from . import stock_move +from . import stock_quant +from . import stock_move_line diff --git a/stock_inventory_justification/models/stock_inventory.py b/stock_inventory_justification/models/stock_inventory.py deleted file mode 100644 index fdea3d80c..000000000 --- a/stock_inventory_justification/models/stock_inventory.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class StockInventory(models.Model): - _inherit = "stock.inventory" - - justification_ids = fields.Many2many( - string="Justifications", - comodel_name="stock.inventory.justification", - ) diff --git a/stock_inventory_justification/models/stock_move.py b/stock_inventory_justification/models/stock_move.py new file mode 100644 index 000000000..d1b9650a1 --- /dev/null +++ b/stock_inventory_justification/models/stock_move.py @@ -0,0 +1,18 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockMove(models.Model): + _inherit = "stock.move" + + inventory_justification_ids = fields.Many2many( + string="Justifications", + help="Inventory justifications", + comodel_name="stock.inventory.justification", + relation="stock_move_inventory_justification_rel", + column1="move_id", + column2="justification_id", + readonly=True, + ) diff --git a/stock_inventory_justification/models/stock_move_line.py b/stock_inventory_justification/models/stock_move_line.py new file mode 100644 index 000000000..d09804864 --- /dev/null +++ b/stock_inventory_justification/models/stock_move_line.py @@ -0,0 +1,17 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + inventory_justification_ids = fields.Many2many( + string="Justifications", + help="Inventory justifications", + comodel_name="stock.inventory.justification", + related="move_id.inventory_justification_ids", + store=False, + readonly=True, + ) diff --git a/stock_inventory_justification/models/stock_quant.py b/stock_inventory_justification/models/stock_quant.py new file mode 100644 index 000000000..fee5dab58 --- /dev/null +++ b/stock_inventory_justification/models/stock_quant.py @@ -0,0 +1,42 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class StockQuant(models.Model): + _inherit = "stock.quant" + + inventory_justification_ids = fields.Many2many( + string="Justifications", + help="Inventory justifications", + comodel_name="stock.inventory.justification", + relation="stock_quant_inventory_justification_rel", + column1="quant_id", + column2="justification_id", + ) + + def action_inventory_history(self): # pragma: no cover + action = super().action_inventory_history() + action["context"]["show_inventory_justifications"] = True + return action + + def _get_inventory_move_values(self, qty, location_id, location_dest_id, out=False): + res = super()._get_inventory_move_values( + qty, location_id, location_dest_id, out + ) + res["inventory_justification_ids"] = [ + (6, 0, self.inventory_justification_ids.ids) + ] + return res + + def _apply_inventory(self): + res = super()._apply_inventory() + self.write({"inventory_justification_ids": [(5,)]}) + return res + + @api.model + def _get_inventory_fields_write(self): + res = super()._get_inventory_fields_write() + res.append("inventory_justification_ids") + return res diff --git a/stock_inventory_justification/readme/DESCRIPTION.rst b/stock_inventory_justification/readme/DESCRIPTION.rst index c772633c5..b0c0dac03 100644 --- a/stock_inventory_justification/readme/DESCRIPTION.rst +++ b/stock_inventory_justification/readme/DESCRIPTION.rst @@ -1 +1 @@ -This module allows to set justification on inventories +This module allows to set justifications on inventories. diff --git a/stock_inventory_justification/readme/USAGE.rst b/stock_inventory_justification/readme/USAGE.rst index 684b65824..cac1ce3c2 100644 --- a/stock_inventory_justification/readme/USAGE.rst +++ b/stock_inventory_justification/readme/USAGE.rst @@ -1,2 +1,3 @@ -* Create a Stock Adjustement -* Fill in justification +* In the stock inventory list view, fill in justification(s) +* Validate the inventory, the justifications will be added to the stock moves + and displayed on the move lines diff --git a/stock_inventory_justification/security/security.xml b/stock_inventory_justification/security/acl_stock_inventory_justification.xml similarity index 100% rename from stock_inventory_justification/security/security.xml rename to stock_inventory_justification/security/acl_stock_inventory_justification.xml diff --git a/stock_inventory_justification/static/description/index.html b/stock_inventory_justification/static/description/index.html index 9705c9273..c16705177 100644 --- a/stock_inventory_justification/static/description/index.html +++ b/stock_inventory_justification/static/description/index.html @@ -367,10 +367,10 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:b624399bb433dd741db2a04bb55900518718b19e884671ae25e015cc2eceecfa +!! source digest: sha256:077ccd4ba446ba2259f07d5c199568e4210d8fbd33febc071b7c66a52320674b !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

-

This module allows to set justification on inventories

+

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

+

This module allows to set justifications on inventories.

Table of contents

    @@ -387,8 +387,9 @@ ul.auto-toc {

    Usage

      -
    • Create a Stock Adjustement
    • -
    • Fill in justification
    • +
    • In the stock inventory list view, fill in justification(s)
    • +
    • Validate the inventory, the justifications will be added to the stock moves +and displayed on the move lines
    @@ -396,7 +397,7 @@ ul.auto-toc {

    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 to smash it by providing a detailed and welcomed -feedback.

    +feedback.

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

    @@ -421,9 +422,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

    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.

    -

    Current maintainer:

    -

    rousseldenis

    -

    This module is part of the OCA/stock-logistics-warehouse project on GitHub.

    +

    Current maintainers:

    +

    rousseldenis ThomasBinsfeld

    +

    This module is part of the OCA/stock-logistics-warehouse project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/stock_inventory_justification/views/stock_inventory.xml b/stock_inventory_justification/views/stock_inventory.xml deleted file mode 100644 index efde97588..000000000 --- a/stock_inventory_justification/views/stock_inventory.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - stock.inventory.form (in stock_inventory_justification) - stock.inventory - - - - - - - - - - stock.inventory.search (in stock_inventory_justification) - stock.inventory - - - - - - - - diff --git a/stock_inventory_justification/views/stock_move_line.xml b/stock_inventory_justification/views/stock_move_line.xml new file mode 100644 index 000000000..5a937e5dd --- /dev/null +++ b/stock_inventory_justification/views/stock_move_line.xml @@ -0,0 +1,37 @@ + + + + + stock.move.line + + + + + + + + + + + + stock.move.line + + + + + + + + + + + diff --git a/stock_inventory_justification/views/stock_quant.xml b/stock_inventory_justification/views/stock_quant.xml new file mode 100644 index 000000000..d3a0270f3 --- /dev/null +++ b/stock_inventory_justification/views/stock_quant.xml @@ -0,0 +1,14 @@ + + + + + stock.quant + + + + + + + +