diff --git a/account_move_line_stock_info/README.rst b/account_move_line_stock_info/README.rst index 6e0462efd..89f84ae26 100644 --- a/account_move_line_stock_info/README.rst +++ b/account_move_line_stock_info/README.rst @@ -14,13 +14,13 @@ Account Move Line Stock Info :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/12.0/account_move_line_stock_info + :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/account_move_line_stock_info :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-12-0/stock-logistics-warehouse-12-0-account_move_line_stock_info + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-account_move_line_stock_info :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/153/12.0 + :target: https://runbot.odoo-community.org/runbot/153/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -38,9 +38,9 @@ Usage * The stock manager can check the journal items by accessing to 'Inventory > Reports > Stock moves'. -* A user belonging to the group 'Accounting & Finance/Adviser' can review the +* 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 > Adviser > Journal Entries (or Journal items)'. + 'Invoicing > Accounting > Journal Entries (or Journal items)'. Bug Tracker =========== @@ -48,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -65,6 +65,7 @@ Contributors * Jordi Ballester Alomar * Lois Rilo +* Pimolnat Suntian Maintainers ~~~~~~~~~~~ @@ -79,6 +80,6 @@ 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. -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/account_move_line_stock_info/models/account_move_line.py b/account_move_line_stock_info/models/account_move_line.py index 04fd05291..0cd2f2b36 100644 --- a/account_move_line_stock_info/models/account_move_line.py +++ b/account_move_line_stock_info/models/account_move_line.py @@ -1,5 +1,5 @@ -# © 2016 Eficent Business and IT Consulting Services S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import fields, models diff --git a/account_move_line_stock_info/models/stock_move.py b/account_move_line_stock_info/models/stock_move.py index ab0c64583..72220a50e 100644 --- a/account_move_line_stock_info/models/stock_move.py +++ b/account_move_line_stock_info/models/stock_move.py @@ -1,5 +1,5 @@ -# © 2016 Eficent Business and IT Consulting Services S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models @@ -13,10 +13,10 @@ class StockMove(models.Model): @api.model def _prepare_account_move_line( - self, qty, cost, credit_account_id, debit_account_id + self, qty, cost, credit_account_id, debit_account_id, description ): res = super(StockMove, self)._prepare_account_move_line( - qty, cost, credit_account_id, debit_account_id + qty, cost, credit_account_id, debit_account_id, description ) for line in res: line[2]["stock_move_id"] = self.id diff --git a/account_move_line_stock_info/readme/CONTRIBUTORS.rst b/account_move_line_stock_info/readme/CONTRIBUTORS.rst index daeadd46d..6d027d9f1 100644 --- a/account_move_line_stock_info/readme/CONTRIBUTORS.rst +++ b/account_move_line_stock_info/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Jordi Ballester Alomar * Lois Rilo +* Pimolnat Suntian diff --git a/account_move_line_stock_info/readme/USAGE.rst b/account_move_line_stock_info/readme/USAGE.rst index 41bc231b1..20f68798e 100644 --- a/account_move_line_stock_info/readme/USAGE.rst +++ b/account_move_line_stock_info/readme/USAGE.rst @@ -1,6 +1,6 @@ * The stock manager can check the journal items by accessing to 'Inventory > Reports > Stock moves'. -* A user belonging to the group 'Accounting & Finance/Adviser' can review the +* 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 > Adviser > Journal Entries (or Journal items)'. + 'Invoicing > Accounting > Journal Entries (or Journal items)'. diff --git a/account_move_line_stock_info/static/description/index.html b/account_move_line_stock_info/static/description/index.html index ae9446489..332e0404b 100644 --- a/account_move_line_stock_info/static/description/index.html +++ b/account_move_line_stock_info/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module adds the stock move to the account move lines that it generates.

Table of contents

@@ -387,9 +387,9 @@ ul.auto-toc {
  • The stock manager can check the journal items by accessing to ‘Inventory > Reports > Stock moves’.
  • -
  • A user belonging to the group ‘Accounting & Finance/Adviser’ can review the +
  • 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 > Adviser > Journal Entries (or Journal items)’.
  • +‘Invoicing > Accounting > Journal Entries (or Journal items)’.
@@ -397,7 +397,7 @@ details of a move that is associated to a journal item through

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.

+feedback.

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

@@ -413,6 +413,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
@@ -422,7 +423,7 @@ If you spotted it first, help us smashing 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.

-

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/account_move_line_stock_info/tests/__init__.py b/account_move_line_stock_info/tests/__init__.py index 411212a70..45686613c 100644 --- a/account_move_line_stock_info/tests/__init__.py +++ b/account_move_line_stock_info/tests/__init__.py @@ -1,3 +1,3 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import test_account_move_line_stock_move diff --git a/account_move_line_stock_info/tests/test_account_move_line_stock_move.py b/account_move_line_stock_info/tests/test_account_move_line_stock_move.py index ca21c8e47..c96b22195 100644 --- a/account_move_line_stock_info/tests/test_account_move_line_stock_move.py +++ b/account_move_line_stock_info/tests/test_account_move_line_stock_move.py @@ -1,4 +1,4 @@ -# © 2015 Eficent Business and IT Consulting Services S.L. (www.eficent.com) +# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo.tests.common import TransactionCase @@ -11,35 +11,32 @@ class TestAccountMoveLineStockInfo(TransactionCase): self.product_ctg_model = self.env["product.category"] self.acc_type_model = self.env["account.account.type"] self.account_model = self.env["account.account"] - self.aml_model = self.env["account.move.line"] self.stock_picking_model = self.env["stock.picking"] - self.stock_move_model = self.env["stock.move"] self.res_users_model = self.env["res.users"] - self.partner1 = self.env.ref("base.res_partner_1") self.location_stock = self.env.ref("stock.stock_location_stock") self.location_supplier = self.env.ref("stock.stock_location_suppliers") self.location_customer = self.env.ref("stock.stock_location_customers") self.company = self.env.ref("base.main_company") self.picking_type_in = self.env.ref("stock.picking_type_in") self.picking_type_out = self.env.ref("stock.picking_type_out") - self.group_stock_user = self.env.ref("stock.group_stock_user") + self.group_stock_manager = self.env.ref("stock.group_stock_manager") self.group_account_invoice = self.env.ref("account.group_account_invoice") self.group_account_manager = self.env.ref("account.group_account_manager") # Create account for Goods Received Not Invoiced - acc_type = self._create_account_type("equity", "other") + acc_type = self._create_account_type("equity", "other", "equity") name = "Goods Received Not Invoiced" code = "grni" self.account_grni = self._create_account(acc_type, name, code, self.company) # Create account for Cost of Goods Sold - acc_type = self._create_account_type("expense", "other") + acc_type = self._create_account_type("expense", "other", "expense") name = "Cost of Goods Sold" code = "cogs" self.account_cogs = self._create_account(acc_type, name, code, self.company) # Create account for Inventory - acc_type = self._create_account_type("asset", "other") + acc_type = self._create_account_type("asset", "other", "asset") name = "Inventory" code = "inventory" self.account_inventory = self._create_account( @@ -47,12 +44,11 @@ class TestAccountMoveLineStockInfo(TransactionCase): ) # Create Product self.product = self._create_product() - # company # Create users - self.stock_user = self._create_user( - "stock_user", - [self.group_stock_user, self.group_account_invoice], + self.stock_manager = self._create_user( + "stock_manager", + [self.group_stock_manager, self.group_account_invoice], self.company, ) self.account_invoice = self._create_user( @@ -78,8 +74,10 @@ class TestAccountMoveLineStockInfo(TransactionCase): ) return user.id - def _create_account_type(self, name, a_type): - acc_type = self.acc_type_model.create({"name": name, "type": a_type}) + def _create_account_type(self, name, a_type, internal_group): + acc_type = self.acc_type_model.create( + {"name": name, "type": a_type, "internal_group": internal_group} + ) return acc_type def _create_account(self, acc_type, name, code, company): @@ -96,10 +94,12 @@ class TestAccountMoveLineStockInfo(TransactionCase): def _create_product(self): """Create a Product.""" - # group_ids = [group.id for group in groups] product_ctg = self.product_ctg_model.create( { "name": "test_product_ctg", + "property_valuation": "real_time", + "property_stock_account_input_categ_id": self.account_grni.id, + "property_stock_account_output_categ_id": self.account_cogs.id, "property_stock_valuation_account_id": self.account_inventory.id, } ) @@ -110,16 +110,13 @@ class TestAccountMoveLineStockInfo(TransactionCase): "type": "product", "standard_price": 1.0, "list_price": 1.0, - "valuation": "real_time", - "property_stock_account_input": self.account_grni.id, - "property_stock_account_output": self.account_cogs.id, } ) return product def _create_picking(self, picking_type, location, location_dest): - picking = self.stock_picking_model.sudo(self.stock_user).create( + picking = self.stock_picking_model.with_user(self.stock_manager).create( { "picking_type_id": picking_type.id, "location_id": location.id, @@ -158,7 +155,6 @@ class TestAccountMoveLineStockInfo(TransactionCase): for move in picking_in.move_lines: self.assertEqual(len(move.account_move_line_ids), 2) for aml in move.account_move_line_ids: - self.assertEqual(aml.name, move.name) account_move_line = aml picking_out = self._create_picking( @@ -170,17 +166,9 @@ class TestAccountMoveLineStockInfo(TransactionCase): for move in picking_out.move_lines: self.assertEqual(len(move.account_move_line_ids), 2) - for aml in move.account_move_line_ids: - self.assertEqual(aml.name, move.name) # Test that the account invoice user can access to the stock info - self.assertEqual( - account_move_line.sudo(self.account_invoice).stock_move_id.name, - account_move_line.sudo(self.account_invoice).name, - ) + self.assertTrue(account_move_line.with_user(self.account_invoice).stock_move_id) # Test that the account manager can access to the stock info - self.assertEqual( - account_move_line.sudo(self.account_manager).stock_move_id.name, - account_move_line.sudo(self.account_manager).name, - ) + self.assertTrue(account_move_line.with_user(self.account_manager).stock_move_id) diff --git a/account_move_line_stock_info/views/stock_move_view.xml b/account_move_line_stock_info/views/stock_move_view.xml index 3181d1604..26b6b3d0d 100644 --- a/account_move_line_stock_info/views/stock_move_view.xml +++ b/account_move_line_stock_info/views/stock_move_view.xml @@ -17,18 +17,18 @@ - - stock.move.form - stock.move - + + stock.picking.form + stock.picking + - + - +