[MIG] stock_inventory_justification: Migration to 16.0

This commit is contained in:
Thomas Binsfeld
2024-01-08 08:48:49 +01:00
parent 9fe69a3072
commit 63056085a0
15 changed files with 166 additions and 73 deletions

View File

@@ -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 <https://github.com/OCA/stock-logistics-warehouse/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 <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_justification%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_justification%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.
@@ -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 <https://odoo-community.org/page/maintainer-role>`__:
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-rousseldenis|
|maintainer-rousseldenis| |maintainer-ThomasBinsfeld|
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_justification>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_inventory_justification>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -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",
],
}

View File

@@ -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"

View File

@@ -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

View File

@@ -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",
)

View File

@@ -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,
)

View File

@@ -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,
)

View File

@@ -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

View File

@@ -1 +1 @@
This module allows to set justification on inventories
This module allows to set justifications on inventories.

View File

@@ -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

View File

@@ -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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_justification"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_inventory_justification"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&amp;target_branch=13.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to set justification on inventories</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_inventory_justification"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_inventory_justification"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to set justifications on inventories.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -387,8 +387,9 @@ ul.auto-toc {
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<ul class="simple">
<li>Create a Stock Adjustement</li>
<li>Fill in justification</li>
<li>In the stock inventory list view, fill in justification(s)</li>
<li>Validate the inventory, the justifications will be added to the stock moves
and displayed on the move lines</li>
</ul>
</div>
<div class="section" id="bug-tracker">
@@ -396,7 +397,7 @@ ul.auto-toc {
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_justification%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_justification%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -421,9 +422,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/rousseldenis"><img alt="rousseldenis" src="https://github.com/rousseldenis.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_justification">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/rousseldenis"><img alt="rousseldenis" src="https://github.com/rousseldenis.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/ThomasBinsfeld"><img alt="ThomasBinsfeld" src="https://github.com/ThomasBinsfeld.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_inventory_justification">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!--FORM view-->
<record model="ir.ui.view" id="stock_inventory_form_view">
<field
name="name"
>stock.inventory.form (in stock_inventory_justification)</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_form" />
<field name="arch" type="xml">
<field name="product_ids" position="after">
<field name="justification_ids" widget="many2many_tags" />
</field>
</field>
</record>
<!--SEARCH view-->
<record model="ir.ui.view" id="stock_inventory_search_view">
<field
name="name"
>stock.inventory.search (in stock_inventory_justification)</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_filter" />
<field name="arch" type="xml">
<field name="product_ids" position="after">
<field name="justification_ids" />
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="ir.ui.view" id="stock_move_line_form_view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_form" />
<field name="arch" type="xml">
<field name="product_uom_category_id" position="after">
<field name="is_inventory" invisible="1" />
</field>
<field name="product_id" position="after">
<field
name="inventory_justification_ids"
widget="many2many_tags"
attrs="{'invisible': [('is_inventory', '=', False)]}"
/>
</field>
</field>
</record>
<record model="ir.ui.view" id="stock_move_line_tree_view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_tree" />
<field name="arch" type="xml">
<field name="location_dest_usage" position="after">
<field name="is_inventory" invisible="1" />
</field>
<field name="product_uom_id" position="after">
<field
name="inventory_justification_ids"
widget="many2many_tags"
attrs="{'invisible': [('is_inventory', '=', False)]}"
/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="ir.ui.view" id="stock_quant_tree_view">
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree_inventory_editable" />
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="inventory_justification_ids" widget="many2many_tags" />
</field>
</field>
</record>
</odoo>