Skip to content

Commit

Permalink
Merge pull request #998 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/project (16.0)
  • Loading branch information
bt-admin authored Jun 12, 2024
2 parents 86ac7d8 + 1d29a0f commit 2a9abba
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ addon | version | maintainers | summary
[project_role](project_role/) | 16.0.1.0.4 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Project role-based roster
[project_sequence](project_sequence/) | 16.0.1.0.0 | [![yajo](https://github.com/yajo.png?size=30px)](https://github.com/yajo) [![anddago78](https://github.com/anddago78.png?size=30px)](https://github.com/anddago78) | Add a sequence field to projects, filled automatically
[project_stage_extra_info](project_stage_extra_info/) | 16.0.1.0.0 | | Project Stage Extra Info
[project_stock](project_stock/) | 16.0.1.1.0 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Project Stock
[project_stock](project_stock/) | 16.0.1.2.0 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Project Stock
[project_stock_analytic_tag](project_stock_analytic_tag/) | 16.0.1.0.0 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Project Stock Analytic Tag
[project_stock_product_set](project_stock_product_set/) | 16.0.2.0.0 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Project Stock Product Set
[project_task_add_very_high](project_task_add_very_high/) | 16.0.1.0.0 | [![astirpe](https://github.com/astirpe.png?size=30px)](https://github.com/astirpe) | Adds extra options 'High' and 'Very High' on tasks
Expand Down
2 changes: 1 addition & 1 deletion project_stock/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project Stock
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:dcb0e42797039ac4720e55a3a4bb8f62898fd6a8e4ba095d8c9ae898f84f17b6
!! source digest: sha256:ad512688e6eb234d7f33624a3edb9af58f1ac8d0f177bc5608aa530daf671f0b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion project_stock/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Project Stock",
"version": "16.0.1.1.0",
"version": "16.0.1.2.0",
"category": "Project Management",
"website": "https://github.com/OCA/project",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
7 changes: 4 additions & 3 deletions project_stock/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-28 09:51+0000\n"
"Last-Translator: Adriano Prado <[email protected]>\n"
"PO-Revision-Date: 2024-06-11 15:35+0000\n"
"Last-Translator: Rodrigo Macedo <[email protected]."
"translation.odoo-community.org>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -132,7 +133,7 @@ msgstr "Movimentos de Estoque Feitos"
#. module: project_stock
#: model_terms:ir.ui.view,arch_db:project_stock.view_stock_move_raw_tree
msgid "Forecasted Report"
msgstr ""
msgstr "Relatório Previsto"

#. module: project_stock
#: model:ir.model.fields,field_description:project_stock.field_project_task__group_id
Expand Down
2 changes: 1 addition & 1 deletion project_stock/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ <h1 class="title">Project Stock</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:dcb0e42797039ac4720e55a3a4bb8f62898fd6a8e4ba095d8c9ae898f84f17b6
!! source digest: sha256:ad512688e6eb234d7f33624a3edb9af58f1ac8d0f177bc5608aa530daf671f0b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/project/tree/16.0/project_stock"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock"><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/project&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 consume products directly from a project task.</p>
Expand Down
2 changes: 1 addition & 1 deletion project_stock/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def setUpClass(cls):
cls.stage_in_progress = cls.env.ref("project.project_stage_1")
cls.stage_done = cls.env.ref("project.project_stage_2")
group_stock_user = "stock.group_stock_user"
new_test_user(
cls.basic_user = new_test_user(
cls.env,
login="basic-user",
groups="project.group_project_user,%s" % group_stock_user,
Expand Down
17 changes: 16 additions & 1 deletion project_stock/tests/test_project_stock.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright 2022-2023 Tecnativa - Víctor Martínez
# Copyright 2022-2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields
from odoo.tests import Form
from odoo.tests.common import users
from odoo.tools import mute_logger

from .common import TestProjectStockBase

Expand Down Expand Up @@ -81,6 +82,15 @@ def test_project_task_without_analytic_account(self):
def test_project_task_without_analytic_account_manager_user(self):
self.test_project_task_without_analytic_account()

def test_project_task_user_access_without_stock_group(self):
self.basic_user.write(
{
"groups_id": [(6, 0, [self.env.ref("project.group_project_user").id])],
}
)
task_form = Form(self.task.with_user(self.basic_user))
self.assertEqual(task_form.project_id, self.project)

def test_project_task_analytic_lines_without_tags(self):
self.task = self.env["project.task"].browse(self.task.id)
self.task.write({"stage_id": self.stage_done.id})
Expand Down Expand Up @@ -173,6 +183,7 @@ def test_project_task_process_done(self):
def test_project_task_process_done_basic_user(self):
self.test_project_task_process_done()

@mute_logger("odoo.models.unlink")
def test_project_task_process_cancel(self):
self.task = self.env["project.task"].browse(self.task.id)
self.assertEqual(self.move_product_a.state, "draft")
Expand Down Expand Up @@ -212,6 +223,7 @@ def test_project_task_process_cancel(self):
def test_project_task_process_cancel_manager_user(self):
self.test_project_task_process_cancel()

@mute_logger("odoo.models.unlink")
def test_project_task_process_unreserve(self):
self.task = self.env["project.task"].browse(self.task.id)
self.assertEqual(self.move_product_a.state, "draft")
Expand All @@ -233,6 +245,7 @@ def test_project_task_process_unreserve(self):
self.assertEqual(self.move_product_b.reserved_availability, 0)
self.assertFalse(self.task.unreserve_visible)

@mute_logger("odoo.models.unlink")
def test_project_task_process_01(self):
"""Product A move cancel + Product B move OK."""
self.task = self.env["project.task"].browse(self.task.id)
Expand Down Expand Up @@ -290,13 +303,15 @@ def test_project_task_action_done(self):
def test_project_task_action_done_basic_user(self):
self.test_project_task_action_done()

@mute_logger("odoo.models.unlink")
def test_project_task_unlink(self):
self.assertTrue(self.env["project.task"].browse(self.task.id).unlink())

@users("basic-user")
def test_project_task_unlink_basic_user(self):
self.test_project_task_unlink()

@mute_logger("odoo.models.unlink")
def test_project_project_onchange(self):
new_type = self.env.ref("stock.picking_type_out")
self.project.write({"picking_type_id": new_type.id})
Expand Down
13 changes: 10 additions & 3 deletions project_stock/views/project_task_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,45 +40,51 @@
/>
<field name="stock_analytic_date" />
</field>
<field name="stage_id" position="before" groups="stock.group_stock_user">
<field name="stage_id" position="before">
<button
name="action_confirm"
string="Confirm materials"
type="object"
class="oe_highlight"
attrs="{'invisible':[('allow_moves_action_confirm','=',False)]}"
groups="stock.group_stock_user"
/>
<button
name="action_assign"
string="Check availability materials"
type="object"
class="oe_highlight"
attrs="{'invisible':[('allow_moves_action_assign','=',False)]}"
groups="stock.group_stock_user"
/>
<button
name="button_scrap"
type="object"
string="Scrap"
attrs="{'invisible': ['|','|',('stock_state', '=', 'done'),('done_stock_moves', '=', False),('stock_moves_is_locked','=',False)]}"
groups="stock.group_stock_user"
/>
<button
name="button_unreserve"
type="object"
string="Unreserve"
attrs="{'invisible': ['|','|','|', ('stock_state', '=', 'cancel'),('unreserve_visible', '=', False),('done_stock_moves', '=', False),('stock_moves_is_locked','=',False)]}"
groups="stock.group_stock_user"
/>
<button
name="action_cancel"
type="object"
string="Cancel Materials"
attrs="{'invisible': ['|','|',('stock_state', 'in', ('draft', 'cancel')),('done_stock_moves', '=', False),('stock_moves_is_locked','=',False)]}"
groups="stock.group_stock_user"
/>
<button
name="action_done"
type="object"
string="Transfer Materials"
attrs="{'invisible': ['|','|',('stock_state', '!=', 'assigned'),('done_stock_moves', '=', False),('stock_moves_is_locked', '=', False)]}"
class="oe_highlight"
groups="stock.group_stock_user"
/>
<button
name="action_toggle_stock_moves_is_locked"
Expand All @@ -97,12 +103,14 @@
/>
</field>
<xpath expr="///page[@name='extra_info']" position="before">
<!-- Field without groups used as domain in stock_analytic_* fields !-->
<field name="use_stock_moves" invisible="1" />
<page
name="stock_info"
string="Stock Info"
attrs="{'invisible': [('use_stock_moves', '=', False)]}"
groups="stock.group_stock_user"
>
<field name="use_stock_moves" invisible="1" />
<field name="done_stock_moves" invisible="1" />
<field name="stock_moves_is_locked" invisible="1" />
<field name="stock_state" invisible="1" />
Expand All @@ -113,7 +121,6 @@
name="move_ids"
context="{'tree_view_ref': 'project_stock.view_stock_move_raw_tree', 'form_view_ref':'stock.view_move_form', 'default_company_id': company_id, 'default_state': 'draft', 'default_raw_material_task_id': id}"
attrs="{'readonly': [('done_stock_moves', '=', True),('stock_moves_is_locked', '=', True)]}"
groups="stock.group_stock_user"
/>
</page>
</xpath>
Expand Down

0 comments on commit 2a9abba

Please sign in to comment.