Skip to content

Commit

Permalink
[MIG] stock_request: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ced-adhoc committed Oct 31, 2024
1 parent 7bd03e5 commit 3a49c78
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 52 deletions.
10 changes: 5 additions & 5 deletions stock_request/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Stock Request
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--request-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-request/tree/17.0/stock_request
:target: https://github.com/OCA/stock-logistics-request/tree/18.0/stock_request
:alt: OCA/stock-logistics-request
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-request-17-0/stock-logistics-request-17-0-stock_request
:target: https://translation.odoo-community.org/projects/stock-logistics-request-18-0/stock-logistics-request-18-0-stock_request
: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-request&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-request&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -92,7 +92,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-request/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-request/issues/new?body=module:%20stock_request%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-request/issues/new?body=module:%20stock_request%0Aversion:%2018.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.

Expand Down Expand Up @@ -136,6 +136,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-request <https://github.com/OCA/stock-logistics-request/tree/17.0/stock_request>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-request <https://github.com/OCA/stock-logistics-request/tree/18.0/stock_request>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion stock_request/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Stock Request",
"summary": "Internal request for stock",
"version": "17.0.1.1.3",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/stock-logistics-request",
"author": "ForgeFlow, Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion stock_request/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def _stock_request_confirm_done_message_content(self, message_data):
_("Receipt confirmation %(picking_name)s for your Request %(request_name)s")
% message_data
)
message = "<h3>%s</h3>" % title
message = f"<h3>{title}</h3>"
message += (
_(
"The following requested items from Stock Request %(request_name)s "
Expand Down
6 changes: 3 additions & 3 deletions stock_request/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Stock Request</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:81609ee30a33c441cb1055814e9b5e270bc644fb69cfb04b3a9103a9a39e4e8e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-request/tree/17.0/stock_request"><img alt="OCA/stock-logistics-request" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--request-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-request-17-0/stock-logistics-request-17-0-stock_request"><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-request&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-request/tree/18.0/stock_request"><img alt="OCA/stock-logistics-request" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--request-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-request-18-0/stock-logistics-request-18-0-stock_request"><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-request&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to allow users to request products that are
frequently stocked by the company, to be transferred to their chosen
location.</p>
Expand Down Expand Up @@ -435,7 +435,7 @@ <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-request/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-request/issues/new?body=module:%20stock_request%0Aversion:%2017.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-request/issues/new?body=module:%20stock_request%0Aversion:%2018.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">
Expand Down Expand Up @@ -475,7 +475,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<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>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-request/tree/17.0/stock_request">OCA/stock-logistics-request</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-request/tree/18.0/stock_request">OCA/stock-logistics-request</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>
Expand Down
58 changes: 31 additions & 27 deletions stock_request/tests/test_stock_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def _create_product(cls, default_code, name, company_id, **vals):
default_code=default_code,
uom_id=cls.env.ref("uom.product_uom_unit").id,
company_id=company_id,
type="product",
type="consu",
is_storable=True,
**vals,
)
)
Expand Down Expand Up @@ -970,41 +971,42 @@ def test_stock_request_constrains(self):
stock_request.route_id = self.route_2

def test_stock_request_order_from_products(self):
# Setup for Product Template and Attributes
template_a = self.env["product.template"].create({"name": "ProductTemplate"})
product_attribute = self._create_product_attribute("Attribute")
product_att_value = self._create_product_attribute_value(

product_att_value1 = self._create_product_attribute_value(
"Name-1", product_attribute.id
)
product_att_value2 = self._create_product_attribute_value(
"Name-2", product_attribute.id
)
product_att_value3 = self._create_product_attribute_value(
"Name-3", product_attribute.id
)

product_tmpl_att_line = self._create_product_template_attribute_line(
template_a.id, product_attribute.id, product_att_value
template_a.id,
product_attribute.id,
product_att_value1 | product_att_value2 | product_att_value3,
)
template_a.attribute_line_ids |= product_tmpl_att_line
product_tmpl_att_value = self.env["product.template.attribute.value"].search(
[]
)[-1]

# Trigger the creation of all possible variants
template_a._create_variant_ids()

# Search for the the generated variants
product_a1 = self.env["product.product"].search(
[
(
"product_template_variant_value_ids.name",
"=",
product_tmpl_att_value.name,
)
]
)
product_att_value = self._create_product_attribute_value(
"Name-2", product_attribute.id
[("product_template_variant_value_ids.name", "=", "Name-1")]
)
template_a.attribute_line_ids.value_ids |= product_att_value
product_a2 = self.env["product.product"].search(
[("product_template_variant_value_ids.name", "=", product_att_value.name)]
[("product_template_variant_value_ids.name", "=", "Name-2")]
)
product_att_value = self._create_product_attribute_value(
"Name-3", product_attribute.id
)
template_a.attribute_line_ids.value_ids |= product_att_value
product_a3 = self.env["product.product"].search(
[("product_template_variant_value_ids.name", "=", product_att_value.name)]
[("product_template_variant_value_ids.name", "=", "Name-3")]
)

# Setup for Product B with one inactive variant
product_b1 = self._create_product("CODEB1", "Product B1", self.main_company.id)
template_b = product_b1.product_tmpl_id
# One archived variant of B
Expand All @@ -1015,6 +1017,7 @@ def test_stock_request_order_from_products(self):
product_tmpl_id=template_b.id,
active=False,
)

order = self.request_order

# Selecting some variants and creating an order
Expand Down Expand Up @@ -1137,9 +1140,9 @@ def test_cancellation(self):
group = self.env["procurement.group"].create({"name": "Procurement group"})
product2 = self._create_product("SH2", "Shoes2", False)
product3 = self._create_product("SH3", "Shoes3", False)
self.product.detailed_type = "consu"
product2.detailed_type = "consu"
product3.detailed_type = "consu"
self.product.type = "consu"
product2.type = "consu"
product3.type = "consu"
vals = {
"company_id": self.main_company.id,
"warehouse_id": self.warehouse.id,
Expand Down Expand Up @@ -1659,7 +1662,8 @@ def _create_product(self, default_code, name, **vals):
default_code=default_code,
uom_id=self.uom_unit.id,
uom_po_id=self.uom_dozen.id,
type="product",
type="consu",
is_storable=True,
**vals,
)
)
Expand Down
4 changes: 2 additions & 2 deletions stock_request/views/stock_request_allocation_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<field name="name">stock.request.allocation.tree</field>
<field name="model">stock.request.allocation</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="stock_request_id" />
<field name="stock_move_id" />
<field name="product_id" />
Expand All @@ -20,7 +20,7 @@
<field name="allocated_product_qty" />
<field name="open_product_qty" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</list>
</field>
</record>
<record id="view_stock_request_allocation_form" model="ir.ui.view">
Expand Down
10 changes: 5 additions & 5 deletions stock_request/views/stock_request_order_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<field name="name">stock.request.order.tree</field>
<field name="model">stock.request.order</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="warehouse_id" groups="stock.group_stock_multi_locations" />
<field name="location_id" groups="stock.group_stock_multi_locations" />
<field name="state" />
</tree>
</list>
</field>
</record>
<record model="ir.ui.view" id="stock_request_order_form">
Expand Down Expand Up @@ -134,7 +134,7 @@
}"
readonly="state != 'draft'"
>
<tree editable="bottom">
<list editable="bottom">
<field name="name" readonly="1" optional="show" />
<field name="product_id" />
<field
Expand Down Expand Up @@ -170,7 +170,7 @@
/>
<field name="company_id" column_invisible="1" />
<field name="state" optional="show" />
</tree>
</list>
</field>
</page>
</notebook>
Expand Down Expand Up @@ -227,6 +227,6 @@
<field name="name">Stock Request Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.request.order</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
12 changes: 4 additions & 8 deletions stock_request/views/stock_request_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<field name="name">stock.request.tree</field>
<field name="model">stock.request</field>
<field name="arch" type="xml">
<tree
<list
decoration-muted="state == 'cancel'"
decoration-bf="message_needaction==True"
>
Expand All @@ -32,7 +32,7 @@
<field name="qty_done" optional="show" />
<field name="qty_cancelled" optional="show" />
<field name="state" optional="show" />
</tree>
</list>
</field>
</record>
<record model="ir.ui.view" id="stock_request_search">
Expand Down Expand Up @@ -233,19 +233,15 @@
<!--Empty notebook to inherit pages from other related modules-->
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
<chatter />
</form>
</field>
</record>
<record id="action_stock_request_form" model="ir.actions.act_window">
<field name="name">Stock Requests</field>
<field name="res_model">stock.request</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form,pivot</field>
<field name="view_mode">list,form,pivot</field>
<field name="context">{
'search_default_current_requests': 1,
'pivot_column_groupby': ['location_id'], 'pivot_row_groupby': ['product_id'], 'pivot_measures': ['product_uom_qty', 'qty_done'],
Expand Down

0 comments on commit 3a49c78

Please sign in to comment.