Hi everybody. I have a char field on sale.order named x_so_note. Now the value from this field should be transferred to the account.invoice field named x_inv_note. I inherited the sale.order and took the the def: def _prepare_invoice(self):, added the values here, it installs but not working. any ideas?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
Odoo Standard Coding style, in most cases there exists a sub-method which is used to build the list of values, that can be easily inherited in your Module & append your custom values.
However while Invoicing, there exists couple of option such as 'Downpayment' etc in that case, the control will redirected to those related objects
Thus in your case, assuming you are following default flow of invoicing, you would need to ideally write in the following manner.
@api.multi
def _prepare_invoice(self):
invoice_vals = super(SaleOrder,self)._prepare_invoice()
invoice_vals and invoice_vals.update({'x_inv_note': self.x_so_note,})
return invoice_vals
Use this code to write into any field from sale order to invoice lines.
here i'm passing a field named order_type to invoice lines.
@api.model
def _prepare_invoice(self, order, lines):
res = super(saleWorkflow, self)._prepare_invoice(order, lines)
if lines:
for i in lines:
self.env['account.invoice.line'].search([('id', '=', i)]).write(
{'order_type': order.order_type.id})
return res
Podoba Ci się ta dyskusja? Dołącz do niej!
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 25
|
1139 | ||
|
3
lut 25
|
2119 | ||
|
1
gru 24
|
2175 | ||
|
2
mar 24
|
2521 | ||
Managing orders from repeat customers
Rozwiązane
|
|
2
mar 24
|
3027 |
we solved it anyways