From ea655e339f1096fdc3c1aa23ba36d0109e9df760 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 3 Aug 2023 15:12:47 +0700 Subject: ledger --- indoteknik_custom/__manifest__.py | 2 + indoteknik_custom/models/__init__.py | 6 +- .../models/account_financial_report.py | 39 ++++ indoteknik_custom/models/account_general_ledger.py | 124 ++++++++++++ .../models/account_report_financial.py | 180 ++++++++++++++++++ .../models/account_report_general_ledger.py | 208 +++++++++++++++++++++ .../views/account_financial_report_view.xml | 51 +++++ .../views/account_report_general_ledger_view.xml | 37 ++++ 8 files changed, 646 insertions(+), 1 deletion(-) create mode 100644 indoteknik_custom/models/account_financial_report.py create mode 100644 indoteknik_custom/models/account_general_ledger.py create mode 100644 indoteknik_custom/models/account_report_financial.py create mode 100644 indoteknik_custom/models/account_report_general_ledger.py create mode 100644 indoteknik_custom/views/account_financial_report_view.xml create mode 100644 indoteknik_custom/views/account_report_general_ledger_view.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index dfe22fd2..362b2b2b 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -84,6 +84,8 @@ 'views/product_sla.xml', 'views/voucher.xml', 'views/bill_receipt.xml', + 'views/account_financial_report_view.xml', + 'views/account_report_general_ledger_view.xml', 'views/account_move_multi_update.xml', 'report/report.xml', 'report/report_banner_banner.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 5b8fcc54..45c30473 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -72,4 +72,8 @@ from . import product_sla from . import account_move_due_extension from . import voucher from . import bill_receipt -from . import account_move_multi_update \ No newline at end of file +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 diff --git a/indoteknik_custom/models/account_financial_report.py b/indoteknik_custom/models/account_financial_report.py new file mode 100644 index 00000000..114449ce --- /dev/null +++ b/indoteknik_custom/models/account_financial_report.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +###################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# 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 +import io +from odoo import api, fields, models, _ +from odoo.tools import date_utils +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class AccountingReport(models.TransientModel): + _inherit = "accounting.report.xlsx" + + + \ No newline at end of file diff --git a/indoteknik_custom/models/account_general_ledger.py b/indoteknik_custom/models/account_general_ledger.py new file mode 100644 index 00000000..6f73544c --- /dev/null +++ b/indoteknik_custom/models/account_general_ledger.py @@ -0,0 +1,124 @@ +import time +from odoo import api, models, _ +from odoo.exceptions import UserError + + +class ReportGeneralLedger(models.AbstractModel): + _inherit = 'report.account.report_generalledger' + + def _get_account_move_entry_posted_custom(self, accounts, init_balance, sortby, display_account): + cr = self.env.cr + MoveLine = self.env['account.move.line'] + move_lines = {x: [] for x in accounts.ids} + + # Prepare initial sql query and Get the initial move lines + if init_balance: + init_tables, init_where_clause, init_where_params = MoveLine.with_context(date_from=self.env.context.get('date_from'), date_to=False, initial_bal=True)._query_get() + init_wheres = [""] + if init_where_clause.strip(): + init_wheres.append(init_where_clause.strip()) + init_filters = " AND ".join(init_wheres) + filters = init_filters.replace('account_move_line__move_id', 'm').replace('account_move_line', 'l') + sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\ + '' AS move_name, '' AS mmove_id, '' AS currency_code,\ + NULL AS currency_id,\ + '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\ + '' AS partner_name\ + FROM account_move_line l\ + LEFT JOIN account_move m ON (l.move_id=m.id)\ + LEFT JOIN res_currency c ON (l.currency_id=c.id)\ + LEFT JOIN res_partner p ON (l.partner_id=p.id)\ + LEFT JOIN account_move i ON (m.id =i.id)\ + JOIN account_journal j ON (l.journal_id=j.id)\ + WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id') + + params = (tuple(accounts.ids),) + tuple(init_where_params) + cr.execute(sql, params) + for row in cr.dictfetchall(): + move_lines[row.pop('account_id')].append(row) + + sql_sort = 'l.date, l.move_id' + if sortby == 'sort_journal_partner': + sql_sort = 'j.code, p.name, l.move_id' + + # Prepare sql query base on selected parameters from wizard + tables, where_clause, where_params = MoveLine._query_get() + wheres = [""] + if where_clause.strip(): + wheres.append(where_clause.strip()) + filters = " AND ".join(wheres) + filters = filters.replace('account_move_line__move_id', 'm').replace('account_move_line', 'l') + + # Get move lines base on sql query and Calculate the total balance of move lines + sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\ + m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\ + FROM account_move_line l\ + JOIN account_move m ON (l.move_id=m.id)\ + LEFT JOIN res_currency c ON (l.currency_id=c.id)\ + LEFT JOIN res_partner p ON (l.partner_id=p.id)\ + JOIN account_journal j ON (l.journal_id=j.id)\ + JOIN account_account acc ON (l.account_id = acc.id) \ + WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort) + params = (tuple(accounts.ids),) + tuple(where_params) + cr.execute(sql, params) + + for row in cr.dictfetchall(): + balance = 0 + for line in move_lines.get(row['account_id']): + balance += line['debit'] - line['credit'] + row['balance'] += balance + move_lines[row.pop('account_id')].append(row) + + # Calculate the debit, credit and balance for Accounts + account_res = [] + for account in accounts: + currency = account.currency_id and account.currency_id or account.company_id.currency_id + res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance']) + res['code'] = account.code + res['name'] = account.name + res['company_id'] = account.company_id.id + res['move_lines'] = move_lines[account.id] + for line in res.get('move_lines'): + res['debit'] += line['debit'] + res['credit'] += line['credit'] + res['balance'] = res['balance'] + if display_account == 'all': + account_res.append(res) + if display_account == 'movement' and res.get('move_lines'): + account_res.append(res) + if display_account == 'not_zero' and not currency.is_zero(res['balance']): + account_res.append(res) + + return account_res + + @api.model + def _get_report_values(self, docids, data=None): + if not data.get('form') or not self.env.context.get('active_model'): + raise UserError(_("Form content is missing, this report cannot be printed.")) + + model = self.env.context.get('active_model') + docs = self.env[model].browse(self.env.context.get('active_ids', [])) + + init_balance = data['form'].get('initial_balance', True) + sortby = data['form'].get('sortby', 'sort_date') + display_account = data['form']['display_account'] + codes = [] + if data['form'].get('journal_ids', False): + codes = [journal.code for journal in self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])] + + accounts = docs if model == 'account.account' else self.env['account.account'].search([]) + date_from = data['form'].get('date_from', False) + date_to = data['form'].get('date_to', False) + accounts_res = self.with_context(data['form'].get('used_context', {}))._get_account_move_entry_posted_custom(accounts, init_balance, sortby, display_account, date_from, date_to) + for account in accounts_res: + debit_sum = sum(line['debit'] for line in account['move_lines']) + + return { + 'doc_ids': docids, + 'doc_model': model, + 'data': data['form'], + 'docs': docs, + 'time': time, + 'Accounts': accounts_res, + 'print_journal': codes, + } diff --git a/indoteknik_custom/models/account_report_financial.py b/indoteknik_custom/models/account_report_financial.py new file mode 100644 index 00000000..9ed526da --- /dev/null +++ b/indoteknik_custom/models/account_report_financial.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +###################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# 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 + + +class ReportFinancial(models.AbstractModel): + _inherit = 'report.account.report_financial' + + def _compute_account_balance(self, accounts): + """ compute the balance, debit and credit for the provided accounts """ + mapping = { + 'balance': "COALESCE(SUM(debit),0) - COALESCE(SUM(credit), 0) as balance", + 'debit': "COALESCE(SUM(debit), 0) as debit", + 'credit': "COALESCE(SUM(credit), 0) as credit", + } + + res = {} + for account in accounts: + res[account.id] = dict.fromkeys(mapping, 0.0) + if accounts: + tables, where_clause, where_params = self.env['account.move.line']._query_get() + tables = tables.replace('"', '') if tables else "account_move_line" + wheres = [""] + if where_clause.strip(): + wheres.append(where_clause.strip()) + filters = " AND ".join(wheres) + request = "SELECT account_id as id, " + ', '.join(mapping.values()) + \ + " FROM " + tables + \ + " WHERE account_id IN %s " \ + + filters + \ + " GROUP BY account_id" + params = (tuple(accounts._ids),) + tuple(where_params) + self.env.cr.execute(request, params) + for row in self.env.cr.dictfetchall(): + res[row['id']] = row + return res + + def _compute_report_balance(self, reports): + '''returns a dictionary with key=the ID of a record and value=the credit, debit and balance amount + computed for this record. If the record is of type : + 'accounts' : it's the sum of the linked accounts + 'account_type' : it's the sum of leaf accoutns with such an account_type + 'account_report' : it's the amount of the related report + 'sum' : it's the sum of the children of this record (aka a 'view' record)''' + res = {} + fields = ['credit', 'debit', 'balance'] + for report in reports: + if report.id in res: + continue + res[report.id] = dict((fn, 0.0) for fn in fields) + if report.type == 'accounts': + # it's the sum of the linked accounts + res[report.id]['account'] = self._compute_account_balance(report.account_ids) + for value in res[report.id]['account'].values(): + for field in fields: + res[report.id][field] += value.get(field) + elif report.type == 'account_type': + # it's the sum the leaf accounts with such an account type + accounts = self.env['account.account'].search([('user_type_id', 'in', report.account_type_ids.ids)]) + res[report.id]['account'] = self._compute_account_balance(accounts) + for value in res[report.id]['account'].values(): + for field in fields: + res[report.id][field] += value.get(field) + elif report.type == 'account_report' and report.account_report_id: + # it's the amount of the linked report + res2 = self._compute_report_balance(report.account_report_id) + for key, value in res2.items(): + for field in fields: + res[report.id][field] += value[field] + elif report.type == 'sum': + # it's the sum of the children of this account.report + res2 = self._compute_report_balance(report.children_ids) + for key, value in res2.items(): + for field in fields: + res[report.id][field] += value[field] + return res + + def get_account_lines(self, data): + lines = [] + account_report = self.env['account.financial.report'].search([('id', '=', data['account_report_id'][0])]) + child_reports = account_report._get_children_by_order() + res = self.with_context(data.get('used_context'))._compute_report_balance(child_reports) + if data['enable_filter']: + comparison_res = self.with_context(data.get('comparison_context'))._compute_report_balance(child_reports) + for report_id, value in comparison_res.items(): + res[report_id]['comp_bal'] = value['balance'] + report_acc = res[report_id].get('account') + if report_acc: + for account_id, val in comparison_res[report_id].get('account').items(): + report_acc[account_id]['comp_bal'] = val['balance'] + + for report in child_reports: + vals = { + 'name': report.name, + 'balance': res[report.id]['balance'] * int(report.sign), + 'type': 'report', + 'level': bool(report.style_overwrite) and report.level, + 'account_type': report.type or False, #used to underline the financial report balances + } + if data['debit_credit']: + vals['debit'] = res[report.id]['debit'] + vals['credit'] = res[report.id]['credit'] + + if data['enable_filter']: + vals['balance_cmp'] = res[report.id]['comp_bal'] * int(report.sign) + + lines.append(vals) + if report.display_detail == 'no_detail': + #the rest of the loop is used to display the details of the financial report, so it's not needed here. + continue + + if res[report.id].get('account'): + sub_lines = [] + for account_id, value in res[report.id]['account'].items(): + #if there are accounts to display, we add them to the lines with a level equals to their level in + #the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data + #financial reports for Assets, liabilities...) + flag = False + account = self.env['account.account'].browse(account_id) + vals = { + 'name': account.code + ' ' + account.name, + 'balance': value['balance'] * int(report.sign) or 0.0, + 'type': 'account', + 'level': report.display_detail == 'detail_with_hierarchy' and 4, + 'account_type': account.internal_type, + } + if data['debit_credit']: + vals['debit'] = value['debit'] + vals['credit'] = value['credit'] + if not account.company_id.currency_id.is_zero(vals['debit']) or not account.company_id.currency_id.is_zero(vals['credit']): + flag = True + if not account.company_id.currency_id.is_zero(vals['balance']): + flag = True + if data['enable_filter']: + vals['balance_cmp'] = value['comp_bal'] * int(report.sign) + if not account.company_id.currency_id.is_zero(vals['balance_cmp']): + flag = True + if flag: + sub_lines.append(vals) + lines += sorted(sub_lines, key=lambda sub_line: sub_line['name']) + return lines + + @api.model + def get_report_values(self, docids, data=None): + if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'): + raise UserError(_("Form content is missing, this report cannot be printed.")) + + self.model = self.env.context.get('active_model') + docs = self.env[self.model].browse(self.env.context.get('active_id')) + report_lines = self.get_account_lines(data.get('form')) + return { + 'doc_ids': self.ids, + 'doc_model': self.model, + 'data': data['form'], + 'docs': docs, + 'time': time, + 'get_account_lines': report_lines, + } \ No newline at end of file diff --git a/indoteknik_custom/models/account_report_general_ledger.py b/indoteknik_custom/models/account_report_general_ledger.py new file mode 100644 index 00000000..6457b914 --- /dev/null +++ b/indoteknik_custom/models/account_report_general_ledger.py @@ -0,0 +1,208 @@ +from datetime import datetime +from dateutil.relativedelta import relativedelta +from odoo.exceptions import UserError +import json +from datetime import timedelta, date +import datetime +import io +from odoo import api, fields, models, _ +from odoo.tools.float_utils import float_round +from odoo.tools import date_utils +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + +class AccountReportGeneralLedger(models.TransientModel): + _inherit = "account.report.general.ledger.xlsx" + + journal_ids = fields.Many2many('account.journal', string=_('Journals'), required=True,default=lambda self: self.env['account.journal'].search([('id', '=', 10)])) + + def _build_contexts(self, data): + result = {} + result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False + result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' + date_from = data['form']['date_from'] or False + + if date_from: + date_from = fields.Date.from_string(date_from) + + date_from -= relativedelta(days=1) + + result['date_from'] = fields.Date.to_string(date_from) + else: + result['date_from'] = False + + result['date_to'] = data['form']['date_to'] or False + result['strict_range'] = True if result['date_from'] else False + return result + + def check_report_ledger(self): + self.ensure_one() + data = {} + data['ids'] = self.env.context.get('active_ids', []) + data['model'] = self.env.context.get('active_model', 'ir.ui.menu') + data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move'])[0] + used_context = self._build_contexts(data) + data['form']['used_context'] = dict(used_context, lang=self.env.context.get('lang') or 'en_US') + return { + 'type': 'ir.actions.report', + 'data': {'model': 'account.report.general.ledger.xlsx', + 'options': json.dumps(data, default=date_utils.json_default), + 'output_format': 'xlsx', + 'report_name': 'general ledger report', + }, + 'report_type': 'xlsx' + } + + def get_xlsx_report(self, options, response): + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + data = {} + vals = self.search([('id', '=', options['form']['id'])]) + data['form'] = vals.read([])[0] + data['model'] = 'ir.ui.menu' + data['ids'] = [] + data['form']['used_context'] = { + 'date_to': options['form'].get('date_to', False), + 'date_from': options['form'].get('date_from', False), + 'strict_range': True, + 'state': options['form']['target_move'], + 'journal_ids': options['form']['journal_ids'], + } + + env_obj = vals.env['report.account.report_generalledger'] + sortby = data['form'].get('sortby', 'sort_date') + display_account = data['form']['display_account'] + codes = [] + if data['form'].get('journal_ids', False): + codes = [journal.code for journal in self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])] + # accounts = vals.active_account if vals.active_account else self.env['account.account'].search([]) + accounts = self.env['account.account'].browse(options['ids']) or self.env['account.account'].search([]) + init_balance = vals['initial_balance'] + date_from = options['form'].get('date_from', False) + date_to = options['form'].get('date_to', False) + report_obj = env_obj.with_context(data['form'].get('used_context', {}))._get_account_move_entry_posted_custom( + accounts, init_balance, sortby, display_account) + sheet = workbook.add_worksheet() + format1 = workbook.add_format({'font_size': 16, 'align': 'center', 'bg_color': '#D3D3D3', 'bold': True}) + format1.set_font_color('#000080') + format2 = workbook.add_format({'font_size': 12, 'bold': True, 'bg_color': '#D3D3D3'}) + format3 = workbook.add_format({'font_size': 10, 'bold': True}) + format4 = workbook.add_format({'font_size': 10}) + format6 = workbook.add_format({'font_size': 10, 'bold': True}) + format7 = workbook.add_format({'font_size': 10, 'align': 'center'}) + format5 = workbook.add_format({'font_size': 10, 'align': 'right'}) + format1.set_align('center') + format2.set_align('center') + format3.set_align('right') + format4.set_align('left') + codes = [] + if data['form'].get('journal_ids', False): + codes = [journal.code for journal in + self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])] + logged_users = self.env['res.company']._company_default_get('account.account') + report_date = datetime.datetime.now().strftime("%Y-%m-%d") + sheet.merge_range('M8:N8', _("Report Date"), format3) + sheet.merge_range('M9:N9', report_date, format4) + sheet.merge_range(1, 0, 1, 14, logged_users.name, format4) + sheet.merge_range(3, 0, 4, 14, _("General Ledger Report"), format1) + sheet.merge_range('A6:B6', _("Journals :"), format6) + + row = 6 + col = 0 + i = 0 + for values in codes: + sheet.write(row, col + i, values, format7) + i += 1 + if data['form']['display_account'] == 'all': + display_account = _('All accounts') + elif data['form']['display_account'] == 'movement': + display_account = _('With movements') + else: + display_account = _('With balance not equal to zero') + + if data['form']['target_move'] == 'all': + target_moves = _('All entries') + else: + target_moves = _('All posted entries') + + if data['form']['sortby'] == 'sort_date': + sortby = 'Date' + else: + sortby = 'Journal and partners' + if data['form']['date_from']: + date_start = datetime.datetime.strptime(str(data['form']['used_context']['date_from']), '%Y-%m-%d') + date_start = date_start.strftime('%Y-%m-%d') + else: + date_start = "" + if data['form']['date_to']: + date_end = datetime.datetime.strptime(str(data['form']['used_context']['date_to']), '%Y-%m-%d') + date_end = date_end.strftime('%Y-%m-%d') + else: + date_end = "" + if sortby == 'Date': + sheet.write('G8', _("Start Date"), format3) + sheet.write('G9', date_start, format4) + sheet.write('J8', _("End Date"), format3) + sheet.write('J9', date_end, format4) + sheet.merge_range('C8:D8', _("Sorted By"), format3) + sheet.merge_range('C9:D9', sortby, format4) + sheet.merge_range('A8:B8', _("Display Account"), format6) + sheet.merge_range('A9:B9', display_account, format7) + sheet.merge_range('E8:F8', _("Target Moves"), format6) + sheet.merge_range('E9:F9', target_moves, format7) + sheet.write('A11', "Date ", format2) + sheet.write('B11', "JRNL", format2) + sheet.merge_range('C11:D11', _("Partner"), format2) + sheet.merge_range('E11:F11', _("Ref"), format2) + sheet.merge_range('G11:H11', _("Move"), format2) + sheet.merge_range('I11:L11', _("Entry Label"), format2) + sheet.write('M11', _("Debit"), format2) + sheet.write('N11', _("Credit"), format2) + sheet.write('O11', _("Balance"), format2) + sheet.write('P11', _("Debit Sum"), format2) + accounts = self.env['account.account'].search([]) + row_number = 11 + col_number = 0 + for account in accounts: + for values in report_obj: + + if account['name'] == values['name'] and account['company_id'].id == values['company_id']: + sheet.write(row_number, col_number, account['code'], format3) + sheet.merge_range(row_number, col_number + 1, row_number, col_number + 11, account['name'], format6) + sheet.write(row_number, col_number + 12, + logged_users.currency_id.symbol + ' ' + "{:,.2f}".format(values['debit']), format3) + sheet.write(row_number, col_number + 13, + logged_users.currency_id.symbol + ' ' + "{:,.2f}".format(values['credit']), format3) + sheet.write(row_number, col_number + 14, + logged_users.currency_id.symbol + ' ' + "{:,.2f}".format(values['balance']), format3) + row_number += 1 + for lines in values['move_lines']: + if lines['ldate']: + formatted_date = datetime.datetime.strptime(str(lines['ldate']), '%Y-%m-%d') + formatted_date = formatted_date.strftime('%Y-%m-%d') + else: + formatted_date = "" + + sheet.write(row_number, col_number, formatted_date, format4) + sheet.write(row_number, col_number + 1, lines['lcode'], format4) + sheet.merge_range(row_number, col_number + 2, row_number, col_number + 3, lines['partner_name'], + format4) + sheet.merge_range(row_number, col_number + 4, row_number, col_number + 5, lines['lref'], + format4) + sheet.merge_range(row_number, col_number + 6, row_number, col_number + 7, lines['move_name'], + format4) + sheet.merge_range(row_number, col_number + 8, row_number, col_number + 11, lines['lname'], + format4) + sheet.write(row_number, col_number + 12, "{:,.2f}".format(lines['debit']), format5) + sheet.write(row_number, col_number + 13, "{:,.2f}".format(lines['credit']), format5) + sheet.write(row_number, col_number + 14, "{:,.2f}".format(lines['balance']), format5) + + row_number += 1 + + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() + diff --git a/indoteknik_custom/views/account_financial_report_view.xml b/indoteknik_custom/views/account_financial_report_view.xml new file mode 100644 index 00000000..31c04e7c --- /dev/null +++ b/indoteknik_custom/views/account_financial_report_view.xml @@ -0,0 +1,51 @@ + + + + + Common Report + accounting.report.xlsx + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Financial Reports + accounting.report.xlsx + ir.actions.act_window + form + + new + + + + +
diff --git a/indoteknik_custom/views/account_report_general_ledger_view.xml b/indoteknik_custom/views/account_report_general_ledger_view.xml new file mode 100644 index 00000000..b789874f --- /dev/null +++ b/indoteknik_custom/views/account_report_general_ledger_view.xml @@ -0,0 +1,37 @@ + + + + Export Ledger + account.report.general.ledger.xlsx + +
+ + + + + + + + + + + + +
+
+ +
+
+ + + export_ledger + account.report.general.ledger.xlsx + form + + new + + + +
\ No newline at end of file -- cgit v1.2.3 From 1d29465773b8672bfb38e16fb7b74a7cf5694bbf Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 3 Aug 2023 17:05:04 +0700 Subject: ledger --- indoteknik_custom/models/account_general_ledger.py | 58 +++++++++++++++++----- .../models/account_report_general_ledger.py | 2 +- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/indoteknik_custom/models/account_general_ledger.py b/indoteknik_custom/models/account_general_ledger.py index 6f73544c..4fccf0b0 100644 --- a/indoteknik_custom/models/account_general_ledger.py +++ b/indoteknik_custom/models/account_general_ledger.py @@ -1,12 +1,51 @@ +# -*- coding: utf-8 -*- +###################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# 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 class ReportGeneralLedger(models.AbstractModel): - _inherit = 'report.account.report_generalledger' - - def _get_account_move_entry_posted_custom(self, accounts, init_balance, sortby, display_account): + _name = 'report.account.report_generalledger' + + def _get_account_move_entry_custom(self, accounts, init_balance, sortby, display_account): + """ + :param: + accounts: the recordset of accounts + init_balance: boolean value of initial_balance + sortby: sorting by date or partner and journal + display_account: type of account(receivable, payable and both) + + Returns a dictionary of accounts with following key and value { + 'code': account code, + 'name': account name, + 'debit': sum of total debit amount, + 'credit': sum of total credit amount, + 'balance': total balance, + 'amount_currency': sum of amount_currency, + 'move_lines': list of move line + } + """ cr = self.env.cr MoveLine = self.env['account.move.line'] move_lines = {x: [] for x in accounts.ids} @@ -31,7 +70,6 @@ class ReportGeneralLedger(models.AbstractModel): LEFT JOIN account_move i ON (m.id =i.id)\ JOIN account_journal j ON (l.journal_id=j.id)\ WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id') - params = (tuple(accounts.ids),) + tuple(init_where_params) cr.execute(sql, params) for row in cr.dictfetchall(): @@ -73,7 +111,7 @@ class ReportGeneralLedger(models.AbstractModel): account_res = [] for account in accounts: currency = account.currency_id and account.currency_id or account.company_id.currency_id - res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance']) + res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance', 'balance_month']) res['code'] = account.code res['name'] = account.name res['company_id'] = account.company_id.id @@ -81,14 +119,13 @@ class ReportGeneralLedger(models.AbstractModel): for line in res.get('move_lines'): res['debit'] += line['debit'] res['credit'] += line['credit'] - res['balance'] = res['balance'] + res['balance'] = line['balance'] if display_account == 'all': account_res.append(res) if display_account == 'movement' and res.get('move_lines'): account_res.append(res) if display_account == 'not_zero' and not currency.is_zero(res['balance']): account_res.append(res) - return account_res @api.model @@ -107,12 +144,7 @@ class ReportGeneralLedger(models.AbstractModel): codes = [journal.code for journal in self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])] accounts = docs if model == 'account.account' else self.env['account.account'].search([]) - date_from = data['form'].get('date_from', False) - date_to = data['form'].get('date_to', False) - accounts_res = self.with_context(data['form'].get('used_context', {}))._get_account_move_entry_posted_custom(accounts, init_balance, sortby, display_account, date_from, date_to) - for account in accounts_res: - debit_sum = sum(line['debit'] for line in account['move_lines']) - + accounts_res = self.with_context(data['form'].get('used_context',{}))._get_account_move_entry_custom(accounts, init_balance, sortby, display_account) return { 'doc_ids': docids, 'doc_model': model, diff --git a/indoteknik_custom/models/account_report_general_ledger.py b/indoteknik_custom/models/account_report_general_ledger.py index 6457b914..11881f39 100644 --- a/indoteknik_custom/models/account_report_general_ledger.py +++ b/indoteknik_custom/models/account_report_general_ledger.py @@ -82,7 +82,7 @@ class AccountReportGeneralLedger(models.TransientModel): init_balance = vals['initial_balance'] date_from = options['form'].get('date_from', False) date_to = options['form'].get('date_to', False) - report_obj = env_obj.with_context(data['form'].get('used_context', {}))._get_account_move_entry_posted_custom( + report_obj = env_obj.with_context(data['form'].get('used_context', {}))._get_account_move_entry_custom( accounts, init_balance, sortby, display_account) sheet = workbook.add_worksheet() format1 = workbook.add_format({'font_size': 16, 'align': 'center', 'bg_color': '#D3D3D3', 'bold': True}) -- cgit v1.2.3 From bfa9610ff3d66bba150868a49c0e62fbb4bebeb9 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 4 Aug 2023 10:15:12 +0700 Subject: ledger --- .../models/account_report_general_ledger.py | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/account_report_general_ledger.py b/indoteknik_custom/models/account_report_general_ledger.py index 11881f39..4e909872 100644 --- a/indoteknik_custom/models/account_report_general_ledger.py +++ b/indoteknik_custom/models/account_report_general_ledger.py @@ -161,13 +161,14 @@ class AccountReportGeneralLedger(models.TransientModel): sheet.write('M11', _("Debit"), format2) sheet.write('N11', _("Credit"), format2) sheet.write('O11', _("Balance"), format2) - sheet.write('P11', _("Debit Sum"), format2) + sheet.write('P11', _("Debit Month"), format2) + sheet.write('Q11', _("Credit Month"), format2) + sheet.write('R11', _("Balance Month"), format2) accounts = self.env['account.account'].search([]) row_number = 11 col_number = 0 for account in accounts: for values in report_obj: - if account['name'] == values['name'] and account['company_id'].id == values['company_id']: sheet.write(row_number, col_number, account['code'], format3) sheet.merge_range(row_number, col_number + 1, row_number, col_number + 11, account['name'], format6) @@ -195,11 +196,29 @@ class AccountReportGeneralLedger(models.TransientModel): format4) sheet.merge_range(row_number, col_number + 8, row_number, col_number + 11, lines['lname'], format4) - sheet.write(row_number, col_number + 12, "{:,.2f}".format(lines['debit']), format5) + sheet.write(row_number, col_number + 12, "{:,}".format(lines['debit']), format5) sheet.write(row_number, col_number + 13, "{:,.2f}".format(lines['credit']), format5) sheet.write(row_number, col_number + 14, "{:,.2f}".format(lines['balance']), format5) + if lines['lname'] == 'Initial Balance': + debit_value = lines.get('debit', 0.0) + value_debit = values.get('debit', 0.0) + total_debit = value_debit - debit_value + debit_month = "{:,.2f}".format(total_debit) + + credit_value = lines.get('credit', 0.0) + value_credit = values.get('credit', 0.0) + total_credit = value_credit - credit_value + credit_month = "{:,.2f}".format(total_credit) + + total_balance = total_debit - total_credit + balance_month = "{:,.2f}".format(total_balance) + sheet.write(row_number, col_number + 15, debit_month, format5) + sheet.write(row_number, col_number + 16, credit_month, format5) + sheet.write(row_number, col_number + 17, balance_month, format5) + row_number += 1 + workbook.close() output.seek(0) -- cgit v1.2.3 From 544ccd0952c03f9021478f64bdb31a06e923a13d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 7 Aug 2023 10:12:03 +0700 Subject: ledger --- indoteknik_custom/models/account_general_ledger.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/indoteknik_custom/models/account_general_ledger.py b/indoteknik_custom/models/account_general_ledger.py index 4fccf0b0..50d52374 100644 --- a/indoteknik_custom/models/account_general_ledger.py +++ b/indoteknik_custom/models/account_general_ledger.py @@ -1,25 +1,3 @@ -# -*- coding: utf-8 -*- -###################################################################################### -# -# Cybrosys Technologies Pvt. Ltd. -# -# Copyright (C) 2020-TODAY Cybrosys Technologies(). -# 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 -- cgit v1.2.3 From 4d665c47060f4d3506d7dffe7f18a2d481fe5497 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 8 Aug 2023 09:01:32 +0700 Subject: airway bill --- indoteknik_api/controllers/api_v1/sale_order.py | 14 +++++++++++++- indoteknik_custom/models/airway_bill_manifest.py | 11 +++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py index 1ad1ff51..ecc6c771 100644 --- a/indoteknik_api/controllers/api_v1/sale_order.py +++ b/indoteknik_api/controllers/api_v1/sale_order.py @@ -1,5 +1,6 @@ from .. import controller from odoo import http +from datetime import datetime, timedelta from odoo.http import request import json @@ -389,6 +390,17 @@ class SaleOrder(controller.Controller): data = airway_bill.decode_response() delivery_order = airway_bill.do_id result = data['rajaongkir']['result'] + + manifests_data = [] + for manifest in airway_bill.manifest_ids: + manifest_data = { + 'code': manifest.code, + 'description': manifest.description, + 'datetime': datetime.strftime(manifest.datetime, '%Y-%m-%d %H:%M:%S'), + 'city': manifest.city, + } + manifests_data.append(manifest_data) + airways.append({ 'delivery_order': { 'name': delivery_order.name, @@ -399,7 +411,7 @@ class SaleOrder(controller.Controller): 'delivered': result['delivered'], 'waybill_number': result['summary']['waybill_number'], 'delivery_status': result['delivery_status'], - 'manifests': result['manifest'] + 'manifests': manifests_data }) response = {'airways': airways} diff --git a/indoteknik_custom/models/airway_bill_manifest.py b/indoteknik_custom/models/airway_bill_manifest.py index a606c2be..2da60f27 100644 --- a/indoteknik_custom/models/airway_bill_manifest.py +++ b/indoteknik_custom/models/airway_bill_manifest.py @@ -5,7 +5,7 @@ _logger = logging.getLogger(__name__) class AirwayBillManifest(models.Model): _name = 'airway.bill.manifest' - _description = 'Airway B ill Line' + _description = 'Airway Bill Line' _order = 'waybill_id, id' waybill_id = fields.Many2one('airway.bill', string='Airway Ref', required=True, ondelete='cascade', index=True, copy=False) @@ -19,7 +19,10 @@ class AirwayBillManifest(models.Model): try: history = waybill.decode_response() manifests = history['rajaongkir']['result']['manifest'] or [] - for manifest in manifests: + + sorted_manifests = sorted(manifests, key=lambda x: x['manifest_date'] + ' ' + x['manifest_time'], reverse=True) + + for manifest in sorted_manifests: code = manifest['manifest_code'] description = manifest['manifest_description'] date = manifest['manifest_date'] @@ -29,8 +32,8 @@ class AirwayBillManifest(models.Model): 'waybill_id': waybill.id, 'code': code, 'description': description, - 'datetime': date+' '+time, + 'datetime': date + ' ' + time, 'city': city, }) except: - return \ No newline at end of file + return -- cgit v1.2.3 From a39466421a31d2ffd5f2252bf7aac903c4785d83 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 8 Aug 2023 09:47:05 +0700 Subject: add field price vendor --- indoteknik_custom/models/purchase_order_line.py | 12 ++++++++++++ indoteknik_custom/views/purchase_order.xml | 3 +++ 2 files changed, 15 insertions(+) diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index f255095f..1b5bba3a 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -28,6 +28,18 @@ 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.partner_id.id) + ], limit=1) + + price_vendor = purchase_pricelist.product_price + line.price_vendor = price_vendor def compute_qty_stock(self): for line in self: 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 @@ + + + -- cgit v1.2.3 From 30eb623bace6b5ba9a1e275c7bdf70fc5920a583 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 8 Aug 2023 15:29:29 +0700 Subject: sync price unit po & price purchase pricelist --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/purchase_order.py | 9 +++ indoteknik_custom/models/purchase_order_line.py | 6 +- indoteknik_custom/views/mail_template_po.xml | 84 +++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 indoteknik_custom/views/mail_template_po.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index b7aadbdf..252d92b4 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -87,6 +87,7 @@ '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/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 7091bb72..38e617e7 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -206,8 +206,17 @@ 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): + for line in self.order_line: + if line.price_unit != line.price_vendor: + self._send_mail() + if self.env.user.is_leader or self.env.user.is_purchasing_manager: raise UserError("Bisa langsung Confirm") elif self.total_percent_margin == self.total_so_percent_margin and self.sale_order_id: diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 1b5bba3a..450d3430 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -30,15 +30,15 @@ class PurchaseOrderLine(models.Model): 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.partner_id.id) + ('vendor_id', '=', line.order_id.partner_id.id) ], limit=1) - price_vendor = purchase_pricelist.product_price + price_vendor = format(purchase_pricelist.product_price, ".2f") + price_vendor = float(price_vendor) line.price_vendor = price_vendor def compute_qty_stock(self): diff --git a/indoteknik_custom/views/mail_template_po.xml b/indoteknik_custom/views/mail_template_po.xml new file mode 100644 index 00000000..8eb72e12 --- /dev/null +++ b/indoteknik_custom/views/mail_template_po.xml @@ -0,0 +1,84 @@ + + + + + PO: Sync Unit Price Purchase Pricelist + + Your PO ${object.name} + + azkan4elll@gmail.com + + + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ PO
+ + ${object.name} + +
+
+
+
+ + + + + + + +
+
+ Dear Stefanus Darren, +

+ Terdapat PO yang harga Unit Price nya tidak sama dengan yang ada di purchase pricelist nya. +

+ Berikut adalah rincian PO: + % for line in object.order_line: +
    +
  • Nama Produk: ${line.product_id.name}
  • +
  • Harga Unit dalam PO: ${line.price_unit}
  • +
  • Harga Unit dalam Purchase Pricelist: ${line.price_vendor}
  • +
+ % endfor + Silahkan periksa dan lakukan koreksi jika diperlukan. +

+ Terima kasih. +
+
+
+
+
+
+
+ +
+
+
\ No newline at end of file -- cgit v1.2.3 From 3ef9d136bd238464de7ff0a224b1a68a9b7bb1f3 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 9 Aug 2023 10:32:32 +0700 Subject: add new condition email po --- indoteknik_custom/models/purchase_order.py | 14 +++++++++----- indoteknik_custom/models/purchase_order_line.py | 9 ++++++--- indoteknik_custom/views/mail_template_po.xml | 16 +++++++++------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 38e617e7..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' @@ -213,10 +221,6 @@ class PurchaseOrder(models.Model): template.send_mail(self.id, force_send=True) def po_approve(self): - for line in self.order_line: - if line.price_unit != line.price_vendor: - self._send_mail() - if self.env.user.is_leader or self.env.user.is_purchasing_manager: raise UserError("Bisa langsung Confirm") elif self.total_percent_margin == self.total_so_percent_margin and self.sale_order_id: diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 450d3430..39aeba0f 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -37,9 +37,12 @@ class PurchaseOrderLine(models.Model): ('vendor_id', '=', line.order_id.partner_id.id) ], limit=1) - price_vendor = format(purchase_pricelist.product_price, ".2f") - price_vendor = float(price_vendor) - line.price_vendor = price_vendor + 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/mail_template_po.xml b/indoteknik_custom/views/mail_template_po.xml index 8eb72e12..77c21837 100644 --- a/indoteknik_custom/views/mail_template_po.xml +++ b/indoteknik_custom/views/mail_template_po.xml @@ -6,11 +6,11 @@ Your PO ${object.name} - azkan4elll@gmail.com + darren@indoteknik.co.id - +
@@ -51,11 +51,13 @@

Berikut adalah rincian PO: % for line in object.order_line: -
    -
  • Nama Produk: ${line.product_id.name}
  • -
  • Harga Unit dalam PO: ${line.price_unit}
  • -
  • Harga Unit dalam Purchase Pricelist: ${line.price_vendor}
  • -
+ % if line.price_vendor != 0 and line.price_unit != line.price_vendor +
    +
  • Nama Produk: ${line.product_id.name}
  • +
  • Harga Unit dalam PO: ${line.price_unit}
  • +
  • Harga Unit dalam Purchase Pricelist: ${line.price_vendor}
  • +
+ % endif % endfor Silahkan periksa dan lakukan koreksi jika diperlukan.

-- cgit v1.2.3 From 4aa5108543075227378b856ce31f478bd5a3b3db Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 9 Aug 2023 11:09:23 +0700 Subject: ledger --- indoteknik_custom/__manifest__.py | 2 - indoteknik_custom/models/__init__.py | 4 - .../models/account_financial_report.py | 39 ---- indoteknik_custom/models/account_general_ledger.py | 134 ------------ .../models/account_report_general_ledger.py | 227 --------------------- .../views/account_financial_report_view.xml | 51 ----- .../views/account_report_general_ledger_view.xml | 37 ---- 7 files changed, 494 deletions(-) delete mode 100644 indoteknik_custom/models/account_financial_report.py delete mode 100644 indoteknik_custom/models/account_general_ledger.py delete mode 100644 indoteknik_custom/models/account_report_general_ledger.py delete mode 100644 indoteknik_custom/views/account_financial_report_view.xml delete mode 100644 indoteknik_custom/views/account_report_general_ledger_view.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 2cd7ad6e..b7aadbdf 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -84,8 +84,6 @@ 'views/product_sla.xml', 'views/voucher.xml', 'views/bill_receipt.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', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index f26cbec2..1bdbc513 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -75,7 +75,3 @@ from . import account_move_due_extension from . import voucher from . import bill_receipt 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 diff --git a/indoteknik_custom/models/account_financial_report.py b/indoteknik_custom/models/account_financial_report.py deleted file mode 100644 index 114449ce..00000000 --- a/indoteknik_custom/models/account_financial_report.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -###################################################################################### -# -# Cybrosys Technologies Pvt. Ltd. -# -# Copyright (C) 2019-TODAY Cybrosys Technologies(). -# 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 -import io -from odoo import api, fields, models, _ -from odoo.tools import date_utils -try: - from odoo.tools.misc import xlsxwriter -except ImportError: - import xlsxwriter - - -class AccountingReport(models.TransientModel): - _inherit = "accounting.report.xlsx" - - - \ No newline at end of file diff --git a/indoteknik_custom/models/account_general_ledger.py b/indoteknik_custom/models/account_general_ledger.py deleted file mode 100644 index 50d52374..00000000 --- a/indoteknik_custom/models/account_general_ledger.py +++ /dev/null @@ -1,134 +0,0 @@ -import time -from odoo import api, models, _ -from odoo.exceptions import UserError - - -class ReportGeneralLedger(models.AbstractModel): - _name = 'report.account.report_generalledger' - - def _get_account_move_entry_custom(self, accounts, init_balance, sortby, display_account): - """ - :param: - accounts: the recordset of accounts - init_balance: boolean value of initial_balance - sortby: sorting by date or partner and journal - display_account: type of account(receivable, payable and both) - - Returns a dictionary of accounts with following key and value { - 'code': account code, - 'name': account name, - 'debit': sum of total debit amount, - 'credit': sum of total credit amount, - 'balance': total balance, - 'amount_currency': sum of amount_currency, - 'move_lines': list of move line - } - """ - cr = self.env.cr - MoveLine = self.env['account.move.line'] - move_lines = {x: [] for x in accounts.ids} - - # Prepare initial sql query and Get the initial move lines - if init_balance: - init_tables, init_where_clause, init_where_params = MoveLine.with_context(date_from=self.env.context.get('date_from'), date_to=False, initial_bal=True)._query_get() - init_wheres = [""] - if init_where_clause.strip(): - init_wheres.append(init_where_clause.strip()) - init_filters = " AND ".join(init_wheres) - filters = init_filters.replace('account_move_line__move_id', 'm').replace('account_move_line', 'l') - sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\ - '' AS move_name, '' AS mmove_id, '' AS currency_code,\ - NULL AS currency_id,\ - '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\ - '' AS partner_name\ - FROM account_move_line l\ - LEFT JOIN account_move m ON (l.move_id=m.id)\ - LEFT JOIN res_currency c ON (l.currency_id=c.id)\ - LEFT JOIN res_partner p ON (l.partner_id=p.id)\ - LEFT JOIN account_move i ON (m.id =i.id)\ - JOIN account_journal j ON (l.journal_id=j.id)\ - WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id') - params = (tuple(accounts.ids),) + tuple(init_where_params) - cr.execute(sql, params) - for row in cr.dictfetchall(): - move_lines[row.pop('account_id')].append(row) - - sql_sort = 'l.date, l.move_id' - if sortby == 'sort_journal_partner': - sql_sort = 'j.code, p.name, l.move_id' - - # Prepare sql query base on selected parameters from wizard - tables, where_clause, where_params = MoveLine._query_get() - wheres = [""] - if where_clause.strip(): - wheres.append(where_clause.strip()) - filters = " AND ".join(wheres) - filters = filters.replace('account_move_line__move_id', 'm').replace('account_move_line', 'l') - - # Get move lines base on sql query and Calculate the total balance of move lines - sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\ - m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\ - FROM account_move_line l\ - JOIN account_move m ON (l.move_id=m.id)\ - LEFT JOIN res_currency c ON (l.currency_id=c.id)\ - LEFT JOIN res_partner p ON (l.partner_id=p.id)\ - JOIN account_journal j ON (l.journal_id=j.id)\ - JOIN account_account acc ON (l.account_id = acc.id) \ - WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort) - params = (tuple(accounts.ids),) + tuple(where_params) - cr.execute(sql, params) - - for row in cr.dictfetchall(): - balance = 0 - for line in move_lines.get(row['account_id']): - balance += line['debit'] - line['credit'] - row['balance'] += balance - move_lines[row.pop('account_id')].append(row) - - # Calculate the debit, credit and balance for Accounts - account_res = [] - for account in accounts: - currency = account.currency_id and account.currency_id or account.company_id.currency_id - res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance', 'balance_month']) - res['code'] = account.code - res['name'] = account.name - res['company_id'] = account.company_id.id - res['move_lines'] = move_lines[account.id] - for line in res.get('move_lines'): - res['debit'] += line['debit'] - res['credit'] += line['credit'] - res['balance'] = line['balance'] - if display_account == 'all': - account_res.append(res) - if display_account == 'movement' and res.get('move_lines'): - account_res.append(res) - if display_account == 'not_zero' and not currency.is_zero(res['balance']): - account_res.append(res) - return account_res - - @api.model - def _get_report_values(self, docids, data=None): - if not data.get('form') or not self.env.context.get('active_model'): - raise UserError(_("Form content is missing, this report cannot be printed.")) - - model = self.env.context.get('active_model') - docs = self.env[model].browse(self.env.context.get('active_ids', [])) - - init_balance = data['form'].get('initial_balance', True) - sortby = data['form'].get('sortby', 'sort_date') - display_account = data['form']['display_account'] - codes = [] - if data['form'].get('journal_ids', False): - codes = [journal.code for journal in self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])] - - accounts = docs if model == 'account.account' else self.env['account.account'].search([]) - accounts_res = self.with_context(data['form'].get('used_context',{}))._get_account_move_entry_custom(accounts, init_balance, sortby, display_account) - return { - 'doc_ids': docids, - 'doc_model': model, - 'data': data['form'], - 'docs': docs, - 'time': time, - 'Accounts': accounts_res, - 'print_journal': codes, - } diff --git a/indoteknik_custom/models/account_report_general_ledger.py b/indoteknik_custom/models/account_report_general_ledger.py deleted file mode 100644 index 4e909872..00000000 --- a/indoteknik_custom/models/account_report_general_ledger.py +++ /dev/null @@ -1,227 +0,0 @@ -from datetime import datetime -from dateutil.relativedelta import relativedelta -from odoo.exceptions import UserError -import json -from datetime import timedelta, date -import datetime -import io -from odoo import api, fields, models, _ -from odoo.tools.float_utils import float_round -from odoo.tools import date_utils -try: - from odoo.tools.misc import xlsxwriter -except ImportError: - import xlsxwriter - -class AccountReportGeneralLedger(models.TransientModel): - _inherit = "account.report.general.ledger.xlsx" - - journal_ids = fields.Many2many('account.journal', string=_('Journals'), required=True,default=lambda self: self.env['account.journal'].search([('id', '=', 10)])) - - def _build_contexts(self, data): - result = {} - result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False - result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' - date_from = data['form']['date_from'] or False - - if date_from: - date_from = fields.Date.from_string(date_from) - - date_from -= relativedelta(days=1) - - result['date_from'] = fields.Date.to_string(date_from) - else: - result['date_from'] = False - - result['date_to'] = data['form']['date_to'] or False - result['strict_range'] = True if result['date_from'] else False - return result - - def check_report_ledger(self): - self.ensure_one() - data = {} - data['ids'] = self.env.context.get('active_ids', []) - data['model'] = self.env.context.get('active_model', 'ir.ui.menu') - data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move'])[0] - used_context = self._build_contexts(data) - data['form']['used_context'] = dict(used_context, lang=self.env.context.get('lang') or 'en_US') - return { - 'type': 'ir.actions.report', - 'data': {'model': 'account.report.general.ledger.xlsx', - 'options': json.dumps(data, default=date_utils.json_default), - 'output_format': 'xlsx', - 'report_name': 'general ledger report', - }, - 'report_type': 'xlsx' - } - - def get_xlsx_report(self, options, response): - output = io.BytesIO() - workbook = xlsxwriter.Workbook(output, {'in_memory': True}) - data = {} - vals = self.search([('id', '=', options['form']['id'])]) - data['form'] = vals.read([])[0] - data['model'] = 'ir.ui.menu' - data['ids'] = [] - data['form']['used_context'] = { - 'date_to': options['form'].get('date_to', False), - 'date_from': options['form'].get('date_from', False), - 'strict_range': True, - 'state': options['form']['target_move'], - 'journal_ids': options['form']['journal_ids'], - } - - env_obj = vals.env['report.account.report_generalledger'] - sortby = data['form'].get('sortby', 'sort_date') - display_account = data['form']['display_account'] - codes = [] - if data['form'].get('journal_ids', False): - codes = [journal.code for journal in self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])] - # accounts = vals.active_account if vals.active_account else self.env['account.account'].search([]) - accounts = self.env['account.account'].browse(options['ids']) or self.env['account.account'].search([]) - init_balance = vals['initial_balance'] - date_from = options['form'].get('date_from', False) - date_to = options['form'].get('date_to', False) - report_obj = env_obj.with_context(data['form'].get('used_context', {}))._get_account_move_entry_custom( - accounts, init_balance, sortby, display_account) - sheet = workbook.add_worksheet() - format1 = workbook.add_format({'font_size': 16, 'align': 'center', 'bg_color': '#D3D3D3', 'bold': True}) - format1.set_font_color('#000080') - format2 = workbook.add_format({'font_size': 12, 'bold': True, 'bg_color': '#D3D3D3'}) - format3 = workbook.add_format({'font_size': 10, 'bold': True}) - format4 = workbook.add_format({'font_size': 10}) - format6 = workbook.add_format({'font_size': 10, 'bold': True}) - format7 = workbook.add_format({'font_size': 10, 'align': 'center'}) - format5 = workbook.add_format({'font_size': 10, 'align': 'right'}) - format1.set_align('center') - format2.set_align('center') - format3.set_align('right') - format4.set_align('left') - codes = [] - if data['form'].get('journal_ids', False): - codes = [journal.code for journal in - self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])] - logged_users = self.env['res.company']._company_default_get('account.account') - report_date = datetime.datetime.now().strftime("%Y-%m-%d") - sheet.merge_range('M8:N8', _("Report Date"), format3) - sheet.merge_range('M9:N9', report_date, format4) - sheet.merge_range(1, 0, 1, 14, logged_users.name, format4) - sheet.merge_range(3, 0, 4, 14, _("General Ledger Report"), format1) - sheet.merge_range('A6:B6', _("Journals :"), format6) - - row = 6 - col = 0 - i = 0 - for values in codes: - sheet.write(row, col + i, values, format7) - i += 1 - if data['form']['display_account'] == 'all': - display_account = _('All accounts') - elif data['form']['display_account'] == 'movement': - display_account = _('With movements') - else: - display_account = _('With balance not equal to zero') - - if data['form']['target_move'] == 'all': - target_moves = _('All entries') - else: - target_moves = _('All posted entries') - - if data['form']['sortby'] == 'sort_date': - sortby = 'Date' - else: - sortby = 'Journal and partners' - if data['form']['date_from']: - date_start = datetime.datetime.strptime(str(data['form']['used_context']['date_from']), '%Y-%m-%d') - date_start = date_start.strftime('%Y-%m-%d') - else: - date_start = "" - if data['form']['date_to']: - date_end = datetime.datetime.strptime(str(data['form']['used_context']['date_to']), '%Y-%m-%d') - date_end = date_end.strftime('%Y-%m-%d') - else: - date_end = "" - if sortby == 'Date': - sheet.write('G8', _("Start Date"), format3) - sheet.write('G9', date_start, format4) - sheet.write('J8', _("End Date"), format3) - sheet.write('J9', date_end, format4) - sheet.merge_range('C8:D8', _("Sorted By"), format3) - sheet.merge_range('C9:D9', sortby, format4) - sheet.merge_range('A8:B8', _("Display Account"), format6) - sheet.merge_range('A9:B9', display_account, format7) - sheet.merge_range('E8:F8', _("Target Moves"), format6) - sheet.merge_range('E9:F9', target_moves, format7) - sheet.write('A11', "Date ", format2) - sheet.write('B11', "JRNL", format2) - sheet.merge_range('C11:D11', _("Partner"), format2) - sheet.merge_range('E11:F11', _("Ref"), format2) - sheet.merge_range('G11:H11', _("Move"), format2) - sheet.merge_range('I11:L11', _("Entry Label"), format2) - sheet.write('M11', _("Debit"), format2) - sheet.write('N11', _("Credit"), format2) - sheet.write('O11', _("Balance"), format2) - sheet.write('P11', _("Debit Month"), format2) - sheet.write('Q11', _("Credit Month"), format2) - sheet.write('R11', _("Balance Month"), format2) - accounts = self.env['account.account'].search([]) - row_number = 11 - col_number = 0 - for account in accounts: - for values in report_obj: - if account['name'] == values['name'] and account['company_id'].id == values['company_id']: - sheet.write(row_number, col_number, account['code'], format3) - sheet.merge_range(row_number, col_number + 1, row_number, col_number + 11, account['name'], format6) - sheet.write(row_number, col_number + 12, - logged_users.currency_id.symbol + ' ' + "{:,.2f}".format(values['debit']), format3) - sheet.write(row_number, col_number + 13, - logged_users.currency_id.symbol + ' ' + "{:,.2f}".format(values['credit']), format3) - sheet.write(row_number, col_number + 14, - logged_users.currency_id.symbol + ' ' + "{:,.2f}".format(values['balance']), format3) - row_number += 1 - for lines in values['move_lines']: - if lines['ldate']: - formatted_date = datetime.datetime.strptime(str(lines['ldate']), '%Y-%m-%d') - formatted_date = formatted_date.strftime('%Y-%m-%d') - else: - formatted_date = "" - - sheet.write(row_number, col_number, formatted_date, format4) - sheet.write(row_number, col_number + 1, lines['lcode'], format4) - sheet.merge_range(row_number, col_number + 2, row_number, col_number + 3, lines['partner_name'], - format4) - sheet.merge_range(row_number, col_number + 4, row_number, col_number + 5, lines['lref'], - format4) - sheet.merge_range(row_number, col_number + 6, row_number, col_number + 7, lines['move_name'], - format4) - sheet.merge_range(row_number, col_number + 8, row_number, col_number + 11, lines['lname'], - format4) - sheet.write(row_number, col_number + 12, "{:,}".format(lines['debit']), format5) - sheet.write(row_number, col_number + 13, "{:,.2f}".format(lines['credit']), format5) - sheet.write(row_number, col_number + 14, "{:,.2f}".format(lines['balance']), format5) - - if lines['lname'] == 'Initial Balance': - debit_value = lines.get('debit', 0.0) - value_debit = values.get('debit', 0.0) - total_debit = value_debit - debit_value - debit_month = "{:,.2f}".format(total_debit) - - credit_value = lines.get('credit', 0.0) - value_credit = values.get('credit', 0.0) - total_credit = value_credit - credit_value - credit_month = "{:,.2f}".format(total_credit) - - total_balance = total_debit - total_credit - balance_month = "{:,.2f}".format(total_balance) - sheet.write(row_number, col_number + 15, debit_month, format5) - sheet.write(row_number, col_number + 16, credit_month, format5) - sheet.write(row_number, col_number + 17, balance_month, format5) - - row_number += 1 - - - workbook.close() - output.seek(0) - response.stream.write(output.read()) - output.close() - diff --git a/indoteknik_custom/views/account_financial_report_view.xml b/indoteknik_custom/views/account_financial_report_view.xml deleted file mode 100644 index 31c04e7c..00000000 --- a/indoteknik_custom/views/account_financial_report_view.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Common Report - accounting.report.xlsx - -
- - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
- - - Financial Reports - accounting.report.xlsx - ir.actions.act_window - form - - new - - - - -
diff --git a/indoteknik_custom/views/account_report_general_ledger_view.xml b/indoteknik_custom/views/account_report_general_ledger_view.xml deleted file mode 100644 index b789874f..00000000 --- a/indoteknik_custom/views/account_report_general_ledger_view.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - Export Ledger - account.report.general.ledger.xlsx - -
- - - - - - - - - - - - -
-
- -
-
- - - export_ledger - account.report.general.ledger.xlsx - form - - new - - - -
\ No newline at end of file -- cgit v1.2.3 From eababb6272797427353ccc5a58609ceac6ceea1c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 9 Aug 2023 15:05:55 +0700 Subject: ledger --- indoteknik_custom/__manifest__.py | 2 +- indoteknik_custom/models/__init__.py | 2 +- .../models/account_financial_report.py | 22 ---------------------- indoteknik_custom/models/account_general_ledger.py | 1 - .../models/account_report_financial.py | 22 ---------------------- .../models/account_report_general_ledger.py | 1 - .../views/account_financial_report_view.xml | 2 +- .../views/account_report_general_ledger_view.xml | 2 +- 8 files changed, 4 insertions(+), 50 deletions(-) diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 362b2b2b..7c669810 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -84,7 +84,7 @@ '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', 'report/report.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 45c30473..8c7071e3 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -76,4 +76,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(). -# 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(). -# 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/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 @@ - + Common Report accounting.report.xlsx 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 @@ - + Export Ledger account.report.general.ledger.xlsx -- cgit v1.2.3 From dcc5ed9671b9809a4a41cd6b7b864f1294f9fd8a Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 9 Aug 2023 15:45:23 +0700 Subject: Fix update rajaongkir record xml --- indoteknik_custom/views/raja_ongkir.xml | 242 ++++++++++++++++---------------- 1 file changed, 122 insertions(+), 120 deletions(-) diff --git a/indoteknik_custom/views/raja_ongkir.xml b/indoteknik_custom/views/raja_ongkir.xml index 9e24a889..8888366b 100644 --- a/indoteknik_custom/views/raja_ongkir.xml +++ b/indoteknik_custom/views/raja_ongkir.xml @@ -68,125 +68,127 @@ action="rajaongkir_kurir_action" /> - - jne - 51 - True - - - pos - 53 - True - - - tiki - 54 - True - - - rpx - 55 - True - - - pandu - 56 - True - - - wahana - 7 - True - - - sicepat - 27 - True - - - jnt - 57 - True - - - pahala - 58 - True - - - sap - 59 - True - - - jet - 60 - True - - - indah - 61 - True - - - dse - 62 - True - - - slis - 63 - True - - - first - 64 - True - - - ncs - 65 - True - - - star - 66 - True - - - lion - 67 - True - - - idl - 68 - True - - - rex - 69 - True - - - ide - 70 - True - - - sentral - 71 - True - - - anteraja - 72 - True - - - jtl - 73 - True - + + + jne + 51 + True + + + pos + 53 + True + + + tiki + 54 + True + + + rpx + 55 + True + + + pandu + 56 + True + + + wahana + 7 + True + + + sicepat + 27 + True + + + jnt + 57 + True + + + pahala + 58 + True + + + sap + 59 + True + + + jet + 60 + True + + + indah + 61 + True + + + dse + 62 + True + + + slis + 63 + True + + + first + 64 + True + + + ncs + 65 + True + + + star + 66 + True + + + lion + 67 + True + + + idl + 68 + True + + + rex + 69 + True + + + ide + 70 + True + + + sentral + 71 + True + + + anteraja + 72 + True + + + jtl + 73 + True + + \ No newline at end of file -- cgit v1.2.3 From 81c87b71d6cb7caad7230b9cca8545155d917214 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 10 Aug 2023 11:01:05 +0700 Subject: fix format price email template --- indoteknik_custom/views/mail_template_po.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/views/mail_template_po.xml b/indoteknik_custom/views/mail_template_po.xml index 77c21837..410520b3 100644 --- a/indoteknik_custom/views/mail_template_po.xml +++ b/indoteknik_custom/views/mail_template_po.xml @@ -54,10 +54,10 @@ % if line.price_vendor != 0 and line.price_unit != line.price_vendor
  • Nama Produk: ${line.product_id.name}
  • -
  • Harga Unit dalam PO: ${line.price_unit}
  • -
  • Harga Unit dalam Purchase Pricelist: ${line.price_vendor}
  • +
  • Harga Unit dalam PO: Rp ${'{:,.2f}'.format(line.price_unit)}
  • +
  • Harga Unit dalam Purchase Pricelist: Rp ${'{:,.2f}'.format(line.price_vendor)}
- % endif + % endif % endfor Silahkan periksa dan lakukan koreksi jika diperlukan.

-- cgit v1.2.3