summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2024-06-05 02:29:48 +0000
committerIT Fixcomart <it@fixcomart.co.id>2024-06-05 02:29:48 +0000
commitec4aefc64a9f42d1b40d03048fc384e158191218 (patch)
tree14d1fd1358ae41d65b9412fdfc0195c8dd9f20bd
parentabd7dd1ecc9246b1924dcf70b3ed41c964f3746f (diff)
parent9306992db370c793e8cab494038b0de5b61b600f (diff)
Merged in production (pull request #144)
Production
-rw-r--r--indoteknik_api/controllers/api_v1/courier.py25
-rw-r--r--indoteknik_api/models/product_template.py2
-rwxr-xr-xindoteknik_custom/__manifest__.py4
-rwxr-xr-xindoteknik_custom/models/__init__.py3
-rw-r--r--indoteknik_custom/models/account_move.py9
-rw-r--r--indoteknik_custom/models/account_move_multi_update_bills.py26
-rw-r--r--indoteknik_custom/models/automatic_purchase.py14
-rw-r--r--indoteknik_custom/models/def_cargo/__init__.py3
-rw-r--r--indoteknik_custom/models/def_cargo/def_cargo_city.py11
-rw-r--r--indoteknik_custom/models/def_cargo/def_cargo_district.py15
-rw-r--r--indoteknik_custom/models/def_cargo/def_cargo_province.py10
-rw-r--r--indoteknik_custom/models/dunning_run.py1
-rw-r--r--indoteknik_custom/models/ged.py61
-rwxr-xr-xindoteknik_custom/models/product_template.py2
-rw-r--r--indoteknik_custom/models/promotion/promotion_monitoring.py16
-rw-r--r--indoteknik_custom/models/purchasing_job.py15
-rw-r--r--indoteknik_custom/models/purchasing_job_multi_update.py14
-rw-r--r--indoteknik_custom/models/report_logbook_sj.py7
-rw-r--r--indoteknik_custom/models/res_partner.py18
-rwxr-xr-xindoteknik_custom/models/sale_order.py10
-rw-r--r--indoteknik_custom/models/sale_order_line.py12
-rw-r--r--indoteknik_custom/models/uangmuka_pembelian.py5
-rw-r--r--indoteknik_custom/models/uangmuka_penjualan.py5
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv4
-rw-r--r--indoteknik_custom/views/account_move.xml13
-rw-r--r--indoteknik_custom/views/account_move_multi_update_bills.xml33
-rw-r--r--indoteknik_custom/views/automatic_purchase.xml3
-rw-r--r--indoteknik_custom/views/def_cargo_city.xml41
-rw-r--r--indoteknik_custom/views/def_cargo_district.xml49
-rw-r--r--indoteknik_custom/views/def_cargo_province.xml39
-rw-r--r--indoteknik_custom/views/dunning_run.xml4
-rw-r--r--indoteknik_custom/views/dunning_run_ged.xml30
-rwxr-xr-xindoteknik_custom/views/product_template.xml2
-rw-r--r--indoteknik_custom/views/promotion/promotion_monitoring.xml3
-rw-r--r--indoteknik_custom/views/purchasing_job.xml2
-rw-r--r--indoteknik_custom/views/report_logbook_sj.xml1
-rw-r--r--indoteknik_custom/views/res_partner.xml8
37 files changed, 482 insertions, 38 deletions
diff --git a/indoteknik_api/controllers/api_v1/courier.py b/indoteknik_api/controllers/api_v1/courier.py
index 8cf3a674..bfaa102e 100644
--- a/indoteknik_api/controllers/api_v1/courier.py
+++ b/indoteknik_api/controllers/api_v1/courier.py
@@ -5,6 +5,7 @@ from odoo.http import request
class Courier(controller.Controller):
prefix = '/api/v1/'
+ PREFIX_PARTNER = prefix + 'partner/<partner_id>/'
@http.route(prefix + 'courier', auth='public', methods=['GET', 'OPTIONS'])
@controller.Controller.must_authorized()
@@ -23,5 +24,27 @@ class Courier(controller.Controller):
'name': courier.name,
'image': base_url + 'api/image/rajaongkir.kurir/image/'+str(courier.id)
})
+ return self.response(data)
+
+ @http.route(prefix + 'def_cargo', auth='public', methods=['GET', 'OPTIONS'])
+ @controller.Controller.must_authorized()
+ def get_location_def_cargo(self, **kw):
+ city_name = str(kw.get('city_name'))
+
+ cargo_city = request.env['def.cargo.city'].search([('name', 'ilike', f'%{city_name}%')])
+ cargo_district = request.env['def.cargo.district'].search([('city_id', '=', cargo_city.id)], limit=1)
+
+ is_coverage = True
+ if not cargo_district.coverage == 'Available':
+ is_coverage = False
+
+ data = {
+ 'kota': cargo_city.name,
+ 'coverage': cargo_district.coverage,
+ 'rate': cargo_district.rate,
+ 'next_kg': cargo_district.next_kg,
+ 'sla': cargo_district.sla,
+ 'is_coverage': is_coverage
+ }
+
return self.response(data)
- \ No newline at end of file
diff --git a/indoteknik_api/models/product_template.py b/indoteknik_api/models/product_template.py
index fb77769f..75899624 100644
--- a/indoteknik_api/models/product_template.py
+++ b/indoteknik_api/models/product_template.py
@@ -57,6 +57,8 @@ class ProductTemplate(models.Model):
'image': self.env['ir.attachment'].api_image('product.template', 'image_128', product_template.id),
'code': product_template.default_code or '',
'name': product_template.name,
+ 'sni': product_template.sni,
+ 'tkdn': product_template.tkdn,
'variant_total': len(product_template.product_variant_ids),
'stock_total': product_template.qty_stock_vendor,
'weight': product_template.weight,
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index fa0188e6..3d2b01e5 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -125,6 +125,10 @@
'views/apps_stored.xml',
'views/ged_tracking.xml',
'views/dunning_run_ged.xml',
+ 'views/account_move_multi_update_bills.xml',
+ 'views/def_cargo_province.xml',
+ 'views/def_cargo_city.xml',
+ 'views/def_cargo_district.xml',
'report/report.xml',
'report/report_banner_banner.xml',
'report/report_banner_banner2.xml',
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 33aa0784..510dd659 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -106,6 +106,7 @@ from . import po_multi_cancel
from . import logbook_sj
from . import report_logbook_sj
from . import role_permission
+
from . import cust_commision
from . import report_stock_forecasted
from . import web_logging
@@ -113,3 +114,5 @@ from . import sales_order_fullfillment
from . import res_partner_site
from . import external_api
from . import ged
+from . import account_move_multi_update_bills
+from . import def_cargo
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index b306b6af..aa8b97be 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -246,7 +246,7 @@ class AccountMove(models.Model):
due_date = tukar_date + timedelta(days=add_days)
invoice.invoice_date_due = due_date
- @api.onchange('date_terima_tukar_faktur')
+ @api.constrains('date_terima_tukar_faktur')
def change_date_terima_tukar_faktur(self):
for invoice in self:
if not invoice.date_terima_tukar_faktur:
@@ -266,6 +266,13 @@ class AccountMove(models.Model):
}
return action
+ def open_form_multi_update_bills(self):
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_account_move_multi_update_bills')
+ action['context'] = {
+ 'move_ids': [x.id for x in self]
+ }
+ return action
+
@api.constrains('efaktur_id', 'ref', 'date', 'journal_id', 'name')
def constrains_edit(self):
for rec in self.line_ids:
diff --git a/indoteknik_custom/models/account_move_multi_update_bills.py b/indoteknik_custom/models/account_move_multi_update_bills.py
new file mode 100644
index 00000000..d348beed
--- /dev/null
+++ b/indoteknik_custom/models/account_move_multi_update_bills.py
@@ -0,0 +1,26 @@
+from odoo import models, fields
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class AccountMoveMultiUpdateBills(models.TransientModel):
+ _name = 'account.move.multi_update_bills'
+
+ date_terima_tukar_faktur = fields.Date(string="Terima Faktur")
+
+ def save_multi_update_bills(self):
+ move_ids = self._context['move_ids']
+ moves = self.env['account.move'].browse(move_ids)
+ moves.update({
+ 'date_terima_tukar_faktur': self.date_terima_tukar_faktur
+ })
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'params': {
+ 'title': 'Notification',
+ 'message': 'Account Move berhasil diubah',
+ 'next': {'type': 'ir.actions.act_window_close'},
+ }
+ } \ No newline at end of file
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index af09abf0..21d21c9c 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -570,6 +570,20 @@ class AutomaticPurchaseSalesMatch(models.Model):
qty_po = fields.Float(string='Qty PO')
purchase_price = fields.Float(string='Purchase Price SO')
purchase_tax_id = fields.Many2one('account.tax', string='Tax', domain=['|', ('active', '=', False), ('active', '=', True)])
+ note_procurement = fields.Char(string='Note Detail', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring")
+
+ @api.constrains('note_procurement')
+ def note_procurement_to_so_line(self):
+ for rec in self:
+ so_line = self.env['sale.order.line'].search([
+ ('id', '=', rec.sale_line_id.id),
+ ], limit=1)
+
+ if so_line.note_procurement == False:
+ so_line.note_procurement = rec.note_procurement
+
+ if so_line.note_procurement != rec.note_procurement:
+ so_line.note_procurement = rec.note_procurement
class SyncPurchasingJob(models.Model):
_name = 'sync.purchasing.job'
diff --git a/indoteknik_custom/models/def_cargo/__init__.py b/indoteknik_custom/models/def_cargo/__init__.py
new file mode 100644
index 00000000..d6f2b19e
--- /dev/null
+++ b/indoteknik_custom/models/def_cargo/__init__.py
@@ -0,0 +1,3 @@
+from . import def_cargo_province
+from . import def_cargo_city
+from . import def_cargo_district \ No newline at end of file
diff --git a/indoteknik_custom/models/def_cargo/def_cargo_city.py b/indoteknik_custom/models/def_cargo/def_cargo_city.py
new file mode 100644
index 00000000..4e7015be
--- /dev/null
+++ b/indoteknik_custom/models/def_cargo/def_cargo_city.py
@@ -0,0 +1,11 @@
+from odoo import fields, models, api
+from datetime import datetime, timedelta
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class DefCargoCity(models.Model):
+ _name = 'def.cargo.city'
+ name = fields.Char(string="Name")
+ province_id = fields.Many2one('def.cargo.province', string="Province")
diff --git a/indoteknik_custom/models/def_cargo/def_cargo_district.py b/indoteknik_custom/models/def_cargo/def_cargo_district.py
new file mode 100644
index 00000000..0650005d
--- /dev/null
+++ b/indoteknik_custom/models/def_cargo/def_cargo_district.py
@@ -0,0 +1,15 @@
+from odoo import fields, models, api
+from datetime import datetime, timedelta
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class DefCargoDistrict(models.Model):
+ _name = 'def.cargo.district'
+ name = fields.Char(string="Name")
+ city_id = fields.Many2one('def.cargo.city', string="City")
+ coverage = fields.Char(string="Coverage")
+ rate = fields.Float(string="Rate (min 10kg)")
+ next_kg = fields.Float(string="Next Kg")
+ sla = fields.Char(string="SLA")
diff --git a/indoteknik_custom/models/def_cargo/def_cargo_province.py b/indoteknik_custom/models/def_cargo/def_cargo_province.py
new file mode 100644
index 00000000..c666da5a
--- /dev/null
+++ b/indoteknik_custom/models/def_cargo/def_cargo_province.py
@@ -0,0 +1,10 @@
+from odoo import fields, models, api
+from datetime import datetime, timedelta
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class DefCargoProvince(models.Model):
+ _name = 'def.cargo.province'
+ name = fields.Char(string="Name")
diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py
index 4e04c03c..d75d7c51 100644
--- a/indoteknik_custom/models/dunning_run.py
+++ b/indoteknik_custom/models/dunning_run.py
@@ -11,6 +11,7 @@ class DunningRun(models.Model):
_name = 'dunning.run'
_description = 'Dunning Run'
_order = 'dunning_date desc, id desc'
+ _inherit = ['mail.thread']
_rec_name = 'number'
number = fields.Char(string='Document No', index=True, copy=False, readonly=True)
diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py
index a2e8bc3c..ef7b422a 100644
--- a/indoteknik_custom/models/ged.py
+++ b/indoteknik_custom/models/ged.py
@@ -124,6 +124,27 @@ class GedApi(models.Model):
self.env['token.storage'].create([param])
return token
+ def get_tracking_awb_log(self, dunning_run):
+ token = self._get_token()
+ headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'X-Ged-Key': x_ged_key,
+ 'X-Ged-Password': x_ged_password,
+ 'Authorization': 'Bearer ' + token
+ }
+ json_data = {
+ 'data': {
+ 'awb': dunning_run.resi_tukar_faktur
+ }
+ }
+ response = requests.post(url_tracking, headers=headers, json=json_data)
+ log = {
+ 'body': str(json_data),
+ 'responses': str(response.json())
+ }
+ self.env['ged.tracking.log'].create(log)
+
def get_tracking_awb(self, dunning_run):
# current_time = datetime.now()
# current_time = current_time.strftime('%Y-%m-%d %H:%M:%S')
@@ -235,6 +256,10 @@ class GedApi(models.Model):
status_detail = line['status_detail']
status = line['status']
+ if status == 'Received At Warehouse' and not dunning_run.date_kirim_tukar_faktur:
+ dunning_run.date_kirim_tukar_faktur = line.created_at
+ dunning_run.copy_date_faktur()
+
param_line = {
'ged_tracking_id': ged_tracking_id,
'user_input': user_input,
@@ -257,21 +282,22 @@ class DunningRunGed(models.Model):
ged_tracking = fields.One2many('ged.tracking', 'dunning_id', string='GED Tracking', auto_join=True)
ged_tracking_line = fields.One2many('ged.tracking.line', 'dunning_id', string='GED Tracking Line', auto_join=True)
- def _get_tracking_history(self, test_awb_number):
- if test_awb_number > 0:
+ def _get_tracking_history(self, awb_number='all_data'):
+ if awb_number == 'all_data':
query = [
('last_status_awb', '!=', 'POD Return'),
- ('resi_tukar_faktur', '=', test_awb_number),
- ('shipper_faktur_id', '=', 123)
+ ('resi_tukar_faktur', '!=', False),
+ ('shipper_faktur_id', '=', 123),
+ ('date_terima_tukar_faktur', '=', False)
]
else:
query = [
('last_status_awb', '!=', 'POD Return'),
- ('resi_tukar_faktur', '!=', False),
- ('shipper_faktur_id', '=', 123),
- ('date_terima_tukar_faktur', '=', False)
+ ('resi_tukar_faktur', '=', awb_number),
+ ('shipper_faktur_id', '=', 123)
]
- dunnings = self.env['dunning.run'].search(query, limit=50)
+
+ dunnings = self.env['dunning.run'].search(query, limit=100)
for dunning in dunnings:
current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1)
@@ -287,5 +313,22 @@ class DunningRunGed(models.Model):
dunning.copy_date_faktur()
return
+ def _get_tracking_history_log(self, awb_number='all_data'):
+ query = [
+ ('last_status_awb', '!=', 'POD Return'),
+ ('resi_tukar_faktur', '=', awb_number),
+ ('shipper_faktur_id', '=', 123)
+ ]
+
+ dunnings = self.env['dunning.run'].search(query, limit=1)
+
+ for dunning in dunnings:
+ ged_api = self.env['ged.api']
+ ged_api.get_tracking_awb_log(dunning)
+ return
+
def get_tracking_history_by_awb(self):
- self._get_tracking_history(self.resi_tukar_faktur) \ No newline at end of file
+ self._get_tracking_history(self.resi_tukar_faktur)
+
+ def get_tracking_history_by_awb_log(self):
+ self._get_tracking_history_log(self.resi_tukar_faktur)
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 97ad07a7..6086a2ca 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -57,6 +57,8 @@ class ProductTemplate(models.Model):
('sp', 'Spare Part'),
('acc', 'Accessories')
], string='Kind of', copy=False)
+ sni = fields.Boolean(string='SNI')
+ tkdn = fields.Boolean(string='TKDN')
def _get_qty_sold(self):
for rec in self:
diff --git a/indoteknik_custom/models/promotion/promotion_monitoring.py b/indoteknik_custom/models/promotion/promotion_monitoring.py
index 9df0825d..2c4b90f1 100644
--- a/indoteknik_custom/models/promotion/promotion_monitoring.py
+++ b/indoteknik_custom/models/promotion/promotion_monitoring.py
@@ -12,6 +12,8 @@ class PromotionMonitoring(models.Model):
has_promo = fields.Boolean(string="Has Promo")
count_active = fields.Integer(string="Count Active")
count_inactive = fields.Integer(string="Count Inactive")
+ human_last_update = fields.Datetime(string='Human Last Update')
+ promotion_program_line_names = fields.Text(string="Promotion Program Line Names")
def init(self):
tools.drop_view_if_exists(self.env.cr, self._table)
@@ -25,19 +27,23 @@ class PromotionMonitoring(models.Model):
p.id as id,
p.id as product_id,
ppi.computed_price as price,
- ({count_active} > 0) as has_promo,
- {count_active} as count_active,
- {count_inactive} as count_inactive
+ (COUNT(ppl.id) FILTER (WHERE ppl.active = True) > 0) as has_promo,
+ COUNT(ppl.id) FILTER (WHERE ppl.active = True) as count_active,
+ COUNT(ppl.id) FILTER (WHERE ppl.active = False) as count_inactive,
+ pr.human_last_update as human_last_update,
+ STRING_AGG(DISTINCT ppl.name, ', ') as promotion_program_line_names -- Concatenate promotion_program_line names
FROM product_product p
LEFT JOIN product_template pt ON pt.id = p.product_tmpl_id
LEFT JOIN promotion_product pp ON pp.product_id = p.id
LEFT JOIN promotion_program_line ppl ON ppl.id = pp.program_line_id
LEFT JOIN product_pricelist_item ppi ON ppi.product_id = p.id
+ LEFT JOIN purchase_pricelist pr ON pr.product_id = p.id
+ LEFT JOIN promotion_product prp ON prp.product_id = p.id -- Join with promotion.product
WHERE p.active = True
AND pt.sale_ok = True
AND ppi.pricelist_id = 17023
- GROUP BY p.id, ppi.id
- )
+ GROUP BY p.id, ppi.id, pr.human_last_update
+ );
""".format(
table=self._table,
count_active=sql['count_active'],
diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py
index 86f8afcc..373e469a 100644
--- a/indoteknik_custom/models/purchasing_job.py
+++ b/indoteknik_custom/models/purchasing_job.py
@@ -188,9 +188,18 @@ class OutstandingSales(models.Model):
tools.drop_view_if_exists(self.env.cr, self._table)
self.env.cr.execute("""
CREATE OR REPLACE VIEW v_sales_outstanding AS (
- select sm.id, sm.id as move_id, sp.id as picking_id, sm.product_id, so.id as sale_id,
- sol.id as sale_line_id, rp.id as partner_id, so.user_id as salesperson_id, so.partner_invoice_id,
- sp.origin, rp2.name as salesperson, coalesce(pp.default_code, pt.default_code) as item_code, pt.name as product,
+ select sm.id,
+ sm.id as move_id,
+ sp.id as picking_id,
+ sm.product_id,
+ so.id as sale_id,
+ sol.id as sale_line_id,
+ rp.id as partner_id,
+ so.user_id as salesperson_id,
+ so.partner_invoice_id,
+ sp.origin,
+ rp2.name as salesperson,
+ coalesce(pp.default_code, pt.default_code) as item_code, pt.name as product,
sm.product_uom_qty as outgoing, xm.x_name as brand, rp.name as invoice_partner
from stock_move sm
join stock_picking sp on sp.id = sm.picking_id
diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py
index 0145b112..deba960a 100644
--- a/indoteknik_custom/models/purchasing_job_multi_update.py
+++ b/indoteknik_custom/models/purchasing_job_multi_update.py
@@ -15,15 +15,15 @@ class PurchasingJobMultiUpdate(models.TransientModel):
# if product.status_apo == 'apo':
# raise UserError('Ada Purchase Order yang statusnya APO, proses dulu')
purchasing_job_state = self.env['purchasing.job.state'].search([
- ('purchasing_job_id', '=', product.id),
- ('status_apo', '=', 'apo')
+ ('purchasing_job_id', '=', product.id)
])
- if not purchasing_job_state:
- purchasing_job_state.create({
- 'purchasing_job_id': product.id,
- 'status_apo': 'apo',
- })
+ purchasing_job_state.unlink()
+
+ purchasing_job_state.create({
+ 'purchasing_job_id': product.id,
+ 'status_apo': 'apo',
+ })
apo = self.env['automatic.purchase'].generate_regular_purchase(products)
return {
diff --git a/indoteknik_custom/models/report_logbook_sj.py b/indoteknik_custom/models/report_logbook_sj.py
index 093848b5..a1b6299c 100644
--- a/indoteknik_custom/models/report_logbook_sj.py
+++ b/indoteknik_custom/models/report_logbook_sj.py
@@ -30,6 +30,13 @@ class ReportLogbookSJ(models.Model):
tracking=True,
)
+ count_line = fields.Char(string='Count Line', compute='_compute_count_line')
+
+ @api.depends('report_logbook_sj_line')
+ def _compute_count_line(self):
+ for rec in self:
+ rec.count_line = len(rec.report_logbook_sj_line)
+
@api.model
def create(self, vals):
vals['name'] = self.env['ir.sequence'].next_by_code('report.logbook.sj') or '0'
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index eee19b2f..ea06854d 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -1,5 +1,6 @@
from odoo import models, fields, api
from odoo.exceptions import UserError, ValidationError
+from datetime import datetime
class GroupPartner(models.Model):
_name = 'group.partner'
@@ -39,7 +40,24 @@ class ResPartner(models.Model):
('PNR', 'Pareto Non Repeating'),
('NP', 'Non Pareto')
])
+
+ user_payment_terms_sales = fields.Many2one('res.users', string='Users Update Payment Terms')
+ date_payment_terms_sales = fields.Datetime(string='Date Update Payment Terms')
+ user_payment_terms_purchase = fields.Many2one('res.users', string='Users Update Payment Terms')
+ date_payment_terms_purchase = fields.Datetime(string='Date Update Payment Terms')
+
+ @api.constrains('property_payment_term_id')
+ def updated_by_payment_term(self):
+ for rec in self:
+ rec.user_payment_terms_sales = self.env.user.id
+ rec.date_payment_terms_sales = datetime.utcnow()
+ @api.constrains('property_supplier_payment_term_id')
+ def updated_by_payment_term(self):
+ for rec in self:
+ rec.user_payment_terms_purchase = self.env.user.id
+ rec.date_payment_terms_purchase = datetime.utcnow()
+
@api.onchange('site_id')
def _onchange_site_id(self):
for rec in self:
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index d246f37f..9a4f9035 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -242,6 +242,14 @@ class SaleOrder(models.Model):
'Authorization': midtrans_auth,
}
+ check_url = f'https://api.midtrans.com/v2/{so_number}/status'
+ check_response = requests.get(check_url, headers=headers)
+
+ if check_response.status_code == 200:
+ status_response = check_response.json()
+ if status_response.get('transaction_status') == 'expire':
+ so_number = so_number + '-cpl'
+
json_data = {
'transaction_details': {
'order_id': so_number,
@@ -415,7 +423,7 @@ class SaleOrder(models.Model):
if self.payment_term_id.id == 31 and self.total_percent_margin < 25:
raise UserError("Jika ingin menggunakan Tempo 90 Hari maka margin harus di atas 25%")
- if self.warehouse_id.id != 8: #GD Bandengan
+ if self.warehouse_id.id != 8 and self.warehouse_id.id != 10: #GD Bandengan
raise UserError('Gudang harus Bandengan')
if self.state not in ['draft', 'sent']:
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py
index 8fb34328..11346fc9 100644
--- a/indoteknik_custom/models/sale_order_line.py
+++ b/indoteknik_custom/models/sale_order_line.py
@@ -31,6 +31,18 @@ class SaleOrderLine(models.Model):
qty_reserved = fields.Float(string='Qty Reserved', compute='_compute_qty_reserved')
reserved_from = fields.Char(string='Reserved From', copy=False)
+ @api.constrains('note_procurement')
+ def note_procurement_to_apo(self):
+ for line in self:
+ matches_so = self.env['automatic.purchase.sales.match'].search([
+ ('sale_line_id', '=', line.id),
+ ])
+
+ for match_so in matches_so:
+ match_so.note_procurement = line.note_procurement
+
+
+
@api.onchange('product_uom', 'product_uom_qty')
def product_uom_change(self):
if not self.product_uom or not self.product_id:
diff --git a/indoteknik_custom/models/uangmuka_pembelian.py b/indoteknik_custom/models/uangmuka_pembelian.py
index 26a003fd..e3ce4a20 100644
--- a/indoteknik_custom/models/uangmuka_pembelian.py
+++ b/indoteknik_custom/models/uangmuka_pembelian.py
@@ -41,7 +41,10 @@ class UangmukaPembelian(models.TransientModel):
is_have_selisih = True
for order in orders:
- ref_label = 'UANG MUKA PEMBELIAN '+order.name+' '+order.partner_id.name
+ partner_name = order.partner_id.name
+ if order.partner_id.parent_id:
+ partner_name = order.partner_id.parent_id.name
+ ref_label = 'UANG MUKA PEMBELIAN '+order.name+' '+partner_name
param_header = {
'ref': ref_label,
'date': current_time,
diff --git a/indoteknik_custom/models/uangmuka_penjualan.py b/indoteknik_custom/models/uangmuka_penjualan.py
index 65f5361b..5acf604d 100644
--- a/indoteknik_custom/models/uangmuka_penjualan.py
+++ b/indoteknik_custom/models/uangmuka_penjualan.py
@@ -44,7 +44,10 @@ class UangmukaPenjualan(models.TransientModel):
current_time = datetime.now()
for order in orders:
- ref_label = 'UANG MUKA PENJUALAN '+order.name+' '+order.partner_id.name
+ partner_name = order.partner_id.name
+ if order.partner_id.parent_id:
+ partner_name = order.partner_id.parent_id.name
+ ref_label = 'UANG MUKA PENJUALAN '+order.name+' '+partner_name
param_header = {
'ref': ref_label,
'date': current_time,
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index a5605f3b..744ce1c7 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -116,3 +116,7 @@ access_ged_api,access.ged.api,model_ged_api,,1,1,1,1
access_ged_tracking,access.ged.tracking,model_ged_tracking,,1,1,1,1
access_ged_tracking_line,access.ged.tracking.line,model_ged_tracking_line,,1,1,1,1
access_ged_tracking_log,access.ged.tracking.log,model_ged_tracking_log,,1,1,1,1
+access_account_move_multi_update_bills,access.account.move.multi_update_bills,model_account_move_multi_update_bills,,1,1,1,1
+access_def_cargo_province,access.def.cargo.province,model_def_cargo_province,,1,1,1,1
+access_def_cargo_city,access.def.cargo.city,model_def_cargo_city,,1,1,1,1
+access_def_cargo_district,access.def.cargo.district,model_def_cargo_district,,1,1,1,1
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index 1be6d118..93145fea 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -111,6 +111,8 @@
<field name="bill_day_to_due" string="Due Date" widget="remaining_days"/>
<field name="is_efaktur_uploaded" optional="hide"/>
<field name="is_invoice_uploaded" optional="hide"/>
+ <field name="invoice_date"/>
+ <field name="invoice_date_due"/>
</field>
<field name="invoice_date_due" position="attributes">
@@ -131,6 +133,9 @@
{'column_invisible': [('parent.move_type', '!=', 'in_invoice')]}
</attribute>
</field>
+ <field name="invoice_incoterm_id" position="after">
+ <field name="date_terima_tukar_faktur"/>
+ </field>
</field>
</record>
@@ -141,6 +146,14 @@
<field name="state">code</field>
<field name="code">action = records.open_form_multi_update()</field>
</record>
+
+ <record id="account_move_multi_update_bills_ir_actions_server" model="ir.actions.server">
+ <field name="name">Update Terima Faktur Bills</field>
+ <field name="model_id" ref="account.model_account_move"/>
+ <field name="binding_model_id" ref="account.model_account_move"/>
+ <field name="state">code</field>
+ <field name="code">action = records.open_form_multi_update_bills()</field>
+ </record>
<record id="account_move_multi_create_reklas_ir_actions_server" model="ir.actions.server">
<field name="name">Create Reklas Penjualan</field>
diff --git a/indoteknik_custom/views/account_move_multi_update_bills.xml b/indoteknik_custom/views/account_move_multi_update_bills.xml
new file mode 100644
index 00000000..73f92d16
--- /dev/null
+++ b/indoteknik_custom/views/account_move_multi_update_bills.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <data>
+ <record id="view_account_move_multi_update_form_bills" model="ir.ui.view">
+ <field name="name">Account Move Multi Update Bills</field>
+ <field name="model">account.move.multi_update_bills</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet>
+ <group>
+ <group>
+ <field name="date_terima_tukar_faktur" />
+ </group>
+ </group>
+ </sheet>
+ <footer>
+ <button name="save_multi_update_bills" string="Update" type="object" default_focus="1" class="oe_highlight"/>
+ <button string="Cancel" class="btn btn-secondary" special="cancel" />
+ </footer>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_account_move_multi_update_bills" model="ir.actions.act_window">
+ <field name="name">Account Move Multi Update Bills</field>
+ <field name="res_model">account.move.multi_update_bills</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="view_account_move_multi_update_form_bills"/>
+ <field name="target">new</field>
+ </record>
+ </data>
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/automatic_purchase.xml b/indoteknik_custom/views/automatic_purchase.xml
index 974fbd17..cdaf6297 100644
--- a/indoteknik_custom/views/automatic_purchase.xml
+++ b/indoteknik_custom/views/automatic_purchase.xml
@@ -44,7 +44,7 @@
<field name="name">automatic.purchase.sales.match.tree</field>
<field name="model">automatic.purchase.sales.match</field>
<field name="arch" type="xml">
- <tree>
+ <tree editable="bottom">
<field name="sale_id" readonly="1"/>
<field name="sale_line_id" readonly="1" optional="hide"/>
<field name="picking_id" readonly="1" optional="hide"/>
@@ -57,6 +57,7 @@
<field name="product_id" readonly="1"/>
<field name="qty_so" readonly="1"/>
<field name="qty_po" readonly="1"/>
+ <field name="note_procurement"/>
</tree>
</field>
</record>
diff --git a/indoteknik_custom/views/def_cargo_city.xml b/indoteknik_custom/views/def_cargo_city.xml
new file mode 100644
index 00000000..8f8beec5
--- /dev/null
+++ b/indoteknik_custom/views/def_cargo_city.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <record id="def_cargo_city_tree" model="ir.ui.view">
+ <field name="name">def.cargo.city.tree</field>
+ <field name="model">def.cargo.city</field>
+ <field name="arch" type="xml">
+ <tree editable="top">
+ <field name="name"/>
+ <field name="province_id"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="def_cargo_city_form" model="ir.ui.view">
+ <field name="name">def.cargo.city.form</field>
+ <field name="model">def.cargo.city</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet string="Def Cargo City">
+ <group>
+ <group>
+ <field name="name" required="1"/>
+ <field name="province_id"/>
+ </group>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record id="def_cargo_city_action" model="ir.actions.act_window">
+ <field name="name">Def Cargo City</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">def.cargo.city</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem name="Def Cargo City" action="def_cargo_city_action"
+ id="menu_def_cargo_city"
+ parent="delivery.menu_delivery" sequence="112"/>
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/def_cargo_district.xml b/indoteknik_custom/views/def_cargo_district.xml
new file mode 100644
index 00000000..109fbcba
--- /dev/null
+++ b/indoteknik_custom/views/def_cargo_district.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <record id="def_cargo_district_tree" model="ir.ui.view">
+ <field name="name">def.cargo.district.tree</field>
+ <field name="model">def.cargo.district</field>
+ <field name="arch" type="xml">
+ <tree>
+ <field name="name"/>
+ <field name="city_id"/>
+ <field name="coverage"/>
+ <field name="rate"/>
+ <field name="next_kg"/>
+ <field name="sla"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="def_cargo_district_form" model="ir.ui.view">
+ <field name="name">def.cargo.district.form</field>
+ <field name="model">def.cargo.district</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet string="Def Cargo District">
+ <group>
+ <group>
+ <field name="name" required="1"/>
+ <field name="city_id"/>
+ <field name="coverage"/>
+ <field name="rate"/>
+ <field name="next_kg"/>
+ <field name="sla"/>
+ </group>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record id="def_cargo_district_action" model="ir.actions.act_window">
+ <field name="name">Def Cargo District</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">def.cargo.district</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem name="Def Cargo District" action="def_cargo_district_action"
+ id="menu_def_cargo_district"
+ parent="delivery.menu_delivery" sequence="112"/>
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/def_cargo_province.xml b/indoteknik_custom/views/def_cargo_province.xml
new file mode 100644
index 00000000..37dc9162
--- /dev/null
+++ b/indoteknik_custom/views/def_cargo_province.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <record id="def_cargo_province_tree" model="ir.ui.view">
+ <field name="name">def.cargo.province.tree</field>
+ <field name="model">def.cargo.province</field>
+ <field name="arch" type="xml">
+ <tree editable="top">
+ <field name="name"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="def_cargo_province_form" model="ir.ui.view">
+ <field name="name">def.cargo.province.form</field>
+ <field name="model">def.cargo.province</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet string="Def Cargo Province">
+ <group>
+ <group>
+ <field name="name" required="1"/>
+ </group>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record id="def_cargo_province_action" model="ir.actions.act_window">
+ <field name="name">Def Cargo Province</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">def.cargo.province</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem name="Def Cargo Province" action="def_cargo_province_action"
+ id="menu_def_cargo_province"
+ parent="delivery.menu_delivery" sequence="112"/>
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml
index 9994d28d..567d5e8c 100644
--- a/indoteknik_custom/views/dunning_run.xml
+++ b/indoteknik_custom/views/dunning_run.xml
@@ -79,6 +79,10 @@
</page>
</notebook>
</sheet>
+ <div class="oe_chatter">
+ <field name="message_follower_ids" widget="mail_followers"/>
+ <field name="message_ids" widget="mail_thread"/>
+ </div>
</form>
</field>
</record>
diff --git a/indoteknik_custom/views/dunning_run_ged.xml b/indoteknik_custom/views/dunning_run_ged.xml
index ecda228d..90a2950b 100644
--- a/indoteknik_custom/views/dunning_run_ged.xml
+++ b/indoteknik_custom/views/dunning_run_ged.xml
@@ -6,13 +6,6 @@
<field name="model">dunning.run</field>
<field name="inherit_id" ref="indoteknik_custom.dunning_run_form"/>
<field name="arch" type="xml">
- <field name="is_validated" position="before">
- <button name="get_tracking_history_by_awb"
- string="Get Tracking"
- type="object"
- class="oe_highlight oe_edit_only"
- />
- </field>
<page id="invoice_tab" position="after">
<page string="Tracking">
<field name="ged_tracking"/>
@@ -21,6 +14,29 @@
<field name="ged_tracking_line"/>
</page>
</page>
+ <field name="shipper_faktur_id" position="after">
+ <field name="last_status_awb" readonly="1"/>
+ </field>
+ <field name="notification" position="after">
+ <button name="get_tracking_history_by_awb"
+ string="Get Tracking"
+ type="object"
+ />
+ <button name="get_tracking_history_by_awb_log"
+ string="Logging"
+ type="object"
+ />
+ </field>
+ </field>
+ </record>
+ <record id="ged_tracking_tree_inherit" model="ir.ui.view">
+ <field name="name">Dunning Run Tree GED</field>
+ <field name="model">dunning.run</field>
+ <field name="inherit_id" ref="indoteknik_custom.dunning_run_tree"/>
+ <field name="arch" type="xml">
+ <field name="shipper_faktur_id" position="after">
+ <field name="last_status_awb"/>
+ </field>
</field>
</record>
</data>
diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml
index 309cbcc5..052a1eba 100755
--- a/indoteknik_custom/views/product_template.xml
+++ b/indoteknik_custom/views/product_template.xml
@@ -12,6 +12,8 @@
<field name="x_model_product"/>
<field name="kind_of"/>
<field name="x_studio_field_tGhJR" widget="many2many_tags"/>
+ <field name="sni"/>
+ <field name="tkdn"/>
</field>
<field name="uom_po_id" position="after">
<field name="unpublished" />
diff --git a/indoteknik_custom/views/promotion/promotion_monitoring.xml b/indoteknik_custom/views/promotion/promotion_monitoring.xml
index 88325c52..5f6490ed 100644
--- a/indoteknik_custom/views/promotion/promotion_monitoring.xml
+++ b/indoteknik_custom/views/promotion/promotion_monitoring.xml
@@ -10,6 +10,8 @@
<field name="has_promo" />
<field name="count_active" />
<field name="count_inactive" />
+ <field name="human_last_update" />
+ <field name="promotion_program_line_names"/>
</tree>
</field>
</record>
@@ -28,6 +30,7 @@
<field name="has_promo" />
<field name="count_active" />
<field name="count_inactive" />
+ <field name="human_last_update" />
</group>
</group>
</sheet>
diff --git a/indoteknik_custom/views/purchasing_job.xml b/indoteknik_custom/views/purchasing_job.xml
index 290955cf..16f1bedd 100644
--- a/indoteknik_custom/views/purchasing_job.xml
+++ b/indoteknik_custom/views/purchasing_job.xml
@@ -14,7 +14,7 @@
<field name="onhand"/>
<field name="incoming"/>
<field name="outgoing"/>
- <field name="status_apo"/>
+ <field name="status_apo" invisible="1"/>
<field name="action"/>
<field name="note"/>
</tree>
diff --git a/indoteknik_custom/views/report_logbook_sj.xml b/indoteknik_custom/views/report_logbook_sj.xml
index 687464f0..147ae393 100644
--- a/indoteknik_custom/views/report_logbook_sj.xml
+++ b/indoteknik_custom/views/report_logbook_sj.xml
@@ -60,6 +60,7 @@
<field name="state" readonly="1"/>
<field name="created_by" readonly="1"/>
<field name="approve_by" readonly="1"/>
+ <field name="count_line" readonly="1"/>
</group>
</group>
<notebook>
diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml
index 59d33f29..fd8c8202 100644
--- a/indoteknik_custom/views/res_partner.xml
+++ b/indoteknik_custom/views/res_partner.xml
@@ -11,6 +11,14 @@
<field name="counter"/>
<field name="reference_number"/>
</field>
+ <field name="property_payment_term_id" position="after">
+ <field name="user_payment_terms_sales" readonly="1"/>
+ <field name="date_payment_terms_sales" readonly="1"/>
+ </field>
+ <field name="property_supplier_payment_term_id" position="after">
+ <field name="user_payment_terms_purchase" readonly="1"/>
+ <field name="date_payment_terms_purchase" readonly="1"/>
+ </field>
<field name="industry_id" position="after">
<field name="company_type_id"/>
<field name="group_partner_id"/>