diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-14 15:21:31 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-14 15:21:31 +0700 |
| commit | 719dc824379bff729a97007432ef6871954b0980 (patch) | |
| tree | 4a10846a605d8982c482ff8fd9f5fb30a5f974c9 | |
| parent | 9768f8733053df18d9510fcab1cbeea66fa62e6e (diff) | |
bug fix
| -rw-r--r-- | indoteknik_api/controllers/api_v1/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_api/controllers/api_v1/lead.py | 26 | ||||
| -rw-r--r-- | indoteknik_api/controllers/api_v1/sale_order.py | 4 | ||||
| -rw-r--r-- | indoteknik_api/models/sale_order.py | 3 |
4 files changed, 31 insertions, 3 deletions
diff --git a/indoteknik_api/controllers/api_v1/__init__.py b/indoteknik_api/controllers/api_v1/__init__.py index 682cb369..5d5f723b 100644 --- a/indoteknik_api/controllers/api_v1/__init__.py +++ b/indoteknik_api/controllers/api_v1/__init__.py @@ -7,6 +7,7 @@ from . import district from . import download from . import flash_sale from . import invoice +from . import lead from . import manufacture from . import page_content from . import partner diff --git a/indoteknik_api/controllers/api_v1/lead.py b/indoteknik_api/controllers/api_v1/lead.py new file mode 100644 index 00000000..df4f46bd --- /dev/null +++ b/indoteknik_api/controllers/api_v1/lead.py @@ -0,0 +1,26 @@ +from .. import controller +from odoo import http +from odoo.http import request + +class Lead(controller.Controller): + @http.route('/api/v1/lead', auth='public', methods=['POST', 'OPTIONS'], csrf=False) + @controller.Controller.must_authorized() + def create_lead(self, **kw): + params = self.get_request_params(kw, { + "name": ["required"], + "contact_name": [], + "email_from": [], + "phone": [], + "file_npwp": [], + "file_nib": [], + "file_tdp": [], + "file_siup": [], + "description": [] + }) + + if not params['valid']: + return self.response(code=400, description=params) + + lead = request.env['crm.lead'].create(params['value']) + + return self.response(True)
\ No newline at end of file diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py index 76fbfddb..e019b325 100644 --- a/indoteknik_api/controllers/api_v1/sale_order.py +++ b/indoteknik_api/controllers/api_v1/sale_order.py @@ -232,7 +232,7 @@ class SaleOrder(controller.Controller): parameters = { 'warehouse_id': 8, 'carrier_id': 1, - 'sales_tax_id': 23, + 'sales_tax_id': 21, 'pricelist_id': product_pricelist_default_discount_id, 'payment_term_id': 26, 'team_id': 2, @@ -259,7 +259,7 @@ class SaleOrder(controller.Controller): 'order_id': sale_order.id, 'product_id': line['product_id'], 'product_uom_qty': line['quantity'], - 'price_subtotal': product._get_website_price_exclude_tax(), + 'price_unit': product._get_website_price_exclude_tax(), 'discount': product._get_website_disc(0) }) request.env['sale.order.line'].create(parameters) diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index 2b6bef37..21ee9396 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -10,6 +10,7 @@ class SaleOrder(models.Model): 'id': sale_order.id, 'name': sale_order.name, 'sales': sale_order.user_id.name, + 'amount_untaxed': sale_order.amount_untaxed, 'amount_tax': sale_order.amount_tax, 'amount_total': sale_order.amount_total, 'purchase_order_name': sale_order.partner_purchase_order_name, @@ -58,7 +59,7 @@ class SaleOrder(models.Model): for line in sale_order.order_line: product = self.env['product.product'].api_single_response(line.product_id) product['price'] = { - 'price': line.price_unit / 1.11, + 'price': line.price_unit, 'discount_percentage': line.discount, 'price_discount': line.price_reduce_taxexcl, 'subtotal': line.price_subtotal |
