-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
17.0 mig sale force manual delivered (#16)
* [17.0][MIG] sale_force_manual_delivered: Migration to 17.0 --------- Co-authored-by: GarethGloSystems <[email protected]> Co-authored-by: Karl <[email protected]> Co-authored-by: Kobby Folson <[email protected]>
- Loading branch information
1 parent
8f4cbe5
commit 079c298
Showing
9 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sale_force_manual_delivered | ||
--------------------------- | ||
|
||
Generalises force_manual_delivered_qty from TC's wwuk_sales_order | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "sale_forced_manual_delivered_qty", | ||
"summary": "Allow forced manual delivery", | ||
"author": "Glo Networks", | ||
"website": "https://github.com/GlodoUK/sale", | ||
"category": "Sales", | ||
"version": "17.0.1.0.0", | ||
"depends": ["sale_stock"], | ||
"data": [ | ||
"views/sale_order.xml", | ||
], | ||
"license": "LGPL-3", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import sale_order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class SaleOrderLine(models.Model): | ||
_inherit = "sale.order.line" | ||
|
||
force_manual_delivered_qty = fields.Boolean(default=False) | ||
|
||
@api.depends("force_manual_delivered_qty", "is_expense", "state") | ||
def _compute_qty_delivered_method(self): | ||
res = super()._compute_qty_delivered_method() | ||
for line in self.filtered( | ||
lambda order_line: order_line.force_manual_delivered_qty | ||
): | ||
if line.force_manual_delivered_qty: | ||
line.qty_delivered_method = "manual" | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_force_manual_delivered_qty |
32 changes: 32 additions & 0 deletions
32
sale_force_manual_delivered/tests/test_force_manual_delivered_qty.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from odoo.tests import tagged | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestForceManualDeliveredQty(TransactionCase): | ||
def setUp(self): | ||
super().setUp() | ||
|
||
self.partner_id = self.env["res.partner"].create({"name": "Test Partner"}) | ||
|
||
self.product_id = self.env["product.product"].create({"name": "Product A"}) | ||
|
||
def test_force_manual_delivered_qty(self): | ||
sale_order_id = self.env["sale.order"].create( | ||
{ | ||
"partner_id": self.partner_id.id, | ||
"order_line": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"product_id": self.product_id.id, | ||
"product_uom_qty": 1.0, | ||
}, | ||
) | ||
], | ||
} | ||
) | ||
sale_order_id.order_line[0].force_manual_delivered_qty = True | ||
|
||
self.assertEqual(sale_order_id.order_line[0].qty_delivered_method, "manual") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version='1.0' encoding='utf-8' ?> | ||
<odoo> | ||
<record id="glodo_sale_view_order_form" model="ir.ui.view"> | ||
<field name="name">glodo_sale_view_order_form</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath | ||
expr="//field[@name='order_line']/tree//field[@name='qty_delivered']" | ||
position="after" | ||
> | ||
<field | ||
name="force_manual_delivered_qty" | ||
string="Manual Delivered Qty" | ||
column_invisible="parent.state in ['cancel','done']" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |