Skip to content

Commit

Permalink
[MIG] sale_sourced_by_line: Migration to 18.0
Browse files Browse the repository at this point in the history
[FIX] pylint error
  • Loading branch information
ajay-odoogap authored and Ajay Javiya committed Dec 17, 2024
1 parent b904f52 commit 9bf51c3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions sale_sourced_by_line/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Contributors
* Eficent Business and IT Consulting Services S.L. <[email protected]>
* Serpent Consulting Services Pvt. Ltd. <[email protected]>
* Info A Tout Prix <[email protected]>
* Ajay Javiya <[email protected]>

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

Expand Down
2 changes: 1 addition & 1 deletion sale_sourced_by_line/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Sale Sourced by Line",
"summary": "Multiple warehouse source locations for Sale order",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"author": "Camptocamp,"
"Eficent,"
"SerpentCS,"
Expand Down
18 changes: 8 additions & 10 deletions sale_sourced_by_line/model/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).


from odoo import fields, models
from odoo import api, fields, models


class SaleOrder(models.Model):
Expand All @@ -22,16 +22,14 @@ class SaleOrder(models.Model):
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

warehouse_id = fields.Many2one(
"stock.warehouse",
"Source Warehouse",
readonly=True,
related="",
help="If a source warehouse is selected, "
"it will be used to define the route. "
"Otherwise, it will get the warehouse of "
"the sale order",
@api.depends(
"route_id", "order_id.warehouse_id", "product_packaging_id", "product_id"
)
def _compute_warehouse_id(self):
"""compute the warehouse for the lines only
if it has not already been set."""
lines = self.filtered(lambda rec: not rec.warehouse_id)
return super(SaleOrderLine, lines)._compute_warehouse_id()

def _prepare_procurement_group_vals(self):
vals = super()._prepare_procurement_group_vals()
Expand Down
4 changes: 2 additions & 2 deletions sale_sourced_by_line/tests/test_sale_sourced_by_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_sales_order_multi_source(self):
self.assertEqual(
len(so.picking_ids),
2,
"2 delivery orders expected. Got %s instead" % len(so.picking_ids),
f"2 delivery orders expected. Got {len(so.picking_ids)} instead",
)
for line in so.order_line:
self.assertEqual(
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_sales_order_no_source(self):
self.assertEqual(
len(so.picking_ids),
1,
"1 delivery order expected. Got %s instead" % len(so.picking_ids),
f"1 delivery order expected. Got {len(so.picking_ids)} instead",
)

def test_sale_order_source(self):
Expand Down
2 changes: 1 addition & 1 deletion sale_sourced_by_line/view/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='order_line']/tree/field[@name='price_subtotal']"
expr="//field[@name='order_line']/list/field[@name='price_subtotal']"
position="after"
>
<field name="warehouse_id" readonly="state not in ['draft', 'sent']" />
Expand Down

0 comments on commit 9bf51c3

Please sign in to comment.