Skip to content

Commit

Permalink
[MIG] account_move_line_stock_info: Migration to 17.0
Browse files Browse the repository at this point in the history
* Minor adjustments
* Attrs substitution
* Readme update
* Add the journal items to the simlified operations form view

Co-authored-by: stefan@opener.amsterdam
  • Loading branch information
CarlosVForgeFlow authored and StefanRijnhart committed Sep 23, 2024
1 parent 9434c31 commit 6a27fe2
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 41 deletions.
17 changes: 11 additions & 6 deletions account_move_line_stock_info/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ generates.
Usage
=====

- The stock manager can check the journal items by accessing to
'Inventory > Reports > Stock moves'.
- A user belonging to the group 'Show Full Accounting Features' can
review the details of a move that is associated to a journal item
through 'Invoicing > Accounting > Journal Entries (or Journal
items)'.
- A user that has access to the inventory app plus at least readonly
access to the accounting features can view the stock move of each
journal item or journal entry as a column of the journal item tree
view. It is hidden by default. The field is also visible on the
journal item form view.
- Similarly, a user that has access to both the accounting app and the
inventory app can inspect the journal items related to a stock move
by clicking on the operations of a validated transfer. This will open
the simplified form view of the stock move. If there are any related
(valuation) journal items, they will be visible under the operation
detail lines.

Bug Tracker
===========
Expand Down
2 changes: 1 addition & 1 deletion account_move_line_stock_info/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Move Line Stock Info",
"version": "16.0.1.1.1",
"version": "17.0.1.0.0",
"depends": ["stock_account"],
"author": "ForgeFlow," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
Expand Down
2 changes: 1 addition & 1 deletion account_move_line_stock_info/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StockMove(models.Model):
def _prepare_account_move_line(
self, qty, cost, credit_account_id, debit_account_id, svl_id, description
):
res = super(StockMove, self)._prepare_account_move_line(
res = super()._prepare_account_move_line(
qty, cost, credit_account_id, debit_account_id, svl_id, description
)
for line in res:
Expand Down
15 changes: 9 additions & 6 deletions account_move_line_stock_info/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
- The stock manager can check the journal items by accessing to
'Inventory \> Reports \> Stock moves'.
- A user belonging to the group 'Show Full Accounting Features' can
review the details of a move that is associated to a journal item
through 'Invoicing \> Accounting \> Journal Entries (or Journal
items)'.
- A user that has access to the inventory app plus at least readonly access to
the accounting features can view the stock move of each journal item or
journal entry as a column of the journal item tree view. It is hidden by
default. The field is also visible on the journal item form view.
- Similarly, a user that has access to both the accounting app and the inventory
app can inspect the journal items related to a stock move by clicking on the
operations of a validated transfer. This will open the simplified form view
of the stock move. If there are any related (valuation) journal items, they
will be visible under the operation detail lines.
29 changes: 18 additions & 11 deletions account_move_line_stock_info/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -388,12 +388,17 @@ <h1 class="title">Account Move Line Stock Info</h1>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<ul class="simple">
<li>The stock manager can check the journal items by accessing to
‘Inventory &gt; Reports &gt; Stock moves’.</li>
<li>A user belonging to the group ‘Show Full Accounting Features’ can
review the details of a move that is associated to a journal item
through ‘Invoicing &gt; Accounting &gt; Journal Entries (or Journal
items)’.</li>
<li>A user that has access to the inventory app plus at least readonly
access to the accounting features can view the stock move of each
journal item or journal entry as a column of the journal item tree
view. It is hidden by default. The field is also visible on the
journal item form view.</li>
<li>Similarly, a user that has access to both the accounting app and the
inventory app can inspect the journal items related to a stock move
by clicking on the operations of a validated transfer. This will open
the simplified form view of the stock move. If there are any related
(valuation) journal items, they will be visible under the operation
detail lines.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
Expand Down Expand Up @@ -428,7 +433,9 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class TestAccountMoveLineStockInfo(TransactionCase):
def setUp(self):
super(TestAccountMoveLineStockInfo, self).setUp()
super().setUp()
self.product_model = self.env["product.product"]
self.product_ctg_model = self.env["product.category"]
self.account_model = self.env["account.account"]
Expand Down Expand Up @@ -140,7 +140,8 @@ def test_account_move_line_stock_move(self):
self.picking_type_in, self.location_supplier, self.location_stock
)
picking_in.action_confirm()
picking_in.move_ids.quantity_done = 1
picking_in.move_ids.quantity = 1
picking_in.move_ids.picked = True
picking_in._action_done()

account_move_line = False
Expand All @@ -153,7 +154,8 @@ def test_account_move_line_stock_move(self):
self.picking_type_out, self.location_supplier, self.location_stock
)
picking_out.action_confirm()
picking_out.move_ids.quantity_done = 1
picking_out.move_ids.quantity = 1
picking_out.move_ids.picked = True
picking_out._action_done()

for move in picking_out.move_ids:
Expand Down
15 changes: 14 additions & 1 deletion account_move_line_stock_info/views/account_move_line_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,18 @@
</field>
</field>
</record>

<record id="view_account_move_form" model="ir.ui.view">
<field name="name">account.move.line.treee</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='line_ids']/tree" position="inside">
<field
name="stock_move_id"
groups="stock.group_stock_user"
optional="hide"
/>
</xpath>
</field>
</record>
</odoo>
36 changes: 24 additions & 12 deletions account_move_line_stock_info/views/stock_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,42 @@
<field name="inherit_id" ref="stock.view_move_form" />
<field name="arch" type="xml">
<group name="linked_group" position="after">
<group name="account_move_lines_grp" string="Journal Items" colspan="4">
<field name="account_move_line_ids" readonly="1" nolabel="1" />
<group
name="account_move_lines_grp"
colspan="4"
groups="account.group_account_readonly"
string="Journal Items"
>
<field
name="account_move_line_ids"
readonly="1"
nolabel="1"
colspan="2"
/>
</group>
</group>
</field>
</record>
<record id="view_picking_form" model="ir.ui.view">
<field name="name">stock.picking.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<record id="view_stock_move_operations" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_stock_move_operations" />
<field name="arch" type="xml">
<xpath
expr="//notebook//form//field[@name='description_picking']/.."
position="after"
>
<group name="account_move_lines_grp" string="Journal Items">
<field name="move_line_ids" position="after">
<group
name="journal_items"
groups="account.group_account_readonly"
invisible="not account_move_line_ids"
string="Journal Items"
>
<field
name="account_move_line_ids"
readonly="1"
nolabel="1"
colspan="2"
/>
</group>
</xpath>
</field>
</field>
</record>
</odoo>

0 comments on commit 6a27fe2

Please sign in to comment.