跳至内容
菜单
此问题已终结
2 回复
3819 查看

Hi

I have created a selection field in studio, "_studio_revision" on my product.template. Then i have also created a relation field to that on the Purchase Order Line. When adding a new product on Purchase Order Line, the product revision is automatically fetched from Product. However, I do not want the Purchase Order Line to be updated with latest product revision if the product is revised, i.e. the product revision on Purchase Order shall be static for traceability.


Does anyone know how to turn up updates of my related field on Purchase Order Line, preferably using studio since Im a newbie and do not have access to database?


All help appreciated,
Rickard

形象
丢弃
编写者 最佳答案

After some investigation I managed to solve this myself.

Instead of creating a relation field, I created an independent field for product revision on purchase order line, x_studio_purchase_order_line_revision. Then I created an automated action on purchase order line creation that execute python code:

for rec in records:
record['x_studio_purchase_order_line_revision'] = record.x_studio_revision

By doing this I can keep record of which product revision that was specified on historic purchases.

形象
丢弃
最佳答案

Hi, i have the same problem,i try your solution but in my case the orifinal field is in purchase.lines and i want to copy it to a field in stock.moves, but it did not works if i try to use this solution in the same Module it works. I try product_id.purchase_order_line_ids.x_studio_custom_field, but show me an error

形象
丢弃
相关帖文 回复 查看 活动
0
6月 22
23
4
6月 25
3389
3
9月 24
1206
0
11月 23
1126
2
2月 23
1932