-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
44 additions
and
38 deletions.
There are no files selected for viewing
File renamed without changes.
10 changes: 5 additions & 5 deletions
10
...__/account_invoice_export/__manifest__.py → account_invoice_export/__manifest__.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 13 additions & 14 deletions
27
..._invoice_export/models/account_invoice.py → ..._invoice_export/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 |
---|---|---|
@@ -1,29 +1,28 @@ | ||
from odoo import models,fields,api | ||
|
||
from odoo import models, fields, api | ||
from datetime import datetime | ||
|
||
|
||
class AccountInvoice(models.Model): | ||
_inherit = "account.invoice" | ||
|
||
date_export = fields.Date(string="Export Date") | ||
amount_total_tl = fields.Float(string='Amount Total TRY', | ||
compute='_compute_amount_tl', | ||
store=False) | ||
amount_untaxed_tl = fields.Float(string='Amount Untaxed TRY', | ||
compute='_compute_amount_tl', | ||
store=False) | ||
amount_tax_tl = fields.Float(string='Amount tax TRY', | ||
amount_untaxed_tl = fields.Float(string='Amount Untaxed TRY', | ||
compute='_compute_amount_tl', | ||
store=False) | ||
amount_tax_tl = fields.Float(string='Amount tax TRY', | ||
compute='_compute_amount_tl', | ||
store=False) | ||
|
||
@api.one | ||
@api.depends('currency_id', 'amount_total', 'date_export', 'date_invoice') | ||
def _compute_amount_tl(self): | ||
currency_obj = self.env['res.currency'].browse(self.currency_id.id) | ||
currency_try = self.env['res.currency'].search([('name', '=', 'TRY')],limit=1) | ||
ctx = self.env.context.copy() | ||
company=self.env['res.company'].browse(1) | ||
date = self.date_export or self.date_invoice or datetime.today() | ||
self.amount_total_tl = currency_obj._convert(self.amount_total, currency_try,company,date) | ||
self.amount_tax_tl = currency_obj._convert( self.amount_tax, currency_try,company,date) | ||
self.amount_untaxed_tl = currency_obj._convert( self.amount_untaxed, currency_try,company,date) | ||
|
||
currency_try = self.env['res.currency'].search([('name', '=', 'TRY')], limit=1) | ||
company = self.env['res.company'].browse(1) | ||
date = self.date_export or self.date_invoice | ||
self.amount_total_tl = currency_obj._convert(self.amount_total, currency_try, company, date) | ||
self.amount_tax_tl = currency_obj._convert(self.amount_tax, currency_try, company, date) | ||
self.amount_untaxed_tl = currency_obj._convert(self.amount_untaxed, currency_try, company, date) |
File renamed without changes.
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
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
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