summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_api/controllers/api_v1/banner.py2
-rw-r--r--indoteknik_api/controllers/api_v1/flash_sale.py3
-rw-r--r--indoteknik_api/controllers/api_v1/sale_order.py38
-rw-r--r--indoteknik_api/models/product_pricelist.py14
-rw-r--r--indoteknik_api/models/sale_order.py6
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rw-r--r--indoteknik_custom/models/commision.py1
-rw-r--r--indoteknik_custom/models/product_pricelist.py1
-rw-r--r--indoteknik_custom/models/promotion/promotion_program_line.py5
-rwxr-xr-xindoteknik_custom/models/purchase_order.py54
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py2
-rwxr-xr-xindoteknik_custom/models/sale_order.py16
-rw-r--r--indoteknik_custom/models/sale_order_line.py13
-rw-r--r--indoteknik_custom/models/sales_order_reject.py15
-rw-r--r--indoteknik_custom/models/shipment_group.py5
-rw-r--r--indoteknik_custom/models/solr/promotion_program.py15
-rw-r--r--indoteknik_custom/models/solr/promotion_program_line.py5
-rw-r--r--indoteknik_custom/models/solr/x_banner_banner.py4
-rw-r--r--indoteknik_custom/models/stock_move.py1
-rw-r--r--indoteknik_custom/models/stock_picking.py13
-rwxr-xr-xindoteknik_custom/models/x_banner_banner.py4
-rw-r--r--indoteknik_custom/report/report_sale_order.xml7
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv1
-rw-r--r--indoteknik_custom/views/customer_commision.xml1
-rw-r--r--indoteknik_custom/views/product_pricelist.xml1
-rw-r--r--indoteknik_custom/views/promotion/promotion_program.xml21
-rwxr-xr-xindoteknik_custom/views/sale_order.xml23
-rw-r--r--indoteknik_custom/views/shipment_group.xml1
-rw-r--r--indoteknik_custom/views/stock_picking.xml23
-rwxr-xr-xindoteknik_custom/views/x_banner_banner.xml2
30 files changed, 260 insertions, 38 deletions
diff --git a/indoteknik_api/controllers/api_v1/banner.py b/indoteknik_api/controllers/api_v1/banner.py
index d1ebf573..308d2765 100644
--- a/indoteknik_api/controllers/api_v1/banner.py
+++ b/indoteknik_api/controllers/api_v1/banner.py
@@ -40,6 +40,8 @@ class Banner(controller.Controller):
'sequence': banner.sequence,
'group_by_week': banner.group_by_week,
'image': request.env['ir.attachment'].api_image('x_banner.banner', 'x_banner_image', banner.id),
+ 'headline_banner': banner.x_headline_banner,
+ 'description_banner': banner.x_description_banner
}
if banner.group_by_week and int(banner.group_by_week) < week_number and type == 'index-a-1':
diff --git a/indoteknik_api/controllers/api_v1/flash_sale.py b/indoteknik_api/controllers/api_v1/flash_sale.py
index dff8bec3..00b1f2e0 100644
--- a/indoteknik_api/controllers/api_v1/flash_sale.py
+++ b/indoteknik_api/controllers/api_v1/flash_sale.py
@@ -14,7 +14,7 @@ class FlashSale(controller.Controller):
def _get_flash_sale_header(self, **kw):
try:
# base_url = request.env['ir.config_parameter'].get_param('web.base.url')
- active_flash_sale = request.env['product.pricelist'].get_active_flash_sale()
+ active_flash_sale = request.env['product.pricelist'].get_is_show_program_flash_sale()
data = []
for pricelist in active_flash_sale:
query = [
@@ -24,6 +24,7 @@ class FlashSale(controller.Controller):
'pricelist_id': pricelist.id,
'option': pricelist.flashsale_option,
'name': pricelist.name,
+ 'is_show_program': pricelist.is_show_program,
'banner': request.env['ir.attachment'].api_image('product.pricelist', 'banner', pricelist.id),
'banner_mobile': request.env['ir.attachment'].api_image('product.pricelist', 'banner_mobile', pricelist.id),
'banner_top': request.env['ir.attachment'].api_image('product.pricelist', 'banner_top', pricelist.id),
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py
index ee295b55..b35da7a2 100644
--- a/indoteknik_api/controllers/api_v1/sale_order.py
+++ b/indoteknik_api/controllers/api_v1/sale_order.py
@@ -9,6 +9,36 @@ class SaleOrder(controller.Controller):
prefix = '/api/v1/'
PREFIX_PARTNER = prefix + 'partner/<partner_id>/'
+ @http.route(prefix + "sale_order/<id>/reject/<product_id>", auth='public', method=['POST', 'OPTIONS'], csrf=False)
+ @controller.Controller.must_authorized()
+ def reject_sale_order_line(self, **kw):
+ so_id = int(kw.get('id', '0'))
+ product_id = int(kw.get('product_id', '0'))
+ params = self.get_request_params(kw, {
+ 'reason_reject': []
+ })
+
+ sale_order_line = request.env['sale.order.line'].search([
+ ('product_id', '=', product_id),
+ ('order_id', '=', so_id)
+ ], limit=1)
+
+ if sale_order_line:
+ parameters = {
+ 'sale_order_id': sale_order_line.order_id.id,
+ 'product_id': sale_order_line.product_id.id,
+ 'qty_reject': sale_order_line.product_uom_qty,
+ 'reason_reject': params['value']['reason_reject'],
+ }
+
+ sale_order_reject = request.env['sales.order.reject'].create(parameters)
+
+ sale_order_line.unlink()
+
+ return self.response('work')
+ else:
+ return self.response('Sale order line not found', status=404)
+
@http.route(prefix + "sale_order_number", auth='public', method=['GET', 'OPTIONS'])
@controller.Controller.must_authorized()
def get_number_sale_order(self, **kw):
@@ -97,7 +127,7 @@ class SaleOrder(controller.Controller):
return self.response(data)
@http.route(PREFIX_PARTNER + 'sale_order/<id>', auth='public', method=['GET', 'OPTIONS'])
- @controller.Controller.must_authorized(private=True, private_key='partner_id')
+ @controller.Controller.must_authorized()
def partner_get_sale_order_detail(self, **kw):
params = self.get_request_params(kw, {
'partner_id': ['number'],
@@ -313,7 +343,7 @@ class SaleOrder(controller.Controller):
return self.response(result)
@http.route(PREFIX_PARTNER + 'sale_order/checkout', auth='public', method=['POST', 'OPTIONS'], csrf=False)
- @controller.Controller.must_authorized(private=True, private_key='partner_id')
+ @controller.Controller.must_authorized()
def create_partner_sale_order(self, **kw):
config = request.env['ir.config_parameter']
product_pricelist_default_discount_id = int(config.get_param('product.pricelist.tier1_v2'))
@@ -332,6 +362,7 @@ class SaleOrder(controller.Controller):
'carrier_id': [],
'delivery_service_type': [],
'flash_sale': ['boolean'],
+ 'note_website': [],
'voucher': [],
'source': [],
'estimated_arrival_days': ['number', 'default:0']
@@ -366,9 +397,10 @@ class SaleOrder(controller.Controller):
'carrier_id': params['value']['carrier_id'],
'delivery_service_type': params['value']['delivery_service_type'],
'flash_sale': params['value']['flash_sale'],
+ 'note_website': params['value']['note_website'],
'customer_type': 'nonpkp',
'npwp': '0',
- 'user_id': 20 # User ID: Nabila Rahmawati
+ 'user_id': 3222 # User ID: Nadia Rauhadatul Firdaus
}
if params['value']['type'] == 'sale_order':
parameters['approval_status'] = 'pengajuan1'
diff --git a/indoteknik_api/models/product_pricelist.py b/indoteknik_api/models/product_pricelist.py
index 0d4247c8..6e88517c 100644
--- a/indoteknik_api/models/product_pricelist.py
+++ b/indoteknik_api/models/product_pricelist.py
@@ -95,6 +95,20 @@ class ProductPricelist(models.Model):
], limit=1, order='start_date asc')
return pricelist
+ def get_is_show_program_flash_sale(self):
+ """
+ Check whether have active flash sale in range of date
+ @return: returns pricelist: object
+ """
+ current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+ pricelist = self.search([
+ ('is_flash_sale', '=', True),
+ ('is_show_program', '=', True),
+ ('start_date', '<=', current_time),
+ ('end_date', '>=', current_time)
+ ], order='start_date asc')
+ return pricelist
+
def is_flash_sale_product(self, product_id: int):
"""
Check whether product is flash sale.
diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py
index 88dc331f..725dbb4b 100644
--- a/indoteknik_api/models/sale_order.py
+++ b/indoteknik_api/models/sale_order.py
@@ -65,6 +65,7 @@ class SaleOrder(models.Model):
data_with_detail = {
'payment_term': sale_order.payment_term_id.name or '',
'products': [],
+ 'products_reject_line': [],
'delivery_amount': sale_order.delivery_amt or 0,
'address': {
'site_partner': sale_order.partner_id.site_id.name,
@@ -87,6 +88,11 @@ class SaleOrder(models.Model):
for invoice in sale_order.invoice_ids:
if invoice.state == 'posted':
data_with_detail['invoices'].append(self.env['account.move'].api_v1_single_response(invoice))
+ for reject in sale_order.reject_line:
+ if len(reject) > 0:
+ product_reject = self.env['product.product'].api_single_response(reject.product_id)
+ product_reject['quantity'] = reject.qty_reject
+ data_with_detail['products_reject_line'].append(product_reject)
data.update(data_with_detail)
else:
data_with_detail = {
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index a6bab518..ee9c9429 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -122,3 +122,4 @@ from . import logbook_bill
from . import report_logbook_bill
from . import sale_order_multi_uangmuka_penjualan
from . import shipment_group
+from . import sales_order_reject
diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py
index 7ec2cecc..c5809005 100644
--- a/indoteknik_custom/models/commision.py
+++ b/indoteknik_custom/models/commision.py
@@ -316,6 +316,7 @@ class CustomerCommisionLine(models.Model):
dpp = fields.Float(string='DPP')
tax = fields.Float(string='TaxAmt')
total = fields.Float(string='Total')
+ total_percent_margin = fields.Float('Total Margin', related='invoice_id.sale_id.total_percent_margin')
product_id = fields.Many2one('product.product', string='Product')
class AccountMove(models.Model):
diff --git a/indoteknik_custom/models/product_pricelist.py b/indoteknik_custom/models/product_pricelist.py
index b7a6d77e..2b17cf6e 100644
--- a/indoteknik_custom/models/product_pricelist.py
+++ b/indoteknik_custom/models/product_pricelist.py
@@ -6,6 +6,7 @@ class ProductPricelist(models.Model):
_inherit = 'product.pricelist'
is_flash_sale = fields.Boolean(string='Flash Sale', default=False)
+ is_show_program = fields.Boolean(string='Show Program', default=False)
banner = fields.Binary(string='Banner')
start_date = fields.Datetime(string='Start Date')
end_date = fields.Datetime(string='End Date')
diff --git a/indoteknik_custom/models/promotion/promotion_program_line.py b/indoteknik_custom/models/promotion/promotion_program_line.py
index d253c68d..a57f1f2c 100644
--- a/indoteknik_custom/models/promotion/promotion_program_line.py
+++ b/indoteknik_custom/models/promotion/promotion_program_line.py
@@ -23,7 +23,7 @@ class PromotionProgramLine(models.Model):
display_on_homepage = fields.Boolean('Display on Homepage')
price = fields.Float('Price')
- sequence = fields.Integer(string='Sequence', default=0)
+ sequence = fields.Integer(string='Sequence')
discount_type = fields.Selection([
("percentage", "Percentage"),
("fixed", "Fixed")
@@ -106,9 +106,12 @@ class PromotionProgramLine(models.Model):
products_total = sum(x['price']['price'] * x['qty'] / qty for x in products)
free_products_total = sum(x['price']['price'] * x['qty'] / qty for x in free_products)
package_price = products_total + free_products_total
+
+ image = self.env['ir.attachment'].api_image('promotion.program', 'image', self.program_id.id),
response = {
'id': self.id,
+ 'image_program': image,
'name': self.name,
'remaining_time': self._get_remaining_time(),
'promotion_type': self._res_promotion_type(),
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 32ddf1e5..e5d44178 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -13,7 +13,7 @@ except ImportError:
_logger = logging.getLogger(__name__)
-
+
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
@@ -75,12 +75,7 @@ class PurchaseOrder(models.Model):
if not journal:
raise UserError(_('Please define an accounting purchase journal for the company %s (%s).') % (self.company_id.name, self.company_id.id))
- stock_picking = self.env['stock.picking'].search([
- ('purchase_id', '=', self.id),
- ('state', '=', 'done')
- ], order='date_done desc', limit=1)
-
- date_done = stock_picking.date_done
+ date_done = self.date_approve
day_extension = int(self.payment_term_id.line_ids.days)
payment_schedule = date_done + timedelta(days=day_extension)
@@ -557,6 +552,9 @@ class PurchaseOrder(models.Model):
self.approval_status = 'pengajuan1'
def re_calculate(self):
+ if self.from_apo:
+ self.re_calculate_from_apo()
+ return
for line in self.order_line:
sale_order_line = self.env['sale.order.line'].search([
('product_id', 'in', [line.product_id.id]),
@@ -565,6 +563,14 @@ class PurchaseOrder(models.Model):
for so_line in sale_order_line:
so_line.purchase_price = line.price_unit
+ def re_calculate_from_apo(self):
+ for line in self.order_sales_match_line:
+ order_line = self.env['purchase.order.line'].search([
+ ('product_id', '=', line.product_id.id),
+ ('order_id', '=', line.purchase_order_id.id)
+ ], limit=1)
+ line.sale_line_id.purchase_price = order_line.price_unit
+
def button_cancel(self):
res = super(PurchaseOrder, self).button_cancel()
self.approval_status = False
@@ -612,10 +618,13 @@ class PurchaseOrder(models.Model):
def compute_total_margin_from_apo(self):
sum_so_margin = sum_sales_price = sum_margin = 0
for line in self.order_sales_match_line:
+ # Mencari purchase order line terkait
po_line = self.env['purchase.order.line'].search([
('product_id', '=', line.product_id.id),
('order_id', '=', line.purchase_order_id.id)
], limit=1)
+
+ # Mencari sale order line terkait
sale_order_line = line.sale_line_id
if not sale_order_line:
sale_order_line = self.env['sale.order.line'].search([
@@ -623,25 +632,30 @@ class PurchaseOrder(models.Model):
('order_id', '=', line.sale_id.id)
], limit=1, order='price_reduce_taxexcl')
- sum_so_margin += line.qty_po / line.qty_so * sale_order_line.item_margin
- # sales_price = sale_order_line.price_reduce_taxexcl * sale_order_line.product_uom_qty
- sales_price = sale_order_line.price_reduce_taxexcl * po_line.product_qty
- if sale_order_line.order_id.shipping_cost_covered == 'indoteknik':
- sales_price -= sale_order_line.delivery_amt_line
- if sale_order_line.order_id.fee_third_party > 0:
- sales_price -= sale_order_line.fee_third_party_line
- sum_sales_price += sales_price
- purchase_price = po_line.price_subtotal
- if line.purchase_order_id.delivery_amount > 0:
- purchase_price += po_line.delivery_amt_line
- real_item_margin = sales_price - purchase_price
- sum_margin += real_item_margin
+ # Menghitung margin per item
+ if sale_order_line and po_line:
+ so_margin = (line.qty_po / line.qty_so) * sale_order_line.item_margin
+ sum_so_margin += so_margin
+
+ sales_price = sale_order_line.price_reduce_taxexcl * line.qty_po
+ if sale_order_line.order_id.shipping_cost_covered == 'indoteknik':
+ sales_price -= (sale_order_line.delivery_amt_line / sale_order_line.product_uom_qty) * line.qty_po
+ if sale_order_line.order_id.fee_third_party > 0:
+ sales_price -= (sale_order_line.fee_third_party_line / sale_order_line.product_uom_qty) * line.qty_po
+ sum_sales_price += sales_price
+
+ purchase_price = po_line.price_subtotal / po_line.product_qty * line.qty_po
+ if line.purchase_order_id.delivery_amount > 0:
+ purchase_price += (po_line.delivery_amt_line / po_line.product_qty) * line.qty_po
+ real_item_margin = sales_price - purchase_price
+ sum_margin += real_item_margin
if sum_so_margin != 0 and sum_sales_price != 0 and sum_margin != 0:
self.total_so_margin = sum_so_margin
self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100
self.total_margin = sum_margin
self.total_percent_margin = round((sum_margin / sum_sales_price), 2) * 100
+
else:
self.total_margin = 0
self.total_percent_margin = 0
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index 8a3b3930..7af84b48 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -82,7 +82,7 @@ class PurchaseOrderLine(models.Model):
'sale_id': sale_id,
}
- @api.constrains('price_unit')
+ # @api.constrains('price_unit')
def constrains_purchase_price(self):
for line in self:
matches_so = self.env['purchase.order.sales.match'].search([
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 0d28e677..592b9cd9 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -11,6 +11,7 @@ class SaleOrder(models.Model):
_inherit = "sale.order"
fullfillment_line = fields.One2many('sales.order.fullfillment', 'sales_order_id', string='Fullfillment')
+ reject_line = fields.One2many('sales.order.reject', 'sale_order_id', string='Reject Lines')
order_sales_match_line = fields.One2many('sales.order.purchase.match', 'sales_order_id', string='Purchase Match Lines', states={'cancel': [('readonly', True)], 'done': [('readonly', True)]}, copy=True)
total_margin = fields.Float('Total Margin', compute='_compute_total_margin', help="Total Margin in Sales Order Header")
total_percent_margin = fields.Float('Total Percent Margin', compute='_compute_total_percent_margin', help="Total % Margin in Sales Order Header")
@@ -67,7 +68,7 @@ class SaleOrder(models.Model):
('partial_chargeback', 'Partial Chargeback'),
('authorize', 'Authorize'),
], tracking=True, string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle')
- date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ yang terakhir, tidak berpengaruh ke Accounting", tracking=True)
+ date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ yang terakhir, tidak berpengaruh ke Accounting")
payment_type = fields.Char(string='Payment Type', help='Jenis pembayaran dengan Midtrans')
gross_amount = fields.Float(string='Gross Amount', help='Jumlah pembayaran yang dilakukan dengan Midtrans')
notification = fields.Char(string='Notification', help='Dapat membantu error dari approval')
@@ -100,6 +101,19 @@ class SaleOrder(models.Model):
], string='Web Approval', copy=False)
compute_fullfillment = fields.Boolean(string='Compute Fullfillment', compute="_compute_fullfillment")
note_ekspedisi = fields.Char(string="Note Ekspedisi")
+ date_kirim_ril = fields.Datetime(string='Tanggal Kirim SJ', compute='_compute_date_kirim', copy=False)
+ date_status_done = fields.Datetime(string='Date Done DO', compute='_compute_date_kirim', copy=False)
+ date_driver_arrival = fields.Datetime(string='Arrival Date', compute='_compute_date_kirim', copy=False)
+ date_driver_departure = fields.Datetime(string='Departure Date', compute='_compute_date_kirim', copy=False)
+ note_website = fields.Char(string="Note Website")
+
+ def _compute_date_kirim(self):
+ for rec in self:
+ picking = self.env['stock.picking'].search([('sale_id', '=', rec.id), ('state', 'not in', ['cancel'])], order='date_doc_kirim desc', limit=1)
+ rec.date_kirim_ril = picking.date_doc_kirim
+ rec.date_status_done = picking.date_done
+ rec.date_driver_arrival = picking.driver_arrival_date
+ rec.date_driver_departure = picking.driver_departure_date
def open_form_multi_create_uang_muka(self):
action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_sale_order_multi_uangmuka')
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py
index 1fee041d..1f90b821 100644
--- a/indoteknik_custom/models/sale_order_line.py
+++ b/indoteknik_custom/models/sale_order_line.py
@@ -153,18 +153,21 @@ class SaleOrderLine(models.Model):
query = [('product_id', '=', line.product_id.id),
('vendor_id', '=', line.product_id.x_manufacture.override_vendor_id.id)]
purchase_price = self.env['purchase.pricelist'].search(
- query, limit=1, order='count_trx_po desc, count_trx_po_vendor desc')
+ query, limit=1, order='count_trx_po desc, count_trx_po_vendor desc')
line.vendor_id = purchase_price.vendor_id
line.tax_id = line.order_id.sales_tax_id
price, taxes = line._get_valid_purchase_price(purchase_price)
line.purchase_price = price
- line_name = ('[' + line.product_id.default_code + ']' if line.product_id.default_code else '') + ' ' + (line.product_id.name if line.product_id.name else '') + ' ' + \
- ('(' + line.product_id.product_template_attribute_value_ids.name + ')' if line.product_id.product_template_attribute_value_ids.name else '') + ' ' + \
- (line.product_id.short_spesification if line.product_id.short_spesification else '')
+ attribute_values = line.product_id.product_template_attribute_value_ids.mapped('name')
+ attribute_values_str = ', '.join(attribute_values) if attribute_values else ''
+
+ line_name = ('[' + line.product_id.default_code + ']' if line.product_id.default_code else '') + ' ' + \
+ (line.product_id.name if line.product_id.name else '') + ' ' + \
+ ('(' + attribute_values_str + ')' if attribute_values_str else '') + ' ' + \
+ (line.product_id.short_spesification if line.product_id.short_spesification else '')
line.name = line_name
-
def compute_delivery_amt_line(self):
for line in self:
try:
diff --git a/indoteknik_custom/models/sales_order_reject.py b/indoteknik_custom/models/sales_order_reject.py
new file mode 100644
index 00000000..9983c64e
--- /dev/null
+++ b/indoteknik_custom/models/sales_order_reject.py
@@ -0,0 +1,15 @@
+from odoo import fields, models, api, _
+from odoo.exceptions import AccessError, UserError, ValidationError
+from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class SalesOrderReject(models.Model):
+ _name = 'sales.order.reject'
+
+ sale_order_id = fields.Many2one('sale.order', string='Sale Order')
+ product_id = fields.Many2one('product.product', string='Product')
+ qty_reject = fields.Float(string='Qty')
+ reason_reject = fields.Char(string='Reason Reject')
diff --git a/indoteknik_custom/models/shipment_group.py b/indoteknik_custom/models/shipment_group.py
index 92f76db7..df3f1bb4 100644
--- a/indoteknik_custom/models/shipment_group.py
+++ b/indoteknik_custom/models/shipment_group.py
@@ -31,6 +31,10 @@ class ShipmentGroupLine(models.Model):
picking_id = fields.Many2one('stock.picking', string='Picking')
sale_id = fields.Many2one('sale.order', string='Sale Order')
state = fields.Char(string='Status', readonly=True, compute='_compute_state')
+ shipping_paid_by = fields.Selection([
+ ('indoteknik', 'Indoteknik'),
+ ('customer', 'Customer')
+ ], string='Shipping Paid by', copy=False)
@api.depends('picking_id.state')
def _compute_state(self):
@@ -60,6 +64,7 @@ class ShipmentGroupLine(models.Model):
raise UserError('Partner must be same as shipment group')
self.partner_id = picking.partner_id
+ self.shipping_paid_by = picking.sale_id.shipping_paid_by
if not self.shipment_id.partner_id:
self.shipment_id.partner_id = picking.partner_id
diff --git a/indoteknik_custom/models/solr/promotion_program.py b/indoteknik_custom/models/solr/promotion_program.py
index 0d417b3e..014e8062 100644
--- a/indoteknik_custom/models/solr/promotion_program.py
+++ b/indoteknik_custom/models/solr/promotion_program.py
@@ -30,6 +30,7 @@ class PromotionProgram(models.Model):
'id': rec.id,
'name_s': rec.name,
'banner_s': ir_attachment.api_image(self._name, 'banner', rec.id) if rec.banner else '',
+ 'image_s': ir_attachment.api_image(self._name, 'image', rec.id) if rec.image else '',
'keywords': [x.name for x in rec.keyword_ids],
'line_ids': [x.id for x in rec.program_line],
'start_time_s': self._time_format(rec.start_time),
@@ -66,3 +67,17 @@ class PromotionProgram(models.Model):
for line in rec.program_line:
line._create_solr_queue('_sync_to_solr')
+ def solr_flag_to_queue(self, limit=500):
+ domain = [
+ ('solr_flag', '=', 2),
+ ('active', 'in', [True, False])
+ ]
+ records = self.search(domain, limit=limit)
+ for record in records:
+ record._create_solr_queue('_sync_to_solr')
+ record.solr_flag = 1
+
+ def action_sync_to_solr(self):
+ rec_ids = self.env.context.get('active_ids', [])
+ recs = self.search([('id', 'in', rec_ids)])
+ recs._create_solr_queue('_sync_to_solr') \ No newline at end of file
diff --git a/indoteknik_custom/models/solr/promotion_program_line.py b/indoteknik_custom/models/solr/promotion_program_line.py
index 73504c48..4b0e67f6 100644
--- a/indoteknik_custom/models/solr/promotion_program_line.py
+++ b/indoteknik_custom/models/solr/promotion_program_line.py
@@ -37,6 +37,9 @@ class PromotionProgramLine(models.Model):
promotion_type = rec._res_promotion_type()
+ # Set sequence_i to None if rec.sequence is 0
+ sequence_value = None if rec.sequence == 0 else rec.sequence
+
document.update({
'id': rec.id,
'program_id_i': rec.program_id.id or 0,
@@ -47,7 +50,7 @@ class PromotionProgramLine(models.Model):
'package_limit_user_i': rec.package_limit_user,
'package_limit_trx_i': rec.package_limit_trx,
'price_f': rec.price,
- 'sequence_i': rec.sequence,
+ 'sequence_i': sequence_value,
'product_ids': [x.product_id.id for x in rec.product_ids],
'products_s': json.dumps(products),
'free_product_ids': [x.product_id.id for x in rec.free_product_ids],
diff --git a/indoteknik_custom/models/solr/x_banner_banner.py b/indoteknik_custom/models/solr/x_banner_banner.py
index 67739d47..8452644c 100644
--- a/indoteknik_custom/models/solr/x_banner_banner.py
+++ b/indoteknik_custom/models/solr/x_banner_banner.py
@@ -23,7 +23,7 @@ class XBannerBanner(models.Model):
'function_name': function_name
})
- @api.constrains('x_name', 'x_url_banner', 'background_color', 'x_banner_image', 'x_banner_category', 'x_relasi_manufacture', 'x_sequence_banner', 'x_status_banner', 'sequence', 'group_by_week')
+ @api.constrains('x_name', 'x_url_banner', 'background_color', 'x_banner_image', 'x_banner_category', 'x_relasi_manufacture', 'x_sequence_banner', 'x_status_banner', 'sequence', 'group_by_week', 'headline_banner_s', 'description_banner_s')
def _create_solr_queue_sync_brands(self):
self._create_solr_queue('_sync_banners_to_solr')
@@ -49,6 +49,8 @@ class XBannerBanner(models.Model):
'category_id_i': banners.x_banner_category.id or '',
'manufacture_id_i': banners.x_relasi_manufacture.id or '',
'group_by_week': banners.group_by_week or '',
+ 'headline_banner_s': banners.x_headline_banner or '',
+ 'description_banner_s': banners.x_description_banner or '',
})
self.solr().add([document])
banners.update_last_update_solr()
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py
index 9c991be3..fe46bf65 100644
--- a/indoteknik_custom/models/stock_move.py
+++ b/indoteknik_custom/models/stock_move.py
@@ -73,4 +73,5 @@ class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
line_no = fields.Integer('No', default=0)
+ note = fields.Char('Note')
manufacture = fields.Many2one('x_manufactures', string="Brands", related="product_id.x_manufacture", store=True)
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index daa05c14..c151a543 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -71,7 +71,10 @@ class StockPicking(models.Model):
('not_paid', 'Customer belum bayar'),
('partial', 'Kirim Parsial'),
('not_complete', 'Belum Lengkap'),
- ('indent', 'Indent')
+ ('indent', 'Indent'),
+ ('self_pickup', 'Barang belum di pickup Customer'),
+ ('delivery_route', 'Belum masuk rute pengiriman'),
+ ('expedition_closed', 'Eskpedisi belum buka')
], string='Note Logistic', help='jika field ini diisi maka tidak akan dihitung ke lead time')
waybill_id = fields.One2many(comodel_name='airway.bill', inverse_name='do_id', string='Airway Bill')
purchase_representative_id = fields.Many2one('res.users', related='move_lines.purchase_line_id.order_id.user_id', string="Purchase Representative")
@@ -87,6 +90,14 @@ class StockPicking(models.Model):
date_unreserve = fields.Datetime(string="Date Unreserved", copy=False, tracking=True)
date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True)
sale_order = fields.Char(string='Matches SO', copy=False)
+ printed_sj = fields.Boolean('Printed Surat Jalan', help='flag which is internal use or not')
+
+ def reset_status_printed(self):
+ for rec in self:
+ rec.status_printed = 'not_printed'
+ rec.printed_sj = False
+ rec.date_printed_list = False
+ rec.date_printed_sj = False
@api.onchange('carrier_id')
def constrains_carrier_id(self):
diff --git a/indoteknik_custom/models/x_banner_banner.py b/indoteknik_custom/models/x_banner_banner.py
index d6884c9b..810bdf39 100755
--- a/indoteknik_custom/models/x_banner_banner.py
+++ b/indoteknik_custom/models/x_banner_banner.py
@@ -23,4 +23,6 @@ class XBannerBanner(models.Model):
('2', '2'),
('3', '3'),
('4', '4')
- ], string='Group by Week') \ No newline at end of file
+ ], string='Group by Week')
+ x_headline_banner = fields.Text(string="Headline Banner")
+ x_description_banner = fields.Text(string="Description Banner") \ No newline at end of file
diff --git a/indoteknik_custom/report/report_sale_order.xml b/indoteknik_custom/report/report_sale_order.xml
index 595a989f..b9928790 100644
--- a/indoteknik_custom/report/report_sale_order.xml
+++ b/indoteknik_custom/report/report_sale_order.xml
@@ -7,7 +7,12 @@
<field name="report_type">qweb-pdf</field>
<field name="report_name">indoteknik_custom.report_saleorder_website</field>
<field name="report_file">indoteknik_custom.report_saleorder_website</field>
- <field name="print_report_name">(object.state in ('draft', 'sent') and 'Quotation - %s' % (object.name)) or 'Order - %s' % (object.name)</field>
+ <field name="print_report_name">
+ (object.state in ('draft', 'sent') and
+ ('Quotation - %s - %s - %s' % (object.partner_id.name, object.name, object.create_date.strftime('%d/%m/%Y')))
+ or 'Order - %s - %s - %s' % (object.partner_id.name, object.name, object.create_date.strftime('%d/%m/%Y')))
+ </field>
+
<field name="binding_model_id" ref="model_sale_order"/>
<field name="binding_type">report</field>
</record>
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index 597bb762..7731cc6f 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -131,3 +131,4 @@ access_report_logbook_bill_line,access.report.logbook.sj.line,model_report_logbo
access_sale_order_multi_uangmuka_penjualan,access.sale.order.multi_uangmuka_penjualan,model_sale_order_multi_uangmuka_penjualan,,1,1,1,1
access_shipment_group,access.shipment.group,model_shipment_group,,1,1,1,1
access_shipment_group_line,access.shipment.group.line,model_shipment_group_line,,1,1,1,1
+access_sales_order_reject,access.sales.order.reject,model_sales_order_reject,,1,1,1,1
diff --git a/indoteknik_custom/views/customer_commision.xml b/indoteknik_custom/views/customer_commision.xml
index 4b74cd34..0b72587e 100644
--- a/indoteknik_custom/views/customer_commision.xml
+++ b/indoteknik_custom/views/customer_commision.xml
@@ -27,6 +27,7 @@
<field name="state" readonly="1"/>
<field name="product_id" readonly="1" optional="hide"/>
<field name="dpp" readonly="1"/>
+ <field name="total_percent_margin" readonly="1"/>
<field name="tax" readonly="1" optional="hide"/>
<field name="total" readonly="1" optional="hide"/>
</tree>
diff --git a/indoteknik_custom/views/product_pricelist.xml b/indoteknik_custom/views/product_pricelist.xml
index 55139a24..0dfb69db 100644
--- a/indoteknik_custom/views/product_pricelist.xml
+++ b/indoteknik_custom/views/product_pricelist.xml
@@ -7,6 +7,7 @@
<field name="arch" type="xml">
<field name="company_id" position="after">
<field name="is_flash_sale"/>
+ <field name="is_show_program" attrs="{'invisible': [('is_flash_sale', '=', False)]}"/>
</field>
<page name="pricelist_rules" position="before">
<page name="flash_sale_setting" string="Flash Sale" attrs="{'invisible': [('is_flash_sale', '=', False)]}">
diff --git a/indoteknik_custom/views/promotion/promotion_program.xml b/indoteknik_custom/views/promotion/promotion_program.xml
index 724f80c7..c9672b5a 100644
--- a/indoteknik_custom/views/promotion/promotion_program.xml
+++ b/indoteknik_custom/views/promotion/promotion_program.xml
@@ -71,4 +71,25 @@
sequence="1"
action="promotion_program_action"
/>
+ <record id="ir_actions_server_promotion_program_sync_to_solr" model="ir.actions.server">
+ <field name="name">Sync to Solr</field>
+ <field name="model_id" ref="indoteknik_custom.model_promotion_program"/>
+ <field name="binding_model_id" ref="indoteknik_custom.model_promotion_program"/>
+ <field name="state">code</field>
+ <field name="code">model.action_sync_to_solr()</field>
+ </record>
+ <data noupdate="1">
+ <record id="cron_program_solr_flag_solr" model="ir.cron">
+ <field name="name">Program Promotion: Solr Flag to Queue</field>
+ <field name="interval_number">1</field>
+ <field name="interval_type">hours</field>
+ <field name="numbercall">-1</field>
+ <field name="doall" eval="False"/>
+ <field name="model_id" ref="model_promotion_program"/>
+ <field name="code">model.solr_flag_to_queue()</field>
+ <field name="state">code</field>
+ <field name="priority">55</field>
+ <field name="active">True</field>
+ </record>
+ </data>
</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 3eec6d3e..ed82d28e 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -156,6 +156,7 @@
<field name="partner_purchase_order_name" readonly="True"/>
<field name="partner_purchase_order_description" readonly="True"/>
<field name="partner_purchase_order_file" readonly="True"/>
+ <field name="note_website" readonly="True"/>
<field name="web_approval" readonly="True"/>
</group>
<group>
@@ -192,6 +193,9 @@
<page string="Fullfillment" name="page_sale_order_fullfillment">
<field name="fullfillment_line" readonly="1"/>
</page>
+ <page string="Reject Line" name="page_sale_order_reject_line">
+ <field name="reject_line" readonly="1"/>
+ </page>
</page>
</field>
</record>
@@ -219,7 +223,10 @@
<field name="approval_status" />
<field name="client_order_ref"/>
<field name="so_status"/>
- <field name="date_doc_kirim" string="Tgl Kirim"/>
+ <field name="date_status_done"/>
+ <field name="date_kirim_ril"/>
+ <field name="date_driver_departure"/>
+ <field name="date_driver_arrival"/>
<field name="payment_type" optional="hide"/>
<field name="payment_status" optional="hide"/>
</field>
@@ -314,6 +321,20 @@
</data>
<data>
+ <record id="sales_order_reject_tree" model="ir.ui.view">
+ <field name="name">sales.order.reject.tree</field>
+ <field name="model">sales.order.reject</field>
+ <field name="arch" type="xml">
+ <tree editable="top" create="false">
+ <field name="product_id" readonly="1"/>
+ <field name="qty_reject" readonly="1"/>
+ <field name="reason_reject" readonly="1"/>
+ </tree>
+ </field>
+ </record>
+ </data>
+
+ <data>
<record id="sale_order_multi_create_uangmuka_ir_actions_server" model="ir.actions.server">
<field name="name">Uang Muka</field>
<field name="model_id" ref="sale.model_sale_order"/>
diff --git a/indoteknik_custom/views/shipment_group.xml b/indoteknik_custom/views/shipment_group.xml
index b66bda3c..e9eec41b 100644
--- a/indoteknik_custom/views/shipment_group.xml
+++ b/indoteknik_custom/views/shipment_group.xml
@@ -19,6 +19,7 @@
<field name="picking_id" required="1"/>
<field name="partner_id" readonly="1"/>
<field name="sale_id" readonly="1"/>
+ <field name="shipping_paid_by" readonly="1"/>
<field name="state" readonly="1"/>
</tree>
</field>
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index 4de1ac91..7567dda2 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -55,6 +55,16 @@
<field name="summary_qty_detail"/>
<field name="count_line_detail"/>
</field>
+ <field name="weight_uom_name" position="after">
+ <group>
+ <group>
+ <button name="reset_status_printed"
+ string="Reset Status Printed"
+ type="object"
+ />
+ </group>
+ </group>
+ </field>
<field name="partner_id" position="after">
<field name="real_shipping_id"/>
</field>
@@ -75,6 +85,7 @@
<field name="group_id" position="before">
<field name="date_reserved"/>
<field name="status_printed"/>
+ <field name="printed_sj"/>
<field name="date_printed_sj"/>
<field name="date_printed_list"/>
<field name="is_internal_use"
@@ -122,6 +133,18 @@
</field>
</record>
+ <record id="view_stock_move_line_detailed_operation_tree_inherit" model="ir.ui.view">
+ <field name="name">stock.move.line.operations.tree.inherit</field>
+ <field name="model">stock.move.line</field>
+ <field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
+ <field name="arch" type="xml">
+ <tree editable="bottom" decoration-muted="(state == 'done' and is_locked == True)" decoration-danger="qty_done&gt;product_uom_qty and state!='done' and parent.picking_type_code != 'incoming'" decoration-success="qty_done==product_uom_qty and state!='done' and not result_package_id">
+ <field name="note" placeholder="Add a note here"/>
+ </tree>
+ </field>
+ </record>
+
+
<record id="view_picking_internal_search_inherit" model="ir.ui.view">
<field name="name">stock.picking.internal.search.inherit</field>
<field name="model">stock.picking</field>
diff --git a/indoteknik_custom/views/x_banner_banner.xml b/indoteknik_custom/views/x_banner_banner.xml
index c90e718b..ec1e38a5 100755
--- a/indoteknik_custom/views/x_banner_banner.xml
+++ b/indoteknik_custom/views/x_banner_banner.xml
@@ -31,6 +31,8 @@
<field name="x_status_banner" />
<field name="sequence" />
<field name="group_by_week" />
+ <field name="x_headline_banner" />
+ <field name="x_description_banner" />
<field name="last_update_solr" readonly="1"/>
</group>
<group>