Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
312 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ