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:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Mar 15
|
4655 | ||
|
1
Mar 15
|
5846 | ||
|
0
Sep 21
|
2339 | ||
|
0
Aug 17
|
2221 | ||
|
3
Mar 17
|
9806 |