Hii,
I have a custom field added in the header of the purchase order. When I create a PO I assign a value to with field.
I also add the same custom field to the purchase order line.
How to pass purchase order header field value to all lines?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hii,
I have a custom field added in the header of the purchase order. When I create a PO I assign a value to with field.
I also add the same custom field to the purchase order line.
How to pass purchase order header field value to all lines?
Ravi and Cybrosys solutions are also correct.
But I solved this requirement by adding Related Field with the header field.
1) you can override create and/or write and pass the order header field value to order lines
2) add onchange on a header field and pass order header field value to order lines
Hi,
Try to define an onchange method for the field in purchase order like below
@api.onchange('field_in_purchase_order')
def _onchange_field_in_purchase_order(self):
purchase_order_line_ids = self.env['purchase.order.line'].search([('order_id', '=', self.id)])
for purchase_order_line_id in purchase_order_line_ids:
purchase_order_line_id.field_in_purchase_order_line = self.field_in_purchase_orderRegards
Hii Cybrosys,
This is really fine solution for onchange method.
No I need the same on create method. For example, I select value on po header and added hundred lines. On po save I want to assign that value to all lines.
How to do it in create method?
Thanks
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się| Powiązane posty | Odpowiedzi | Widoki | Czynność | |
|---|---|---|---|---|
|
0
mar 15
|
4180 | |||
|
1
mar 20
|
6979 | |||
|
0
mar 15
|
4752 | |||
|
0
mar 15
|
3909 | |||
|
0
lis 25
|
790 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
Why??? That's an unnecessary and harmful denormalization. You can retrieve header fields from order lines.
Hii twanda AG,
We assign a shipment id to purchase order after receiving vendor bills. Shipment is by line. If a PO has hundred lines, we want to assign shipment id at once. So I think to assign value to header and then auto assign to lines is better idea.
Your further opinion please..
As Ravi Gadhia suggested.
You can use context
Hii Sehrish,
Do you have some example.
Thanks,