[FIX]stock_request_direction: fixed an error while on click on one2many editabe tree on sro request model

This commit is contained in:
Vimal Patel
2021-09-02 15:31:05 +05:30
committed by Freni Patel
parent 8f7de0989c
commit aa31b5c09a
6 changed files with 36 additions and 17 deletions

View File

@@ -4,7 +4,7 @@
{
"name": "Stock Requests Direction",
"summary": "From or to your warehouse?",
"version": "14.0.1.0.0",
"version": "14.0.1.0.1",
"license": "LGPL-3",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Open Source Integrators, Odoo Community Association (OCA)",

View File

@@ -16,9 +16,10 @@ class StockRequest(models.Model):
@api.onchange("direction")
def _onchange_location_id(self):
if self.direction == "outbound":
# Stock Location set to Partner Locations/Customers
self.location_id = self.company_id.partner_id.property_stock_customer.id
else:
# Otherwise the Stock Location of the Warehouse
self.location_id = self.warehouse_id.lot_stock_id.id
if not self._context.get("default_location_id"):
if self.direction == "outbound":
# Stock Location set to Partner Locations/Customers
self.location_id = self.company_id.partner_id.property_stock_customer.id
else:
# Otherwise the Stock Location of the Warehouse
self.location_id = self.warehouse_id.lot_stock_id.id

View File

@@ -17,7 +17,7 @@
<field name="inherit_id" ref="stock_request.stock_request_order_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='warehouse_id']" position="after">
<field name="direction" required="1" />
<field name="direction" />
</xpath>
<xpath expr="//field[@name='stock_request_ids']" position="attributes">
<attribute name="context">{