Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
303 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć