From 0f8b80686941cd536612a70a52edc5432b839209 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 13 Feb 2023 10:35:23 +0700 Subject: quotation to checkout --- indoteknik_api/models/sale_order.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index c7d488be..afaf6ae6 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -22,9 +22,19 @@ class SaleOrder(models.Model): data['status'] = 'waiting' if sale_order.state == 'sale': data['status'] = 'sale' + picking_count = { + 'assigned': 0, + 'done': 0, + } for picking in sale_order.picking_ids: - if picking.state == 'assigned': - data['status'] = 'shipping' + if picking.state in ['confirmed', 'assigned']: + picking_count['assigned'] += 1 + if picking.state == 'done': + picking_count['done'] += 1 + if picking_count['assigned'] > 0: + data['status'] = 'shipping' + if picking_count['done'] > 0: + data['status'] = 'partial_shipping' if sale_order.state == 'done': data['status'] = 'done' -- cgit v1.2.3 From c68437fc15bd25e00c81001a4d1324a29c50c6bd Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 13 Feb 2023 17:08:20 +0700 Subject: Bug fix --- indoteknik_api/models/account_move.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/account_move.py b/indoteknik_api/models/account_move.py index 5c31f010..9bbe8c94 100644 --- a/indoteknik_api/models/account_move.py +++ b/indoteknik_api/models/account_move.py @@ -15,7 +15,7 @@ class AccountMove(models.Model): 'sales': account_move.invoice_user_id.name, 'amount_total': account_move.amount_total, 'amount_residual': account_move.amount_residual, - 'invoice_date': '', + 'invoice_date': account_move.invoice_date.strftime('%d/%m/%Y') or '', 'efaktur': True if account_move.efaktur_document else False, } if isinstance(object, datetime.date): @@ -31,7 +31,6 @@ class AccountMove(models.Model): 'sales': account_move.invoice_user_id.name, 'amount_total': account_move.amount_total, 'amount_residual': account_move.amount_residual, - 'invoice_date': account_move.invoice_date.strftime('%d/%m/%Y') or '', 'invoice_date_due': account_move.invoice_date_due.strftime('%d/%m/%Y') or '', 'customer': res_users.api_address_response(account_move.partner_id), 'products': [], -- cgit v1.2.3 From b9cf801ad8334fe1b5be7b13b5d0483303c297c7 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 Feb 2023 11:29:15 +0700 Subject: add details in sale order api midtrans --- indoteknik_api/models/sale_order.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index 7ce8ff61..66ef27fa 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -63,3 +63,18 @@ class SaleOrder(models.Model): data_with_detail['invoices'].append(self.env['account.move'].api_v1_single_response(invoice)) data.update(data_with_detail) return data + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + def api_single_response(self, sale_order_line, context=False): + data = { + 'image': self.env['ir.attachment'].api_image('product.template', 'image_128', sale_order_line.product_id.product_tmpl_id.id), + 'item_code': sale_order_line.product_id.default_code, + 'product_name': sale_order_line.product_id.name, + 'price_before_discount': sale_order_line.price_unit * sale_order_line.product_uom_qty, + 'price_after_discount': sale_order_line.price_total, + 'tax': sale_order_line.price_tax + } + return data -- cgit v1.2.3 From 2a5d4886d2924ef9dae451c841dc3bae9478f9ab Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 22 Feb 2023 15:52:40 +0700 Subject: fix sale order status --- indoteknik_api/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index 7ce8ff61..398d1ef5 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -33,9 +33,9 @@ class SaleOrder(models.Model): picking_count['assigned'] += 1 if picking.state == 'done': picking_count['done'] += 1 - if picking_count['assigned'] > 0: + if picking_count['done'] > 0: data['status'] = 'shipping' - if picking_count['done'] > 0: + if picking_count['assigned'] > 0: data['status'] = 'partial_shipping' if sale_order.state == 'done': data['status'] = 'done' -- cgit v1.2.3 From 5c9214c1c846e61c5356e1b19341b070c2303198 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 23 Feb 2023 10:39:40 +0700 Subject: partner company type and edit partner data --- indoteknik_api/models/res_users.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py index 99a3838d..5032f3af 100644 --- a/indoteknik_api/models/res_users.py +++ b/indoteknik_api/models/res_users.py @@ -7,6 +7,7 @@ class ResUsers(models.Model): def api_single_response(self, res_user, with_detail=''): data = { 'id': res_user.id, + 'parent_id': res_user.parent_id.id or False, 'partner_id': res_user.partner_id.id, 'name': res_user.name, 'email': res_user.login, @@ -32,7 +33,11 @@ class ResUsers(models.Model): 'city': None, 'district': None, 'sub_district': None, - 'zip': user.zip or '' + 'zip': user.zip or '', + 'company_type_id': user.company_type_id.id or None, + 'industry_id': user.industry_id.id or None, + 'tax_name': user.nama_wajib_pajak or '', + 'npwp': user.npwp or '', } if user.kota_id: -- cgit v1.2.3