# How to include other model/origin in shipment in (incoming moves)

**URL:** https://discuss.tryton.org/t/how-to-include-other-model-origin-in-shipment-in-incoming-moves/1141
**Category:** Developer
**Tags:** stock
**Created:** [February 16, 2019, 7:32pm UTC](https://discuss.tryton.org/t/how-to-include-other-model-origin-in-shipment-in-incoming-moves/1141 "2019-02-16T19:32:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bala4901](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@bala4901](https://discuss.tryton.org/u/bala4901)
#### Post date: [February 16, 2019, 7:32pm UTC](https://discuss.tryton.org/t/how-to-include-other-model-origin-in-shipment-in-incoming-moves/1141/1 "2019-02-16T19:32:58Z")

</div>

Hi,

Our warehouse going to implement ASN (Advance Shipping Notice).  
I want to use shipment Supplier to get the ASN through Incoming moves.

ASN here is same as purchase\_line and after confirm ASN, it will write into stock\_move with from\_location = supplier type, to\_location= input (storage type).

In the move class, i added the \_get\_origin with new model “goods.in.advice”.  
When click on “Shipment Supplier” add (incoming moves), it still cannot select the goods.in.advice model. But it select on origin only from purchase\_line. Below I attached the sql from log.  
How to add the new model in “incoming\_moves”?

```
SELECT "a"."id" AS "id", "a"."unit_price" AS "unit_price",
       "a"."currency" AS "currency",
       "a"."quantity" AS "quantity",
       "a"."to_storage_location" AS "to_storage_location",
       "a"."write_date" AS "write_date",
       "a"."effective_date" AS "effective_date",
       "a"."stock_unit" AS "stock_unit",
       "a"."to_location" AS "to_location",
       "a"."state" AS "state",
       "a"."unit_load" AS "unit_load",
       "a"."product" AS "product",
       "a"."create_uid" AS "create_uid",
       "a"."package" AS "package",
       "a"."lot" AS "lot",
       "a"."cost_price" AS "cost_price",
       "a"."uom" AS "uom",
       "a"."write_uid" AS "write_uid",
       "a"."from_location" AS "from_location",
       "a"."company" AS "company",
       "a"."internal_quantity" AS "internal_quantity",
       "a"."create_date" AS "create_date",
       "a"."from_storage_location" AS "from_storage_location",
       "a"."planned_date" AS "planned_date",
       cast(extract(\'EPOCH\' FROM COALESCE("a"."write_date", "a"."create_date")) AS VARCHAR) AS "_timestamp" FROM "stock_move" AS "a" WHERE (((("a"."from_location" = 5) AND ("a"."to_location" = 1) AND ("a"."company" = 1) AND **(((CAST(SUBSTRING("a"."origin" FROM (POSITION(\',\' IN "a"."origin") + 1)) AS INT4) IN (SELECT "b"."id" AS "id" FROM "purchase_line" AS "b" LEFT JOIN "purchase_purchase" AS "c" ON ("c"."id" = "b"."purchase") WHERE ((("c"."party" = 2) AND ((("c"."company" = 1))))))) AND ("a"."origin" ILIKE \'purchase.line,%\'))) AND ("a"."shipment" IS NULL) AND ("a"."from_location" = 5) AND ("a"."state" = \'draft\') AND ("a"."to_location" = 1)) OR FALSE)
AND ((("a"."company" = 1))))
ORDER BY "a"."id" DESC
LIMIT 1000

```

---

<div class="post-metadata">

### Author: ![bala4901](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@bala4901](https://discuss.tryton.org/u/bala4901)
#### Post date: [February 17, 2019, 4:23am UTC](https://discuss.tryton.org/t/how-to-include-other-model-origin-in-shipment-in-incoming-moves/1141/2 "2019-02-17T04:23:40Z")

</div>

Hi,

Sorry, I am going too deep. It was my wrong understanding.  
stock.shipment.in \> incoming\_moves at purchase module added add\_remove condition of supplier.

My understanding is fields.function(onetomany) using “getter” to get value and compare. However, after troubleshooting, it used “searcher” to get condition.

After I inherit the “search\_supplier” from purchase/stock.py, the result shown expectedly.

Thank

Best regards
