summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/__init__.py2
-rw-r--r--indoteknik_custom/models/account_financial_report.py22
-rw-r--r--indoteknik_custom/models/account_general_ledger.py1
-rw-r--r--indoteknik_custom/models/account_report_financial.py22
-rw-r--r--indoteknik_custom/models/account_report_general_ledger.py1
-rwxr-xr-xindoteknik_custom/models/purchase_order.py15
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py15
7 files changed, 30 insertions, 48 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index f26cbec2..843beeae 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -78,4 +78,4 @@ from . import account_move_multi_update
from . import account_financial_report
from . import account_general_ledger
from . import account_report_financial
-from . import account_report_general_ledger \ No newline at end of file
+from . import account_report_general_ledger
diff --git a/indoteknik_custom/models/account_financial_report.py b/indoteknik_custom/models/account_financial_report.py
index 114449ce..1bf6816a 100644
--- a/indoteknik_custom/models/account_financial_report.py
+++ b/indoteknik_custom/models/account_financial_report.py
@@ -1,25 +1,3 @@
-# -*- coding: utf-8 -*-
-######################################################################################
-#
-# Cybrosys Technologies Pvt. Ltd.
-#
-# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
-# Author: Cybrosys Technologies(odoo@cybrosys.com)
-#
-# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
-# It is forbidden to publish, distribute, sublicense, or sell copies of the Software
-# or modified copies of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-########################################################################################
-
from datetime import datetime
import json
import datetime
diff --git a/indoteknik_custom/models/account_general_ledger.py b/indoteknik_custom/models/account_general_ledger.py
index 50d52374..e80696a4 100644
--- a/indoteknik_custom/models/account_general_ledger.py
+++ b/indoteknik_custom/models/account_general_ledger.py
@@ -2,7 +2,6 @@ import time
from odoo import api, models, _
from odoo.exceptions import UserError
-
class ReportGeneralLedger(models.AbstractModel):
_name = 'report.account.report_generalledger'
diff --git a/indoteknik_custom/models/account_report_financial.py b/indoteknik_custom/models/account_report_financial.py
index 9ed526da..c11fa25b 100644
--- a/indoteknik_custom/models/account_report_financial.py
+++ b/indoteknik_custom/models/account_report_financial.py
@@ -1,25 +1,3 @@
-# -*- coding: utf-8 -*-
-######################################################################################
-#
-# Cybrosys Technologies Pvt. Ltd.
-#
-# Copyright (C) 2020-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
-# Author: Cybrosys Technologies (odoo@cybrosys.com)
-#
-# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
-# It is forbidden to publish, distribute, sublicense, or sell copies of the Software
-# or modified copies of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-########################################################################################
-
import time
from odoo import api, models, _
from odoo.exceptions import UserError
diff --git a/indoteknik_custom/models/account_report_general_ledger.py b/indoteknik_custom/models/account_report_general_ledger.py
index 4e909872..54e5bbd7 100644
--- a/indoteknik_custom/models/account_report_general_ledger.py
+++ b/indoteknik_custom/models/account_report_general_ledger.py
@@ -218,7 +218,6 @@ class AccountReportGeneralLedger(models.TransientModel):
sheet.write(row_number, col_number + 17, balance_month, format5)
row_number += 1
-
workbook.close()
output.seek(0)
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 7091bb72..d73f9037 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -187,13 +187,21 @@ class PurchaseOrder(models.Model):
def button_confirm(self):
res = super(PurchaseOrder, self).button_confirm()
+
if self.total_percent_margin < self.total_so_percent_margin and not self.env.user.is_purchasing_manager and not self.env.user.is_leader:
raise UserError("Beda Margin dengan Sales, harus approval Manager")
if not self.sale_order_id and not self.env.user.is_purchasing_manager and not self.env.user.is_leader:
raise UserError("Tidak ada link dengan SO, harus approval Manager")
+ send_email = False
for line in self.order_line:
if not line.product_id.purchase_ok:
- raise UserError("Terdapat barang yang tidak bisa di proses")
+ raise UserError("Terdapat barang yang tidak bisa diproses")
+ if line.price_vendor != 0 and line.price_unit != line.price_vendor:
+ send_email = True
+ break
+
+ if send_email:
+ self._send_mail()
self.approval_status = 'approved'
self.po_status = 'menunggu'
@@ -206,6 +214,11 @@ class PurchaseOrder(models.Model):
self.date_planned = delta_time
return res
+
+ def _send_mail(self):
+ template_id = self.env.ref('indoteknik_custom.mail_template_po_sync_price').id
+ template = self.env['mail.template'].browse(template_id)
+ template.send_mail(self.id, force_send=True)
def po_approve(self):
if self.env.user.is_leader or self.env.user.is_purchasing_manager:
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index f255095f..39aeba0f 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -28,6 +28,21 @@ class PurchaseOrderLine(models.Model):
qty_outgoing = fields.Float('Qty Outgoing', compute='compute_qty_stock')
qty_available_store = fields.Float(string='Available')
suggest = fields.Char(string='Suggest')
+ price_vendor = fields.Float(string='Price Vendor', compute='compute_price_vendor')
+
+ def compute_price_vendor(self):
+ for line in self:
+ purchase_pricelist = self.env['purchase.pricelist'].search([
+ ('product_id', '=', line.product_id.id),
+ ('vendor_id', '=', line.order_id.partner_id.id)
+ ], limit=1)
+
+ if purchase_pricelist:
+ price_vendor = format(purchase_pricelist.product_price, ".2f")
+ price_vendor = float(price_vendor)
+ line.price_vendor = price_vendor
+ else:
+ line.price_vendor = 0
def compute_qty_stock(self):
for line in self: