Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
274 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง