# Write different field values to records

**URL:** https://discuss.tryton.org/t/write-different-field-values-to-records/4866
**Category:** Developer
**Created:** [December 16, 2021, 6:40pm UTC](https://discuss.tryton.org/t/write-different-field-values-to-records/4866 "2021-12-16T18:40:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![locx](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/l/f04885/32.png) [@locx](https://discuss.tryton.org/u/locx)
#### Post date: [December 16, 2021, 6:40pm UTC](https://discuss.tryton.org/t/write-different-field-values-to-records/4866/1 "2021-12-16T18:40:20Z")

</div>

Suppose I have two shipments (in a list called `shipments_out`), and I want to assign the **same** `effective_date` to both of them. I do this and it works:

```auto
Shipment_Out = Model.get('stock.shipment.out')
Shipment_Out.write( shipments_out[:2] , {'effective_date': datetime.date(2021,11,29) } , context = config.context )

```

But if I want to set **different** effective dates for the two shipments, how do I do it using the write method?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [December 16, 2021, 10:17pm UTC](https://discuss.tryton.org/t/write-different-field-values-to-records/4866/2 "2021-12-16T22:17:58Z")

</div>

I guess you are using proteus.  
The [`ModelStorage.write`](https://docs.tryton.org/projects/server/en/latest/ref/models/models.html#trytond.model.ModelStorage.write) method can take as many as argument as needed. So you can call it like:

`ShipmentOut.write(shipments[0:1], {'effective_date': ...}, shipments[1:2], {'effective_date': ...}, config.context)`

But also you can use the oriented-object design with:

```auto
shipments[0].effective_date = ...
shipments[1].effective_date = ...
ShipmentOut.save(shipments)

```

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [January 15, 2022, 10:18pm UTC](https://discuss.tryton.org/t/write-different-field-values-to-records/4866/3 "2022-01-15T22:18:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
