diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-07-24 15:58:16 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-07-24 15:58:16 +0700 |
| commit | 5c87386fadb7f24ecbd33490cb838a879a48bd33 (patch) | |
| tree | 661d8524f4b6f2c3f2ab0b6f98a89897d99566a3 | |
| parent | bf294f65fa5ff2f1974e0b2766a4a4469193fe3a (diff) | |
fix bug mail template
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 10 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/views/mail_template_invoice_po.xml | 2 | ||||
| -rwxr-xr-x | 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 @@ <p>Dengan Hormat Bpk/Ibu ${object.partner_id.name},</p> <br/> <p>Berikut terlampir pesanan pembelian <strong>${object.name}</strong> sebesar <strong>${format_amount(object.amount_total, object.currency_id)}</strong> dari PT. INDOTEKNIK DOTCOM GEMILANG.</p> - <p>Barang telah diterima pada tanggal ${format_date(object.picking_ids[0].date_done)}.</p> + <p>Barang telah diterima pada tanggal ${format_date(object.date_done_picking)}.</p> <br/> <p>Tolong dibantu kirimkan softcopy invoice, surat jalan, dan faktur pajak atas PO terlampir dengan membalas email ini.</p> <p>Dan kirimkan dokumen asli yang lengkap ke alamat :</p> 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 @@ <field name="total_so_margin"/> <field name="total_percent_margin"/> <field name="total_so_percent_margin"/> - <button name="re_calculate" - string="Re Calculate" - type="object" - attrs="{'invisible': [('approval_status', '=', 'approved')]}" - /> </field> <field name="product_id" position="before"> <field name="line_no" attrs="{'readonly': 1}" optional="hide"/> |
