Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
1217 Tampilan

Hi -  with odoo 15 Studio I have to create an additional field in the partner form, which is showing the last delivery date for this partner-id as dropshipping address.
I created a many2one field named "last_delivery" and currently it looks like that:



but it doesn't work - no error, but no result as well - what can I do? I know,  there are records with the dropshipping address I'm looking for.



Avatar
Buang
Jawaban Terbai

Hi,

Could you change the field type to Datetime from Many2one and see if this work well.

Thanks & Regards

Avatar
Buang
Penulis

I have to correct me - it works! Thank you!

Jawaban Terbai

Hi!

Here's how you can solve your issue with displaying the last delivery date for a dropshipping partner in Odoo 15:

1. Use Odoo Studio Filters:

- Open the Studio tool and modify the partner form.

- Set the last_delivery field as a computed field.

- Write an expression that fetches the latest delivery date for the partner using the related stock.picking records. For example:

record.stock_picking_ids.filtered(lambda p: p.partner_id == record.id and p.dropship).sorted('date_done')[-1].date_done

2. Check Data Setup:

Ensure that your dropshipping records have the correct partner ID and delivery dates populated.

3. Test the Logic:

Save and test the field by navigating to a partner with dropshipping deliveries. 

Avatar
Buang