-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from milleniumkid/16.0-mig_l10n_tr_invoice_amou…
…nt_in_words [MIG] l10n_tr_invoice_amount_in_words
- Loading branch information
Showing
6 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2015, Eska Yazılım ve Danışmanlık A.Ş. | ||
# http://www.eskayazilim.com.tr | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
# Copyright 2024 Ismail Cagan Yilmaz (https://github.com/milleniumkid) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2015, Eska Yazılım ve Danışmanlık A.Ş. | ||
# http://www.eskayazilim.com.tr | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
# Copyright 2024 Ismail Cagan Yilmaz (https://github.com/milleniumkid) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
"name": "Turkey - Invoice Amount In Words", | ||
"version": "16.0.1.0.0", | ||
"category": "Localization", | ||
"author": "Codequarters, Altinkaya Enclosures", | ||
"license": "LGPL-3", | ||
"depends": ["account", "sale", "purchase"], | ||
"website": "https://github.com/altinkaya-opensource/odoo-addons", | ||
"development_status": "Mature", | ||
"installable": True, | ||
"auto_install": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-01-14 11:56+0000\n" | ||
"PO-Revision-Date: 2015-01-14 11:56+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: l10n_tr_invoice_amount_to_text | ||
#: model:ir.model,name:l10n_tr_invoice_amount_to_text.model_account_invoice | ||
msgid "Invoice" | ||
msgstr "Fatura" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2015, Eska Yazılım ve Danışmanlık A.Ş. | ||
# http://www.eskayazilim.com.tr | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
# Copyright 2024 Ismail Cagan Yilmaz (https://github.com/milleniumkid) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import account_invoice |
120 changes: 120 additions & 0 deletions
120
l10n_tr_invoice_amount_in_words/models/account_invoice.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2015, Eska Yazılım ve Danışmanlık A.Ş. | ||
# http://www.eskayazilim.com.tr | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
# Copyright 2024 Ismail Cagan Yilmaz (https://github.com/milleniumkid) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
import logging | ||
|
||
from odoo import api, fields, models | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
@api.depends("amount_total", "currency_id") | ||
def _compute_invoice_amount_in_words(self): | ||
for record in self: | ||
record.invoice_amount_in_words = "" | ||
try: | ||
lang = record.env.context.get( | ||
"lang", record.sudo().company_id.partner_id.lang | ||
) | ||
record.invoice_amount_in_words = record.currency_id.with_context( | ||
lang=lang | ||
).amount_to_text(record.amount_total) | ||
except Exception as e: | ||
_logger.error(f"Error computing invoice amount in words: {e}") | ||
|
||
invoice_amount_in_words = fields.Char( | ||
compute="_compute_invoice_amount_in_words", string="Amount to Text" | ||
) | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
@api.depends("amount_total", "currency_id") | ||
def _compute_sale_order_amount_in_words(self): | ||
for record in self: | ||
record.sale_order_amount_in_words = "" | ||
try: | ||
lang = ( | ||
record.env.context.get("lang") | ||
or record.partner_id.lang | ||
or record.sudo().company_id.partner_id.lang | ||
) | ||
record.sale_order_amount_in_words = record.currency_id.with_context( | ||
lang=lang | ||
).amount_to_text(record.amount_total) | ||
except Exception as e: | ||
_logger.error(f"Error computing sale order amount in words: {e}") | ||
|
||
sale_order_amount_in_words = fields.Char( | ||
compute="_compute_sale_order_amount_in_words", string="Amount to Text" | ||
) | ||
|
||
|
||
class PurchaseOrder(models.Model): | ||
_inherit = "purchase.order" | ||
|
||
@api.depends("amount_total", "currency_id") | ||
def _compute_purchase_order_amount_in_words(self): | ||
for record in self: | ||
record.purchase_order_amount_in_words = "" | ||
try: | ||
lang = record.env.context.get( | ||
"lang", record.sudo().company_id.partner_id.lang | ||
) | ||
record.purchase_order_amount_in_words = record.currency_id.with_context( | ||
lang=lang | ||
).amount_to_text(record.amount_total) | ||
except Exception as e: | ||
_logger.error(f"Error computing purchase order amount in words: {e}") | ||
|
||
purchase_order_amount_in_words = fields.Char( | ||
compute="_compute_purchase_order_amount_in_words", string="Amount to Text" | ||
) | ||
|
||
|
||
class AccountPayment(models.Model): | ||
_inherit = "account.payment" | ||
|
||
@api.depends("amount", "currency_id") | ||
def _compute_account_payment_amount_in_words(self): | ||
for record in self: | ||
record.account_payment_amount_in_words = "" | ||
try: | ||
lang = record.env.context.get( | ||
"lang", record.sudo().company_id.partner_id.lang | ||
) | ||
record.account_payment_amount_in_words = ( | ||
record.currency_id.with_context(lang=lang).amount_to_text( | ||
record.amount | ||
) | ||
) | ||
except Exception as e: | ||
_logger.error(f"Error computing account payment amount in words: {e}") | ||
|
||
account_payment_amount_in_words = fields.Char( | ||
compute="_compute_account_payment_amount_in_words", string="Amount to Text" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Turkey - Invoice Amount In Words | ||
================================ | ||
|
||
This module converts the total amount to text for printing on invoices. | ||
|
||
Features: | ||
- Converts total amount to text in Turkish for invoices, sales orders, and purchase orders. | ||
- Localized and ready for use with Turkish localization requirements. | ||
|
||
Fatura toplam tutarını yazdırmak için birleşik kelimeye çevirir. |