From 5c87386fadb7f24ecbd33490cb838a879a48bd33 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 24 Jul 2024 15:58:16 +0700 Subject: fix bug mail template --- indoteknik_custom/models/purchase_order.py | 10 +++++++++- indoteknik_custom/models/sale_order.py | 1 + indoteknik_custom/views/mail_template_invoice_po.xml | 2 +- indoteknik_custom/views/purchase_order.xml | 5 ----- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index e5d44178..85d68874 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -65,7 +65,15 @@ class PurchaseOrder(models.Model): ('not_printed', 'Belum Print'), ('printed', 'Printed') ], string='Printed?', copy=False, tracking=True) + date_done_picking = fields.Datetime(string='Date Done Picking', compute='get_date_done') + def get_date_done(self): + picking = self.env['stock.picking'].search([ + ('purchase_id', '=', self.id), + ('state', '=', 'done') + ], limit=1, order='create_date desc') + + self.date_done_picking = picking.date_done def _prepare_invoice(self): """Prepare the dict of values to create the new invoice for a purchase order. """ @@ -141,7 +149,7 @@ class PurchaseOrder(models.Model): 'location_dest_id': self._get_destination_location(), 'location_id': self.partner_id.property_stock_supplier.id, 'company_id': self.company_id.id, - 'sale_order': sale_order, + 'sale_order': sale_order } @api.model diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 7e39f550..816ec3b1 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -568,6 +568,7 @@ class SaleOrder(models.Model): def action_confirm(self): for order in self: + order.sale_order_approve() order._validate_order() order.order_line.validate_line() diff --git a/indoteknik_custom/views/mail_template_invoice_po.xml b/indoteknik_custom/views/mail_template_invoice_po.xml index 2f5e7490..9ad98fb0 100644 --- a/indoteknik_custom/views/mail_template_invoice_po.xml +++ b/indoteknik_custom/views/mail_template_invoice_po.xml @@ -14,7 +14,7 @@

Dengan Hormat Bpk/Ibu ${object.partner_id.name},


Berikut terlampir pesanan pembelian ${object.name} sebesar ${format_amount(object.amount_total, object.currency_id)} dari PT. INDOTEKNIK DOTCOM GEMILANG.

-

Barang telah diterima pada tanggal ${format_date(object.picking_ids[0].date_done)}.

+

Barang telah diterima pada tanggal ${format_date(object.date_done_picking)}.


Tolong dibantu kirimkan softcopy invoice, surat jalan, dan faktur pajak atas PO terlampir dengan membalas email ini.

Dan kirimkan dokumen asli yang lengkap ke alamat :

diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 08ab8691..142c13d8 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -46,11 +46,6 @@ -