I have created a field "x_workorder" in Sale Order. Now, I want to transfer the field data to invoice on time of Invoice creation from SO. How can I do that...
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- Project
- MRP
此问题已终结
Hi Debashis,
First for transfer of any fields from one model to another create the field in both model here in your case you have create a field in sale.order
so again create the same type of field in account.invoice
table.
after that pass that value from sale.order
to account.invoice
, if you seen in the sale.py
file you will see a def function while for creating invoice and values :
def _prepare_invoice(self, cr, uid, order, lines, context=None):
enter code here over here you may pass ur value which will go n store in fields define in account.invoice
table
ex . if you created a field in sale.order
x_workorder
create also field in account.invoice
after that come in this def function and inside :
invoice_vals = {
'yourfieldinaccount.invoice': order.x_workorder ,
}
then you find the value in invoice as well and yep use proper xml too.
Hope this will help .
For creating "account.invoice" from "sale.order" there is four selection option
delivered
all
percentage
fixed
I tried a function "def action_invoice_create(self, grouped=False, final=False): " using super in inherited sale.order.
It works fine for sending a field value from sale.order to account.invoice, when the selection field is "delivered" or "all".
But it doesn't work for "percentage" and "fixed" selections.
So I used another function "def _create_invoice(self, order, so_line, amount):" using super in inherited wizard/sale_make_invoice_advance.py
It propagated the field value from sale.order to account.invoice successfully.
I have tested it in debug also.
Does it right way to achieve? or any other way?
Note: I worked on ODOO9
instead of "def action_invoice_create(self, grouped=False, final=False): " I tried with "def _prepare_invoice(self, cr, uid, order, lines, context=None):" also. But same happened it's not working for "percentage" and "fixed" selections.
相关帖文 | 回复 | 查看 | 活动 | |
---|---|---|---|---|
|
0
3月 15
|
5558 | ||
|
1
3月 15
|
7017 | ||
|
0
9月 21
|
3354 | ||
|
0
8月 17
|
3041 | ||
|
3
3月 17
|
10745 |