diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2023-08-09 08:12:22 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2023-08-09 08:12:22 +0000 |
| commit | 7ef85851c3c097a5e67596ac2630d0e8268dd008 (patch) | |
| tree | a4a48e6348cdb4812ca71356bfd4fa4ceb137698 | |
| parent | 207c8f4f288e841d4f69525c9d688f230d116ff6 (diff) | |
| parent | 9a5b528c2d5afc4b6f1da30e14167b0bc33ae923 (diff) | |
Merged in production (pull request #93)
Production
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 3 | ||||
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/account_financial_report.py | 22 | ||||
| -rw-r--r-- | indoteknik_custom/models/account_general_ledger.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/account_report_financial.py | 22 | ||||
| -rw-r--r-- | indoteknik_custom/models/account_report_general_ledger.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 15 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 15 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_financial_report_view.xml | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_report_general_ledger_view.xml | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/mail_template_po.xml | 86 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 3 |
12 files changed, 123 insertions, 51 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 2cd7ad6e..18031c25 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -84,11 +84,12 @@ 'views/product_sla.xml', 'views/voucher.xml', 'views/bill_receipt.xml', - 'views/account_financial_report_view.xml', + 'views/account_financial_report_view.xml', 'views/account_report_general_ledger_view.xml', 'views/account_move_multi_update.xml', 'views/airway_bill.xml', 'views/product_attribute_value.xml', + 'views/mail_template_po.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 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: diff --git a/indoteknik_custom/views/account_financial_report_view.xml b/indoteknik_custom/views/account_financial_report_view.xml index 31c04e7c..7c156599 100644 --- a/indoteknik_custom/views/account_financial_report_view.xml +++ b/indoteknik_custom/views/account_financial_report_view.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> - + <record id="account_financial_report_view_custom" model="ir.ui.view"> <field name="name">Common Report</field> <field name="model">accounting.report.xlsx</field> diff --git a/indoteknik_custom/views/account_report_general_ledger_view.xml b/indoteknik_custom/views/account_report_general_ledger_view.xml index b789874f..61c0ffff 100644 --- a/indoteknik_custom/views/account_report_general_ledger_view.xml +++ b/indoteknik_custom/views/account_report_general_ledger_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<odoo> +<odoo> <record id="account_report_export_ledger_custom_view" model="ir.ui.view"> <field name="name">Export Ledger</field> <field name="model">account.report.general.ledger.xlsx</field> diff --git a/indoteknik_custom/views/mail_template_po.xml b/indoteknik_custom/views/mail_template_po.xml new file mode 100644 index 00000000..77c21837 --- /dev/null +++ b/indoteknik_custom/views/mail_template_po.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" ?> +<odoo> + <data noupdate="0"> + <record id="mail_template_po_sync_price" model="mail.template"> + <field name="name">PO: Sync Unit Price Purchase Pricelist</field> + <field name="model_id" ref="model_purchase_order" /> + <field name="subject">Your PO ${object.name}</field> + <field name="email_from"></field> + <field name="email_to">darren@indoteknik.co.id</field> + <field name="body_html" type="html"> + <table border="0" cellpadding="0" cellspacing="0" + style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"> + <tr> + <td align="center"> + <table border="0" cellpadding="0" cellspacing="0" width="590" + style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;"> + <tbody> + <!-- HEADER --> + <tr> + <td align="center" style="min-width: 590px;"> + <table border="0" cellpadding="0" cellspacing="0" width="590" + style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;"> + <tr> + <td valign="middle"> + <span style="font-size: 10px;">PO</span><br /> + <span style="font-size: 20px; font-weight: bold;"> + ${object.name} + </span> + </td> + </tr> + <tr> + <td colspan="2" style="text-align:center;"> + <hr width="100%" + style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" /> + </td> + </tr> + </table> + </td> + </tr> + <!-- CONTENT --> + <tr> + <td align="center" style="min-width: 590px;"> + <table border="0" cellpadding="0" cellspacing="0" width="590" + style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;"> + <tr> + <td valign="top" style="font-size: 13px;"> + <div> + Dear Stefanus Darren, + <br/><br/> + Terdapat PO yang harga Unit Price nya tidak sama dengan yang ada di purchase pricelist nya. + <br/><br/> + Berikut adalah rincian PO: + % for line in object.order_line: + % if line.price_vendor != 0 and line.price_unit != line.price_vendor + <ul> + <li>Nama Produk: ${line.product_id.name}</li> + <li>Harga Unit dalam PO: ${line.price_unit}</li> + <li>Harga Unit dalam Purchase Pricelist: ${line.price_vendor}</li> + </ul> + % endif + % endfor + Silahkan periksa dan lakukan koreksi jika diperlukan. + <br/><br/> + Terima kasih. + </div> + </td> + </tr> + <tr> + <td style="text-align:center;"> + <hr width="100%" + style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" /> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> + </td> + </tr> + </table> + </field> + <field name="auto_delete" eval="True" /> + </record> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 2f8590f3..7d436c46 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -56,6 +56,9 @@ <field name="qty_available_store"/> <field name="suggest"/> </field> + <field name="price_unit" position="after"> + <field name="price_vendor" attrs="{'readonly': 1}" optional="hide"/> + </field> <page name="purchase_delivery_invoice" position="after"> <page name="purchase_vendor_bills" string="Vendor Bills" groups="indoteknik_custom.technical_administrator"> <group> |
