mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX] rma: bad field reference in rma line
This commit is contained in:
@@ -596,7 +596,6 @@ class RmaOrderLine(models.Model):
|
||||
operation.location_id.id
|
||||
or operation.in_warehouse_id.lot_rma_id.id
|
||||
or operation.out_warehouse_id.lot_rma_id.id
|
||||
or warehouse.lot_rma_id.id
|
||||
),
|
||||
}
|
||||
return data
|
||||
|
||||
@@ -29,11 +29,11 @@ class StockWarehouse(models.Model):
|
||||
"for this warehouse.",
|
||||
)
|
||||
rma_customer_pull_id = fields.Many2one(
|
||||
comodel_name="stock.location.route",
|
||||
comodel_name="stock.route",
|
||||
string="RMA Customer Route",
|
||||
)
|
||||
rma_supplier_pull_id = fields.Many2one(
|
||||
comodel_name="stock.location.route",
|
||||
comodel_name="stock.route",
|
||||
string="RMA Supplier Route",
|
||||
)
|
||||
|
||||
@@ -196,7 +196,7 @@ class StockWarehouse(models.Model):
|
||||
"warehouse_id": self.id,
|
||||
"company_id": self.company_id.id,
|
||||
"location_src_id": customer_loc.id,
|
||||
"location_id": self.lot_rma_id.id,
|
||||
"location_dest_id": self.lot_rma_id.id,
|
||||
"procure_method": "make_to_stock",
|
||||
"picking_type_id": self.rma_cust_in_type_id.id,
|
||||
"active": True,
|
||||
@@ -213,7 +213,7 @@ class StockWarehouse(models.Model):
|
||||
"warehouse_id": self.id,
|
||||
"company_id": self.company_id.id,
|
||||
"location_src_id": self.lot_rma_id.id,
|
||||
"location_id": customer_loc.id,
|
||||
"location_dest_id": customer_loc.id,
|
||||
"procure_method": "make_to_stock",
|
||||
"picking_type_id": self.rma_cust_out_type_id.id,
|
||||
"active": True,
|
||||
@@ -243,7 +243,7 @@ class StockWarehouse(models.Model):
|
||||
"warehouse_id": self.id,
|
||||
"company_id": self.company_id.id,
|
||||
"location_src_id": supplier_loc.id,
|
||||
"location_id": self.lot_rma_id.id,
|
||||
"location_dest_id": self.lot_rma_id.id,
|
||||
"procure_method": "make_to_stock",
|
||||
"picking_type_id": self.rma_sup_in_type_id.id,
|
||||
"active": True,
|
||||
@@ -260,7 +260,7 @@ class StockWarehouse(models.Model):
|
||||
"warehouse_id": self.id,
|
||||
"company_id": self.company_id.id,
|
||||
"location_src_id": self.lot_rma_id.id,
|
||||
"location_id": supplier_loc.id,
|
||||
"location_dest_id": supplier_loc.id,
|
||||
"procure_method": "make_to_stock",
|
||||
"picking_type_id": self.rma_sup_out_type_id.id,
|
||||
"active": True,
|
||||
@@ -272,7 +272,7 @@ class StockWarehouse(models.Model):
|
||||
return rma_route
|
||||
|
||||
def _create_rma_pull(self):
|
||||
route_obj = self.env["stock.location.route"]
|
||||
route_obj = self.env["stock.route"]
|
||||
for wh in self:
|
||||
if not wh.rma_customer_pull_id:
|
||||
wh.rma_customer_pull_id = (
|
||||
|
||||
@@ -1083,9 +1083,9 @@ class TestRma(common.TransactionCase):
|
||||
self.wh.reception_steps = "two_steps"
|
||||
self.wh.delivery_steps = "pick_ship"
|
||||
cust_in_pull_rule = self.customer_route.rule_ids.filtered(
|
||||
lambda r: r.location_id == self.stock_rma_location
|
||||
lambda r: r.location_dest_id == self.stock_rma_location
|
||||
)
|
||||
cust_in_pull_rule.location_id = self.input_location
|
||||
cust_in_pull_rule.location_dest_id = self.input_location
|
||||
cust_out_pull_rule = self.customer_route.rule_ids.filtered(
|
||||
lambda r: r.location_src_id == self.env.ref("rma.location_rma")
|
||||
)
|
||||
@@ -1097,7 +1097,7 @@ class TestRma(common.TransactionCase):
|
||||
"action": "pull",
|
||||
"warehouse_id": self.wh.id,
|
||||
"location_src_id": self.wh.lot_rma_id.id,
|
||||
"location_id": self.output_location.id,
|
||||
"location_dest_id": self.output_location.id,
|
||||
"procure_method": "make_to_stock",
|
||||
"route_id": self.customer_route.id,
|
||||
"picking_type_id": self.env.ref("stock.picking_type_internal").id,
|
||||
@@ -1109,7 +1109,7 @@ class TestRma(common.TransactionCase):
|
||||
"action": "pull",
|
||||
"warehouse_id": self.wh.id,
|
||||
"location_src_id": self.output_location.id,
|
||||
"location_id": self.customer_location.id,
|
||||
"location_dest_id": self.customer_location.id,
|
||||
"procure_method": "make_to_order",
|
||||
"route_id": self.customer_route.id,
|
||||
"picking_type_id": self.env.ref("stock.picking_type_internal").id,
|
||||
@@ -1121,7 +1121,7 @@ class TestRma(common.TransactionCase):
|
||||
"action": "pull",
|
||||
"warehouse_id": self.wh.id,
|
||||
"location_src_id": self.customer_location.id,
|
||||
"location_id": self.input_location.id,
|
||||
"location_dest_id": self.input_location.id,
|
||||
"procure_method": "make_to_stock",
|
||||
"route_id": self.customer_route.id,
|
||||
"picking_type_id": self.env.ref("stock.picking_type_internal").id,
|
||||
@@ -1133,7 +1133,7 @@ class TestRma(common.TransactionCase):
|
||||
"action": "pull",
|
||||
"warehouse_id": self.wh.id,
|
||||
"location_src_id": self.input_location.id,
|
||||
"location_id": self.wh.lot_rma_id.id,
|
||||
"location_dest_id": self.wh.lot_rma_id.id,
|
||||
"procure_method": "make_to_order",
|
||||
"route_id": self.customer_route.id,
|
||||
"picking_type_id": self.env.ref("stock.picking_type_internal").id,
|
||||
|
||||
@@ -7,14 +7,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='wh_output_stock_loc_id']" position="after">
|
||||
<field name="lot_rma_id" />
|
||||
</xpath>
|
||||
<field name="resupply_wh_ids" position="after">
|
||||
<field name="rma_in_this_wh" />
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='out_type_id']" position="after">
|
||||
<field name="rma_customer_pull_id" />
|
||||
<field name="rma_supplier_pull_id" />
|
||||
|
||||
</field>
|
||||
<xpath expr="//field[@name='out_type_id']" position="after">
|
||||
<field name="rma_cust_in_type_id" />
|
||||
<field name="rma_cust_out_type_id" />
|
||||
<field name="rma_sup_in_type_id" />
|
||||
|
||||
@@ -183,7 +183,7 @@ class RmaOrderLine(models.Model):
|
||||
raise ValidationError(_("Please define an operation first"))
|
||||
|
||||
if not operation.in_route_id or not operation.out_route_id:
|
||||
route = self.env["stock.location.route"].search(
|
||||
route = self.env["stock.route"].search(
|
||||
[("rma_selectable", "=", True)], limit=1
|
||||
)
|
||||
if not route:
|
||||
@@ -222,9 +222,7 @@ class RmaOrderLine(models.Model):
|
||||
"in_route_id": operation.in_route_id.id or route.id,
|
||||
"out_route_id": operation.out_route_id.id or route.id,
|
||||
"location_id": (
|
||||
operation.location_id.id
|
||||
or operation.in_warehouse_id.lot_rma_id.id
|
||||
or warehouse.lot_rma_id.id
|
||||
operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id
|
||||
),
|
||||
}
|
||||
return data
|
||||
|
||||
@@ -283,7 +283,7 @@ class TestRmaStockAccount(TestRma):
|
||||
"action": "pull",
|
||||
"warehouse_id": self.wh.id,
|
||||
"location_src_id": self.output_location.id,
|
||||
"location_id": self.customer_location.id,
|
||||
"location_dest_id": self.customer_location.id,
|
||||
"procure_method": "make_to_order",
|
||||
"route_id": self.customer_route.id,
|
||||
"picking_type_id": self.env.ref("stock.picking_type_internal").id,
|
||||
@@ -295,7 +295,7 @@ class TestRmaStockAccount(TestRma):
|
||||
"action": "pull",
|
||||
"warehouse_id": self.wh.id,
|
||||
"location_src_id": self.customer_location.id,
|
||||
"location_id": self.input_location.id,
|
||||
"location_dest_id": self.input_location.id,
|
||||
"procure_method": "make_to_stock",
|
||||
"route_id": self.customer_route.id,
|
||||
"picking_type_id": self.env.ref("stock.picking_type_internal").id,
|
||||
|
||||
@@ -56,7 +56,7 @@ class RmaAddAccountMove(models.TransientModel):
|
||||
if not operation:
|
||||
raise ValidationError(_("Please define an operation first"))
|
||||
if not operation.in_route_id or not operation.out_route_id:
|
||||
route = self.env["stock.location.route"].search(
|
||||
route = self.env["stock.route"].search(
|
||||
[("rma_selectable", "=", True)], limit=1
|
||||
)
|
||||
if not route:
|
||||
@@ -100,9 +100,7 @@ class RmaAddAccountMove(models.TransientModel):
|
||||
"in_route_id": operation.in_route_id.id or route.id,
|
||||
"out_route_id": operation.out_route_id.id or route.id,
|
||||
"location_id": (
|
||||
operation.location_id.id
|
||||
or operation.in_warehouse_id.lot_rma_id.id
|
||||
or warehouse.lot_rma_id.id
|
||||
operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id
|
||||
),
|
||||
}
|
||||
return data
|
||||
|
||||
@@ -134,7 +134,7 @@ class RmaOrderLine(models.Model):
|
||||
raise ValidationError(_("Please define an operation first"))
|
||||
|
||||
if not operation.in_route_id or not operation.out_route_id:
|
||||
route = self.env["stock.location.route"].search(
|
||||
route = self.env["stock.route"].search(
|
||||
[("rma_selectable", "=", True)], limit=1
|
||||
)
|
||||
if not route:
|
||||
@@ -168,9 +168,7 @@ class RmaOrderLine(models.Model):
|
||||
"receipt_policy": operation.receipt_policy,
|
||||
"currency_id": line.currency_id.id,
|
||||
"location_id": (
|
||||
operation.location_id.id
|
||||
or operation.in_warehouse_id.lot_rma_id.id
|
||||
or warehouse.lot_rma_id.id
|
||||
operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id
|
||||
),
|
||||
"refund_policy": operation.refund_policy,
|
||||
"delivery_policy": operation.delivery_policy,
|
||||
|
||||
@@ -59,7 +59,7 @@ class RmaAddPurchase(models.TransientModel):
|
||||
if not operation:
|
||||
raise ValidationError(_("Please define an operation first"))
|
||||
if not operation.in_route_id or not operation.out_route_id:
|
||||
route = self.env["stock.location.route"].search(
|
||||
route = self.env["stock.route"].search(
|
||||
[("rma_selectable", "=", True)], limit=1
|
||||
)
|
||||
if not route:
|
||||
@@ -97,9 +97,7 @@ class RmaAddPurchase(models.TransientModel):
|
||||
"out_route_id": operation.out_route_id.id or route,
|
||||
"receipt_policy": operation.receipt_policy,
|
||||
"location_id": (
|
||||
operation.location_id.id
|
||||
or operation.in_warehouse_id.lot_rma_id.id
|
||||
or warehouse.lot_rma_id.id
|
||||
operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id
|
||||
),
|
||||
"refund_policy": operation.refund_policy,
|
||||
"delivery_policy": operation.delivery_policy,
|
||||
|
||||
@@ -119,7 +119,7 @@ class RmaOrderLine(models.Model):
|
||||
if not operation:
|
||||
raise ValidationError(_("Please define an operation first"))
|
||||
if not operation.in_route_id or not operation.out_route_id:
|
||||
route = self.env["stock.location.route"].search(
|
||||
route = self.env["stock.route"].search(
|
||||
[("rma_selectable", "=", True)], limit=1
|
||||
)
|
||||
if not route:
|
||||
@@ -153,9 +153,7 @@ class RmaOrderLine(models.Model):
|
||||
"receipt_policy": operation.receipt_policy,
|
||||
"currency_id": line.currency_id.id,
|
||||
"location_id": (
|
||||
operation.location_id.id
|
||||
or operation.in_warehouse_id.lot_rma_id.id
|
||||
or warehouse.lot_rma_id.id
|
||||
operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id
|
||||
),
|
||||
"refund_policy": operation.refund_policy,
|
||||
"delivery_policy": operation.delivery_policy,
|
||||
|
||||
@@ -95,7 +95,7 @@ class RmaAddSale(models.TransientModel):
|
||||
if not operation:
|
||||
raise ValidationError(_("Please define an operation first"))
|
||||
if not operation.in_route_id or not operation.out_route_id:
|
||||
route = self.env["stock.location.route"].search(
|
||||
route = self.env["stock.route"].search(
|
||||
[("rma_selectable", "=", True)], limit=1
|
||||
)
|
||||
if not route:
|
||||
|
||||
Reference in New Issue
Block a user