code_explorer
code_explorer

Reputation: 480

How to pass values from sale to invoice (through invoiceable lines) in odoo10?

class SaleAdvancePaymentInv(models.TransientModel):

_inherit = "sale.advance.payment.inv"

@api.multi

def _create_invoice(self, order, so_line, amount):

    inv_obj = super(SaleAdvancePaymentInv, self)._create_invoice(order, so_line, amount)

    inv_obj.write({'service_id':order.service_id.id})

This is my code.service id does not pass sale order to invoice through invoiceable lines.

But when I use downpayment the service id is passed to invoice.

*What is the reason behind this.?

How to pass the values through the invoiceable line?*

Upvotes: 1

Views: 611

Answers (1)

code_explorer
code_explorer

Reputation: 480

@api.multi
def _prepare_invoice(self):
    dict_obj = super(SaleOrder, self)._prepare_invoice()
    dict_obj.update({'service_id': self.service_id.id})

I override the prepare invoice function update the service value in dictionary

Upvotes: 1

Related Questions