mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX]stock_request_direction: fixed an error while on click on one2many editabe tree on sro request model
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
../../../../stock_request_direction
|
||||||
6
setup/stock_request_direction/setup.py
Normal file
6
setup/stock_request_direction/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Stock Requests Direction",
|
"name": "Stock Requests Direction",
|
||||||
"summary": "From or to your warehouse?",
|
"summary": "From or to your warehouse?",
|
||||||
"version": "14.0.1.0.0",
|
"version": "14.0.1.0.1",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||||
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ class StockRequest(models.Model):
|
|||||||
|
|
||||||
@api.onchange("direction")
|
@api.onchange("direction")
|
||||||
def _onchange_location_id(self):
|
def _onchange_location_id(self):
|
||||||
if self.direction == "outbound":
|
if not self._context.get("default_location_id"):
|
||||||
# Stock Location set to Partner Locations/Customers
|
if self.direction == "outbound":
|
||||||
self.location_id = self.company_id.partner_id.property_stock_customer.id
|
# Stock Location set to Partner Locations/Customers
|
||||||
else:
|
self.location_id = self.company_id.partner_id.property_stock_customer.id
|
||||||
# Otherwise the Stock Location of the Warehouse
|
else:
|
||||||
self.location_id = self.warehouse_id.lot_stock_id.id
|
# Otherwise the Stock Location of the Warehouse
|
||||||
|
self.location_id = self.warehouse_id.lot_stock_id.id
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<field name="inherit_id" ref="stock_request.stock_request_order_form" />
|
<field name="inherit_id" ref="stock_request.stock_request_order_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='warehouse_id']" position="after">
|
<xpath expr="//field[@name='warehouse_id']" position="after">
|
||||||
<field name="direction" required="1" />
|
<field name="direction" />
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='stock_request_ids']" position="attributes">
|
<xpath expr="//field[@name='stock_request_ids']" position="attributes">
|
||||||
<attribute name="context">{
|
<attribute name="context">{
|
||||||
|
|||||||
@@ -108,18 +108,29 @@ class TestStockRequestOrder(TestStockRequest):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
form = Form(self.env["stock.request.order"])
|
stock_request_order_obj = self.env["stock.request.order"]
|
||||||
form.company_id = self.main_company
|
vals = {
|
||||||
form.expected_date = expected_date
|
"company_id": self.main_company.id,
|
||||||
form.warehouse_id = self.warehouse
|
"expected_date": expected_date,
|
||||||
form.location_id = self.warehouse.lot_stock_id
|
"warehouse_id": self.warehouse.id,
|
||||||
form.save()
|
"location_id": self.warehouse.lot_stock_id.id,
|
||||||
|
}
|
||||||
|
stock_request_order_new = stock_request_order_obj.new(vals)
|
||||||
|
|
||||||
# Test onchange_warehouse_picking_id
|
# Test onchange_warehouse_picking_id
|
||||||
form.warehouse_id = wh
|
stock_request_order_new.onchange_warehouse_picking_id()
|
||||||
form.save()
|
vals.update(
|
||||||
|
stock_request_order_new.sudo()._convert_to_write(
|
||||||
|
{
|
||||||
|
name: stock_request_order_new[name]
|
||||||
|
for name in stock_request_order_new._cache
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
vals.update({"warehouse_id": wh.id})
|
||||||
|
stock_request_order = stock_request_order_obj.create(vals)
|
||||||
|
|
||||||
self.assertEqual(form.picking_type_id, new_pick_type)
|
self.assertEqual(stock_request_order.picking_type_id, new_pick_type)
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
expected_date = fields.Datetime.now()
|
expected_date = fields.Datetime.now()
|
||||||
|
|||||||
Reference in New Issue
Block a user