Skip to content

Commit

Permalink
Merge pull request #33 from milleniumkid/16.0-mig-altinkaya_excel_export
Browse files Browse the repository at this point in the history
[MIG] altinkaya_excel_export
  • Loading branch information
yibudak authored Jan 17, 2025
2 parents d3a3a5a + b9b99d5 commit 427efd8
Show file tree
Hide file tree
Showing 45 changed files with 1,258 additions and 0 deletions.
7 changes: 7 additions & 0 deletions altinkaya_excel_export/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from . import export_purchase_order_xlsx
from . import export_account_move_xlsx
from . import export_partner_currency_statement
from . import export_partner_statement
from . import export_account_payment_xlsx
from . import export_account_move_line_xlsx
from . import export_account_move_kviks_xlsx
44 changes: 44 additions & 0 deletions altinkaya_excel_export/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2025 Ismail Cagan Yilmaz (https://github.com/milleniumkid)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Altinkaya Excel Reports",
"summary": """
Various Excel reports""",
"author": "Yavuz Avcı,Yiğit Budak, Altinkaya Enclosures",
"website": "https://github.com/altinkaya-opensource/odoo-addons",
"license": "LGPL-3",
"category": "Uncategorized",
"version": "16.0.1.0.0",
"depends": ["excel_import_export", "purchase", "account"],
"data": [
# Purchase
"export_purchase_order_xlsx/reports.xml",
"export_purchase_order_xlsx/temp_po_en.xml",
"export_purchase_order_xlsx/temp_po_tr.xml",
"export_purchase_order_xlsx/temp_rfq_en.xml",
"export_purchase_order_xlsx/temp_rfq_tr.xml",
# Account
"export_account_move_xlsx/temp_zirve_masraf_fatura.xml",
"export_account_move_xlsx/temp_gelir_fatura.xml",
"export_account_move_xlsx/reports.xml",
# Partner Statement
"export_partner_statement/temp_partner_statement.xml",
"export_partner_statement/reports.xml",
# Partner Statement Currency
"export_partner_currency_statement/temp_partner_statement_currency.xml",
"export_partner_currency_statement/reports.xml",
# Payment Excel
"export_account_payment_xlsx/reports.xml",
"export_account_payment_xlsx/temp_payments.xml",
# Move Line Excel
"export_account_move_line_xlsx/reports.xml",
"export_account_move_line_xlsx/temp_move_lines.xml",
# Kviks Excel
"export_account_move_kviks_xlsx/reports.xml",
"export_account_move_kviks_xlsx/temp_kviks.xml",
# Access Rights
"security/ir.model.access.csv",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move_kviks_export
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

# Copyright 2025 Ismail Cagan Yilmaz (https://github.com/milleniumkid)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class ReportAccountInvoiceKVIKS(models.TransientModel):
_name = "report.account.move.kviks"
_description = "Wizard for report.account.move.kviks"
_inherit = "xlsx.report"

# Report Result, account.move
results = fields.Many2many(
comodel_name="account.move",
string="Invoices",
compute="_compute_invoices",
help="Use compute fields, so there is nothing stored in database",
)

def _compute_invoices(self):
selected_ids = self.env.context.get("active_ids", [])
ids = self.env["account.move"].browse(selected_ids)
for rec in self:
rec.results = ids
Binary file not shown.
30 changes: 30 additions & 0 deletions altinkaya_excel_export/export_account_move_kviks_xlsx/reports.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="report_account_move_kviks" model="ir.ui.view">
<field name="name">report.account.move.kviks</field>
<field name="model">report.account.move.kviks</field>
<field name="inherit_id" ref="excel_import_export.xlsx_report_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='criteria']" position="after">
KVIKS sistemine uygun şekilde çıktı almak için aşağıdaki
butonları kullanınız.
<field name="results" invisible="1" />
</xpath>
</field>
</record>

<record id="action_account_move_kviks_excel_export" model="ir.actions.act_window">
<field name="name">KVIKS Sevkiyat bildirimi</field>
<field name="res_model">report.account.move.kviks</field>
<field name="binding_model_id" ref="account.model_account_move" />
<field name="binding_view_types">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field
name="context"
>{'template_domain': [('res_model', '=', 'report.account.move.kviks'), ('fname', '=', 'kviks.xlsx'), ('gname', '=', False)]}</field>
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="account_move_kviks" model="xlsx.template">
<field name="res_model">report.account.move.kviks</field>
<field name="fname">kviks.xlsx</field>
<field name="name">KVIKS Sevkiyat Bildirimi</field>
<field
name="description"
>KVIKS sistemine uygun biçimde faturaların içeri aktarılabilmesini sağlayan Excel şablonu.</field>
<field name="input_instruction">
{
'__EXPORT__': {
'Bilgilendirme Formu': { # sheet can be name (string) or index (integer)
'results': { # prefix with _CONT_ to continue rows from previous row field
'A2': 'number${value or ""}#{border=thin_border;align=left;style=text}',
'B2': 'gtb_declaration_no${value or ""}#{border=thin_border;align=left;style=text}',
'C2': '${object.gtb_intac_date and object.gtb_intac_date.strftime("%d.%m.%Y") or ""}#{border=thin_border;align=left;style=date}',
'D2': '${object.invoice_line_ids[0].product_id.hs_code_id.local_code or object.invoice_line_ids[0].product_id.categ_id.hs_code_id.local_code or ""}#{border=thin_border;align=left;style=text}',
'F2': 'partner_id${value.display_name or ""}#{border=thin_border;align=left;style=text}',
'G2': 'partner_id${value.country_id.display_name or ""}#{border=thin_border;align=left;style=text}',
'M2': 'amount_total${value or ""}#{border=thin_border;align=left;style=number}',
'N2': 'currency_id${value.name or ""}#{border=thin_border;align=left;style=text}',
},
},
},
}
</field>
</record>

<function model="xlsx.template" name="load_xlsx_template">
<value eval="[ref('account_move_kviks')]" />
</function>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move_line_export
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

# Copyright 2025 Ismail Cagan Yilmaz (https://github.com/milleniumkid)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class ReportAccountMoveLine(models.TransientModel):
_name = "report.account.move.line"
_description = "Wizard for report.account.move.line"
_inherit = "xlsx.report"

# Report Result, account.move.line
results = fields.Many2many(
comodel_name="account.move.line",
string="Move Lines",
compute="_compute_move_lines",
help="Use compute fields, so there is nothing stored in database",
)

def _compute_move_lines(self):
selected_ids = self.env.context.get("active_ids", [])
ids = self.env["account.move.line"].browse(selected_ids)
for rec in self:
rec.results = ids
Binary file not shown.
29 changes: 29 additions & 0 deletions altinkaya_excel_export/export_account_move_line_xlsx/reports.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="report_account_move_line" model="ir.ui.view">
<field name="name">report.account.move.line</field>
<field name="model">report.account.move.line</field>
<field name="inherit_id" ref="excel_import_export.xlsx_report_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='criteria']" position="after">
Yevmiye kalemlerini, Zirve Yazılım sistemine uygun şekilde çıktı almak için aşağıdaki butonları kullanınız.
<field name="results" invisible="1" />
</xpath>
</field>
</record>

<record id="action_account_move_line_excel_export" model="ir.actions.act_window">
<field name="name">Yevmiye Excel</field>
<field name="res_model">report.account.move.line</field>
<field name="binding_model_id" ref="account.model_account_move_line" />
<field name="view_mode">form</field>
<field name="target">new</field>
<field
name="context"
>{'template_domain': [('res_model', '=', 'report.account.move.line'), ('fname', '=', 'move_lines.xlsx'), ('gname', '=', False)]}</field>
</record>


</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="account_move_line_excel" model="xlsx.template">
<field name="res_model">report.account.move.line</field>
<field name="fname">move_lines.xlsx</field>
<field name="name">Yevmiyeler Excel</field>
<field
name="description"
>Zirve Muhasebe programına uygun biçimde yevmiyelerin içeri aktarılabilmesini sağlayan Excel şablonu.</field>
<field name="input_instruction">
{
'__EXPORT__': {
'Fatura': {
'results': { # prefix with _CONT_ to continue rows from previous row field
'A2': '${object.date.strftime("%d.%m.%Y") or ""}#{border=thin_border;align=left;style=date}',
'B2': '${object.date_maturity.strftime("%d.%m.%Y") or ""}#{border=thin_border;align=left;style=date}',
'C2': 'journal_id.name${value or ""}#{border=thin_border;align=left;style=text}',
'D2': 'name${"%s %s" % (object.name, object.move_ref or object.move_id.name) or ""}#{border=thin_border;align=left;style=text}',
'E2': 'partner_id.display_name${value or ""}#{border=thin_border;align=left;style=text}',
'F2': '${"\'%s" % (object.partner_id.vat or "")}#{border=thin_border;align=left;style=text}',
'G2': '${"\'%s" % ((object.partner_id.z_payable_export or object.account_id.code) if object.account_id.user_type_id.type == \'payable\' else (object.partner_id.z_receivable_export if object.account_id.user_type_id.type == \'receivable\' else object.account_id.code)) or ""}#{border=thin_border;align=left;style=text}',
'H2': 'debit${value or ""}#{border=thin_border;align=left;style=number}',
'I2': 'credit${value or ""}#{border=thin_border;align=left;style=number}',
'J2': '${"EURO" if object.currency_id.name == "EUR" else object.currency_id.name or ""}#{border=thin_border;align=left;style=text}',
'K2': 'amount_currency${value or ""}#{border=thin_border;align=left;style=number}',
},
},
},
}
</field>
</record>

<function model="xlsx.template" name="load_xlsx_template">
<value eval="[ref('account_move_line_excel')]" />
</function>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move_export
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

# Copyright 2025 Ismail Cagan Yilmaz (https://github.com/milleniumkid)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class ReportAccountInvoice(models.TransientModel):
_name = "report.account.move"
_description = "Wizard for report.account.move"
_inherit = "xlsx.report"

# Report Result, account.move
results = fields.Many2many(
comodel_name="account.move",
string="Invoices",
compute="_compute_invoices",
help="Use compute fields, so there is nothing stored in database",
)

def _compute_invoices(self):
selected_ids = self.env.context.get("active_ids", [])
ids = self.env["account.move"].browse(selected_ids)
for rec in self:
rec.results = ids
Binary file not shown.
47 changes: 47 additions & 0 deletions altinkaya_excel_export/export_account_move_xlsx/reports.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="report_account_move" model="ir.ui.view">
<field name="name">report.account.move</field>
<field name="model">report.account.move</field>
<field name="inherit_id" ref="excel_import_export.xlsx_report_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='criteria']" position="after">
Faturaları, Zirve Yazılım sistemine uygun şekilde çıktı almak için aşağıdaki butonları kullanınız.
<field name="results" invisible="1" />
</xpath>
</field>
</record>

<record
id="action_account_invoice_excel_export_gelir_fatura"
model="ir.actions.act_window"
>
<field name="name">Gelir Fatura Excel</field>
<field name="res_model">report.account.move</field>
<field name="binding_model_id" ref="account.model_account_move" />
<field name="view_mode">form</field>
<field name="target">new</field>
<field
name="context"
>{'template_domain': [('res_model', '=', 'report.account.move'),
('fname', '=', 'gelir_fatura.xlsx'),
('gname', '=', False)]}</field>
</record>


<record id="action_account_move_excel_export" model="ir.actions.act_window">
<field name="name">Zirve Masraf Fatura</field>
<field name="res_model">report.account.move</field>
<field name="binding_model_id" ref="account.model_account_move" />
<field name="view_mode">form</field>
<field name="target">new</field>
<field
name="context"
>{'template_domain': [('res_model', '=', 'report.account.move'),
('fname', '=', 'zirve_masraf_fatura.xlsx'),
('gname', '=', False)]}</field>
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="account_move_gelir_fatura" model="xlsx.template">
<field name="res_model">report.account.move</field>
<field name="fname">gelir_fatura.xlsx</field>
<field name="name">Gelir Fatura Şablonu</field>
<field
name="description"
>Zirve Muhasebe programına uygun biçimde faturaların içeri aktarılabilmesini sağlayan Excel şablonu.</field>
<field name="input_instruction">
{
'__EXPORT__': {
'Fatura': { # sheet can be name (string) or index (integer)
'results': { # prefix with _CONT_ to continue rows from previous row field
'A2': '${object.date_invoice.strftime("%d.%m.%Y") or ""}#{border=thin_border;align=left;style=date}',
'B2': 'number${value or ""}#{border=thin_border;align=left;style=text}',
'C2': 'journal_id.name${value or ""}#{border=thin_border;align=left;style=text}',
'D2': 'partner_id.name${value or ""}#{border=thin_border;align=left;style=text}',
'E2': 'partner_id.vat${value or ""}#{border=thin_border;align=left;style=text}',
'F2': '${"%.2f" % (object.currency_rate * sum(x.base for x in object.tax_line_ids if 0.0 &lt; x.base and 7 &lt; (x.amount/x.base*100) &lt; 9)) or 0.0}#{border=thin_border;align=left;style=number}',
'G2': '${"%.2f" % (object.currency_rate * sum(x.amount for x in object.tax_line_ids if 0.0 &lt; x.base and 7 &lt; (x.amount/x.base*100) &lt; 9)) or 0.0}#{border=thin_border;align=left;style=number}',
'H2': '${"%.2f" % (object.currency_rate * sum(x.base for x in object.tax_line_ids if 0.0 &lt; x.base and 9 &lt; (x.amount/x.base*100) &lt; 11)) or 0.0}#{border=thin_border;align=left;style=number}',
'I2': '${"%.2f" % (object.currency_rate * sum(x.amount for x in object.tax_line_ids if 0.0 &lt; x.base and 9 &lt; (x.amount/x.base*100) &lt; 11)) or 0.0}#{border=thin_border;align=left;style=number}',
'J2': '${"%.2f" % (object.currency_rate * sum(x.base for x in object.tax_line_ids if 0.0 &lt; x.base and 17 &lt; (x.amount/x.base*100) &lt; 19)) or 0.0}#{border=thin_border;align=left;style=number}',
'K2': '${"%.2f" % (object.currency_rate * sum(x.amount for x in object.tax_line_ids if 0.0 &lt; x.base and 17 &lt; (x.amount/x.base*100) &lt; 19)) or 0.0}#{border=thin_border;align=left;style=number}',
'L2': '${"%.2f" % (object.currency_rate * sum(x.base for x in object.tax_line_ids if 0.0 &lt; x.base and 19 &lt; (x.amount/x.base*100) &lt; 21)) or 0.0}#{border=thin_border;align=left;style=number}',
'M2': '${"%.2f" % (object.currency_rate * sum(x.amount for x in object.tax_line_ids if 0.0 &lt; x.base and 19 &lt; (x.amount/x.base*100) &lt; 21)) or 0.0}#{border=thin_border;align=left;style=number}',
'N2': 'amount_untaxed${"%.2f" % (object.currency_rate * value) or ""}#{border=thin_border;align=left;style=number}',
'O2': 'amount_tax${"%.2f" % (object.currency_rate * value) or ""}#{border=thin_border;align=left;style=number}',
'P2': '${"%.f" % (object.amount_tax / object.amount_untaxed * 100) if object.amount_tax > 0.0 else 0}#{border=thin_border;align=left;style=number}',
'Q2': 'partner_id.z_receivable_export${value or ""}#{border=thin_border;align=left;style=text}',
'R2': '${"EURO" if object.currency_id.name == "EUR" else object.currency_id.name or ""}#{border=thin_border;align=left;style=text}',
'S2': '${"%.2f" % (sum(x.base for x in object.tax_line_ids if 0.0 &lt; x.base and 7 &lt; (x.amount/x.base*100) &lt; 9)) or 0.0}#{border=thin_border;align=left;style=number}',
'T2': '${"%.2f" % (sum(x.amount for x in object.tax_line_ids if 0.0 &lt; x.base and 7 &lt; (x.amount/x.base*100) &lt; 9)) or 0.0}#{border=thin_border;align=left;style=number}',
'U2': '${"%.2f" % (sum(x.base for x in object.tax_line_ids if 0.0 &lt; x.base and 17 &lt; (x.amount/x.base*100) &lt; 19)) or 0.0}#{border=thin_border;align=left;style=number}',
'V2': '${"%.2f" % (sum(x.amount for x in object.tax_line_ids if 0.0 &lt; x.base and 17 &lt; (x.amount/x.base*100) &lt; 19)) or 0.0}#{border=thin_border;align=left;style=number}',
'W2': 'amount_untaxed${"%.2f" % (value) or ""}#{border=thin_border;align=left;style=number}',
'X2': 'amount_tax${"%.2f" % (value) or ""}#{border=thin_border;align=left;style=number}',

},
},
},
}
</field>
</record>

<function model="xlsx.template" name="load_xlsx_template">
<value eval="[ref('account_move_gelir_fatura')]" />
</function>
</odoo>
Loading

0 comments on commit 427efd8

Please sign in to comment.