Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
309 Visualizzazioni

Hi


I am planning to replace the field upon the creation of invoice. Currently the Invoice Date is already avaiable but, the user must manually fill in the date. But, I want to automate to when the Order Date is confirmed. Is there a way for this to be performed?


Sales Quotation

Invoice

Avatar
Abbandona
Risposta migliore

Hi,

Please refer to the code:


class SaleOrder(models.Model):

    _inherit = 'sale.order'

   

def _prepare_invoice(self):

    """Function that update the date in invoice"""

    res = super(SaleOrder, self)._prepare_invoice()

    res.update({

        'invoice_date': self.date_order,

    })

    return res


Hope it helps.

Avatar
Abbandona