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

Hi,

I've created a custom field (x_my_custom_field_description for ex)  in sale_order views that allows the user to add a description of the invoice (settings -> database structure -> fields -> new field). 

This works fine but I would like to display the description text (read only) in the invoice view as well. I've tried many things but nothing works. Could you please tell me if there is a way to do this  directly from the interface (settings -> database -> ... / not using a custom module with python code) 

形象
丢弃
最佳答案

Hi,

I doubt with what exactly you are asking. If you are looking to add fields to the sale.order and to account.invoice, you have two define two fields in the corresponding models. See this video and see how a new field is added in the sale.order model from the front end as you described: How To Add custom field from UI Without Code


For adding fields to account.invoice , activate developer mode and navigate to Settings -> Technical -> Database Structures-> Models, search the account.invoice model and add the field there and later add the field to corresponding view.


If you are looking to get the value from the sale to invoice in the newly added field, you can try by adding a compute field.

Thanks

形象
丢弃
编写者

Hi @Niyas raphy,

Thanks for your help.

I know how to create a field, modify the views, etc.... But what I'm looking for is to create a field in sale.order and add the content of this field into an invoice.

What I'm looking for is :

-> Get the content of a custom field of a sale order

-> Add the content of this cutom field to the invoice related to the sale order

I've tried many things like many2one fields, etc. but nothing was working.

Your solution of a compute field could be the solution. Could you please explain me how to do it ?

编写者

Hi,

Unfortunately I have odoo 10 community version and the video seems to use another version. So I can't easily replicate the procedure? Would it be possible to explain how to do it ?

Thanks for your help

编写者

Found an (ugly) way to realize what I'm looking for. i've created two fields x_my_custom_field inside my two models (sale.order and invoice). Then I manually update the field in the invoice table based on the value of sale_order field when both of them have the same origin/name. i could add a trigger to automatically do the update but I don't want to modify to much the database.

If someone have a better way to do this... I'll be more than happy to try it :)

相关帖文 回复 查看 活动
4
12月 24
30699
1
12月 24
1456
3
6月 23
2124
1
6月 23
2488
2
6月 23
2078