summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/__init__.py3
-rw-r--r--indoteknik_custom/models/account_move.py10
-rw-r--r--indoteknik_custom/models/account_move_multi_update.py26
-rw-r--r--indoteknik_custom/models/bill_receipt.py3
-rw-r--r--indoteknik_custom/models/product_sla.py9
-rwxr-xr-xindoteknik_custom/models/product_template.py2
-rwxr-xr-xindoteknik_custom/models/sale_order.py10
-rwxr-xr-xindoteknik_custom/models/stock_vendor.py1
8 files changed, 52 insertions, 12 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 929fc8ba..5b8fcc54 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -71,4 +71,5 @@ from . import token_storage
from . import product_sla
from . import account_move_due_extension
from . import voucher
-from . import bill_receipt \ No newline at end of file
+from . import bill_receipt
+from . import account_move_multi_update \ No newline at end of file
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index bc6061ee..4db97706 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -15,6 +15,7 @@ class AccountMove(models.Model):
date_kirim_tukar_faktur = fields.Date(string='Kirim Faktur')
resi_tukar_faktur = fields.Char(string='Resi Faktur')
date_terima_tukar_faktur = fields.Date(string='Terima Faktur')
+ payment_schedule = fields.Date(string='Jadwal Pembayaran')
shipper_faktur_id = fields.Many2one('delivery.carrier', string='Shipper Faktur')
due_extension = fields.Integer(string='Due Extension', default=0)
new_due_date = fields.Date(string='New Due')
@@ -114,4 +115,11 @@ class AccountMove(models.Model):
add_days += line.days
due_date = tukar_date + timedelta(days=add_days)
invoice.invoice_date_due = due_date
- \ No newline at end of file
+
+ def open_form_multi_update(self):
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_account_move_multi_update')
+ action['context'] = {
+ 'move_ids': [x.id for x in self]
+ }
+ return action
+ \ No newline at end of file
diff --git a/indoteknik_custom/models/account_move_multi_update.py b/indoteknik_custom/models/account_move_multi_update.py
new file mode 100644
index 00000000..4b650868
--- /dev/null
+++ b/indoteknik_custom/models/account_move_multi_update.py
@@ -0,0 +1,26 @@
+from odoo import models, fields
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class AccountMoveMultiUpdate(models.TransientModel):
+ _name = 'account.move.multi_update'
+
+ payment_schedule = fields.Date(string="Jadwal Pembayaran")
+
+ def save_multi_update(self):
+ move_ids = self._context['move_ids']
+ moves = self.env['account.move'].browse(move_ids)
+ moves.update({
+ 'payment_schedule': self.payment_schedule
+ })
+ 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/bill_receipt.py b/indoteknik_custom/models/bill_receipt.py
index 5e03fdce..76449c1f 100644
--- a/indoteknik_custom/models/bill_receipt.py
+++ b/indoteknik_custom/models/bill_receipt.py
@@ -89,7 +89,6 @@ class BillReceipt(models.Model):
'partner_id': invoice.partner_id.id,
'invoice_id': invoice.id,
'date_invoice': invoice.invoice_date,
- 'efaktur_id': invoice.efaktur_id.id,
'reference': invoice.ref,
'total_amt': invoice.amount_total,
'open_amt': invoice.amount_residual_signed,
@@ -114,8 +113,6 @@ class BillReceiptLine(models.Model):
partner_id = fields.Many2one('res.partner', string='Customer')
invoice_id = fields.Many2one('account.move', string='Invoice')
date_invoice = fields.Date(string='Invoice Date')
- # due_date = fields.Date(string='Due Date')
- efaktur_id = fields.Many2one('vit.efaktur', string='Faktur Pajak')
reference = fields.Char(string='Reference')
total_amt = fields.Float(string='Total Amount')
open_amt = fields.Float(string='Open Amount')
diff --git a/indoteknik_custom/models/product_sla.py b/indoteknik_custom/models/product_sla.py
index f969502f..2e663d30 100644
--- a/indoteknik_custom/models/product_sla.py
+++ b/indoteknik_custom/models/product_sla.py
@@ -51,12 +51,9 @@ class ProductSla(models.Model):
qty_available = 0
qty_available = product.qty_onhand_bandengan
- qty_available -= 10
- if qty_available < 10:
- qty_available = 0
-
- if qty_available > 10:
+
+ if qty_available > 0:
self.sla = '1 Hari'
query = [
@@ -80,7 +77,7 @@ class ProductSla(models.Model):
rounded_leadtime = math.ceil(avg_leadtime)
self.avg_leadtime = rounded_leadtime
if rounded_leadtime >= 1 and rounded_leadtime <= 5:
- self.sla = '3-6 Hari'
+ self.sla = '3-7 Hari'
elif rounded_leadtime >= 6 and rounded_leadtime <= 10:
self.sla = '4-12 Hari'
elif rounded_leadtime >= 11:
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 1a83b702..7abdf1c1 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -221,7 +221,7 @@ class ProductTemplate(models.Model):
datas = json.loads(response.text)['data']
qty = 0
for data in datas:
- availability = int(data['availability']) # Mengonversi ke tipe data int
+ availability = float(data['availability']) # Mengonversi ke tipe data int
qty += availability # Mengakumulasi qty dari setiap data
return qty
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index deea64a1..552f1b0a 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -243,6 +243,16 @@ class SaleOrder(models.Model):
self.npwp = parent_id.npwp
self.sppkp = parent_id.sppkp
self.customer_type = parent_id.customer_type
+
+ @api.onchange('partner_id')
+ def onchange_partner_id(self):
+ # INHERIT
+ result = super(SaleOrder, self).onchange_partner_id()
+ parent_id = self.partner_id.parent_id
+ parent_id = parent_id if parent_id else self.partner_id
+
+ self.partner_invoice_id = parent_id
+ return result
def _get_purchases(self):
po_state = ['done', 'draft', 'purchase']
diff --git a/indoteknik_custom/models/stock_vendor.py b/indoteknik_custom/models/stock_vendor.py
index 1e5bce16..f214a5e1 100755
--- a/indoteknik_custom/models/stock_vendor.py
+++ b/indoteknik_custom/models/stock_vendor.py
@@ -1,5 +1,6 @@
from odoo import fields, models, api
import logging
+from datetime import datetime, timedelta
_logger = logging.getLogger(__name__)