Skip to content

Commit

Permalink
[MIG] sale_product_multi_add: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Jan 13, 2025
1 parent d25ff18 commit a222645
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 37 deletions.
25 changes: 13 additions & 12 deletions sale_product_multi_add/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Sale Product Multi Add
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/17.0/sale_product_multi_add
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_product_multi_add
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_product_multi_add
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_product_multi_add
: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/sale-workflow&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -54,7 +54,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_product_multi_add%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_product_multi_add%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 All @@ -69,15 +69,16 @@ Authors
Contributors
------------

- Denis Roussel <[email protected]>
- Cédric Pigeon <[email protected]>
- Tharathip Chaweewongphan <[email protected]>
- `Pesol <https://www.pesol.es>`__:
- Denis Roussel <[email protected]>
- Cédric Pigeon <[email protected]>
- Tharathip Chaweewongphan <[email protected]>
- `Pesol <https://www.pesol.es>`__:

- Jonathan Oscategui Taza <[email protected]>
- Jonathan Oscategui Taza <[email protected]>

- Jacques-Etienne Baudoux (BCIM) <[email protected]>
- Anaïs López <[email protected]>
- Jacques-Etienne Baudoux (BCIM) <[email protected]>
- Anaïs López <[email protected]>
- Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>

Maintainers
-----------
Expand All @@ -92,6 +93,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/sale-workflow <https://github.com/OCA/sale-workflow/tree/17.0/sale_product_multi_add>`_ project on GitHub.
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_product_multi_add>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions sale_product_multi_add/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"category": "Sale Management",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"depends": ["sale"],
"depends": ["sale_stock"],
"data": [
"security/ir.model.access.csv",
"wizards/sale_import_products_view.xml",
Expand Down
1 change: 1 addition & 0 deletions sale_product_multi_add/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
- Jonathan Oscategui Taza \<<[email protected]>\>
- Jacques-Etienne Baudoux (BCIM) \<<[email protected]>\>
- Anaïs López \<<[email protected]>\>
- Heliconia Solutions Pvt. Ltd. \<<https://www.heliconia.io>\>
18 changes: 11 additions & 7 deletions sale_product_multi_add/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
: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 @@ -274,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 @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

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

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Sale Product Multi Add</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:76dc6788d1252512000fd3edaef23c4ecde388730ad5d522de42de14499555a1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/sale-workflow/tree/17.0/sale_product_multi_add"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_product_multi_add"><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/sale-workflow&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/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/sale-workflow/tree/18.0/sale_product_multi_add"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_product_multi_add"><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/sale-workflow&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 extends the functionality of the Sales module by allowing
you to import multiple products into your current Sale Order.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -397,7 +398,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_product_multi_add%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/sale-workflow/issues/new?body=module:%20sale_product_multi_add%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 All @@ -420,16 +421,19 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</li>
<li>Jacques-Etienne Baudoux (BCIM) &lt;<a class="reference external" href="mailto:je&#64;bcim.be">je&#64;bcim.be</a>&gt;</li>
<li>Anaïs López &lt;<a class="reference external" href="mailto:anais.lopez&#64;forgeflow.com">anais.lopez&#64;forgeflow.com</a>&gt;</li>
<li>Heliconia Solutions Pvt. Ltd. &lt;<a class="reference external" href="https://www.heliconia.io">https://www.heliconia.io</a>&gt;</li>
</ul>
</div>
<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>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_product_multi_add">OCA/sale-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_product_multi_add">OCA/sale-workflow</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
41 changes: 32 additions & 9 deletions sale_product_multi_add/tests/test_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,55 @@ def setUp(self):

self.product_9 = self.env.ref("product.product_product_9")
self.product_11 = self.env.ref("product.product_product_11")
self.so = self.env["sale.order"].create(
[
{
"partner_id": self.env.ref("base.res_partner_2").id,
"picking_policy": "one",
}
]
)

def test_import_product(self):
"""Create SO
Import products
Check products are presents
"""

so = self.env["sale.order"].create(
{"partner_id": self.env.ref("base.res_partner_2").id}
)

wiz_obj = self.env["sale.import.products"]
wizard = wiz_obj.with_context(active_id=so.id, active_model="sale.order")
wizard = wiz_obj.with_context(active_id=self.so.id, active_model="sale.order")

products = [(6, 0, [self.product_9.id, self.product_11.id])]

wizard_id = wizard.create({"products": products})
wizard_id = wizard.create([{"products": products}])
wizard_id.create_items()
wizard_id.items[0].quantity = 4
wizard_id.items[1].quantity = 6
wizard_id.select_products()

self.assertEqual(len(so.order_line), 2)
self.assertEqual(len(self.so.order_line), 2)

for line in so.order_line:
for line in self.so.order_line:
if line.product_id.id == self.product_9.id:
self.assertEqual(line.product_uom_qty, 4)
else:
self.assertEqual(line.product_uom_qty, 6)

def test_select_products_no_vals(self):
"""Test when _get_line_values returns False"""

# Simulate a situation where _get_line_values would return False
wizard = self.env["sale.import.products"].create([])
wizard.with_context(active_id=self.so.id).select_products()

# Verify that no sale order lines are created
self.assertEqual(len(self.so.order_line), 0)

def test_select_products_empty_vals_list(self):
"""Test when vals_list is empty"""

# Simulate the scenario where no valid products are selected
wizard = self.env["sale.import.products"].create([])
wizard.with_context(active_id=self.so.id).select_products()

# Assert that no order lines are created
self.assertEqual(len(self.so.order_line), 0)
5 changes: 1 addition & 4 deletions sale_product_multi_add/views/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
/>
</field>
<field name="order_line" position="attributes">
<attribute
translation="off"
name="options"
>{'always_reload':true}</attribute>
<attribute name="options">{'always_reload':true}</attribute>
</field>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion sale_product_multi_add/wizards/sale_import_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def create_items(self):
for wizard in self:
for product in wizard.products:
self.env["sale.import.products.items"].create(
{"wizard_id": wizard.id, "product_id": product.id}
[{"wizard_id": wizard.id, "product_id": product.id}]
)
view = self.env.ref("sale_product_multi_add.view_import_product_to_sale2")
return {
Expand Down
4 changes: 2 additions & 2 deletions sale_product_multi_add/wizards/sale_import_products_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
<field name="arch" type="xml">
<form string="Products">
<field name="items">
<tree create="0" editable="bottom">
<list create="0" editable="bottom">
<field name="product_id" readonly="1" />
<field name="quantity" />
</tree>
</list>
</field>
<footer>
<button
Expand Down

0 comments on commit a222645

Please sign in to comment.