mirror of
https://github.com/bringout/oca-ocb-l10n_me-africa.git
synced 2026-04-27 23:22:03 +02:00
19.0 vanilla
This commit is contained in:
parent
c5006a6999
commit
80293571e7
420 changed files with 21812 additions and 44297 deletions
|
|
@ -1,4 +1,2 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import account_move_line
|
||||
from . import account_chart_template
|
||||
from . import account_move
|
||||
from . import template_ae
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models
|
||||
|
||||
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
|
||||
""" If UAE chart, we add 2 new journals TA and IFRS"""
|
||||
if self == self.env.ref('l10n_ae.uae_chart_template_standard'):
|
||||
if not journals_dict:
|
||||
journals_dict = []
|
||||
journals_dict.extend(
|
||||
[{"name": "Tax Adjustments", "company_id": company.id, "code": "TA", "type": "general", "sequence": 1,
|
||||
"favorite": True},
|
||||
{"name": "IFRS 16", "company_id": company.id, "code": "IFRS", "type": "general", "favorite": True,
|
||||
"sequence": 10}])
|
||||
return super()._prepare_all_journals(acc_template_ref, company, journals_dict=journals_dict)
|
||||
|
||||
def _load_template(self, company, code_digits=None, account_ref=None, taxes_ref=None):
|
||||
account_ref, taxes_ref = super(AccountChartTemplate, self)._load_template(company=company,
|
||||
code_digits=code_digits,
|
||||
account_ref=account_ref,
|
||||
taxes_ref=taxes_ref)
|
||||
if self == self.env.ref('l10n_ae.uae_chart_template_standard'):
|
||||
ifrs_journal = self.env['account.journal'].search(
|
||||
[('company_id', '=', company.id), ('code', '=', 'IFRS')]).id
|
||||
if ifrs_journal:
|
||||
ifrs_account_ids = [self.env.ref('l10n_ae.uae_account_100101').id,
|
||||
self.env.ref('l10n_ae.uae_account_100102').id,
|
||||
self.env.ref('l10n_ae.uae_account_400070').id]
|
||||
ifrs_accounts = self.env['account.account'].browse([account_ref.get(id) for id in ifrs_account_ids])
|
||||
for account in ifrs_accounts:
|
||||
account.allowed_journal_ids = [(4, ifrs_journal, 0)]
|
||||
self.env.ref('l10n_ae.ae_tax_group_5').write(
|
||||
{'property_tax_payable_account_id': account_ref.get(self.env.ref('l10n_ae.uae_account_202003').id),
|
||||
'property_tax_receivable_account_id': account_ref.get(self.env.ref('l10n_ae.uae_account_100103').id)})
|
||||
return account_ref, taxes_ref
|
||||
28
odoo-bringout-oca-ocb-l10n_ae/l10n_ae/models/account_move.py
Normal file
28
odoo-bringout-oca-ocb-l10n_ae/l10n_ae/models/account_move.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
from odoo import models
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
def _get_name_invoice_report(self):
|
||||
# EXTENDS account
|
||||
self.ensure_one()
|
||||
if self.company_id.country_code == 'AE':
|
||||
return 'l10n_ae.l10n_ae_report_invoice_document'
|
||||
return super()._get_name_invoice_report()
|
||||
|
||||
def _l10n_gcc_get_invoice_title(self):
|
||||
# EXTENDS l10n_gcc_invoice
|
||||
self.ensure_one()
|
||||
if self.company_id.country_code != 'AE':
|
||||
return super()._l10n_gcc_get_invoice_title()
|
||||
|
||||
if self._l10n_ae_is_simplified():
|
||||
return self.env._('Simplified Tax Invoice')
|
||||
|
||||
return self.env._('Tax Invoice')
|
||||
|
||||
def _l10n_ae_is_simplified(self):
|
||||
"""Returns True if the customer is an individual, i.e: The invoice is B2C"""
|
||||
self.ensure_one()
|
||||
return not self.commercial_partner_id.is_company
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
l10n_ae_vat_amount = fields.Monetary(compute='_compute_vat_amount', string='VAT Amount')
|
||||
|
||||
@api.depends('price_subtotal', 'price_total')
|
||||
def _compute_vat_amount(self):
|
||||
for record in self:
|
||||
record.l10n_ae_vat_amount = record.price_total - record.price_subtotal
|
||||
92
odoo-bringout-oca-ocb-l10n_ae/l10n_ae/models/template_ae.py
Normal file
92
odoo-bringout-oca-ocb-l10n_ae/l10n_ae/models/template_ae.py
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models, Command
|
||||
from odoo.addons.account.models.chart_template import template
|
||||
|
||||
|
||||
class AccountChartTemplate(models.AbstractModel):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
@template('ae')
|
||||
def _get_ae_template_data(self):
|
||||
return {
|
||||
'property_account_receivable_id': 'uae_account_102011',
|
||||
'property_account_payable_id': 'uae_account_201002',
|
||||
'code_digits': '6',
|
||||
}
|
||||
|
||||
@template('ae', 'res.company')
|
||||
def _get_ae_res_company(self):
|
||||
sales_tax_xmlid = {
|
||||
'AZ': 'uae_sale_tax_5_abu_dhabi',
|
||||
'AJ': 'uae_sale_tax_5_ajman',
|
||||
'DU': 'uae_sale_tax_5_dubai',
|
||||
'FU': 'uae_sale_tax_5_fujairah',
|
||||
'RK': 'uae_sale_tax_5_ras_al_khaima',
|
||||
'SH': 'uae_sale_tax_5_sharjah',
|
||||
'UQ': 'uae_sale_tax_5_umm_al_quwain',
|
||||
}.get(self.env.company.state_id.code, 'uae_sale_tax_5_dubai')
|
||||
return {
|
||||
self.env.company.id: {
|
||||
'account_fiscal_country_id': 'base.ae',
|
||||
'bank_account_code_prefix': '101',
|
||||
'cash_account_code_prefix': '105',
|
||||
'transfer_account_code_prefix': '100',
|
||||
'account_default_pos_receivable_account_id': 'uae_account_102012',
|
||||
'income_currency_exchange_account_id': 'uae_account_500011',
|
||||
'expense_currency_exchange_account_id': 'uae_account_400053',
|
||||
'account_journal_early_pay_discount_loss_account_id': 'uae_account_400071',
|
||||
'account_journal_early_pay_discount_gain_account_id': 'uae_account_500014',
|
||||
'account_sale_tax_id': sales_tax_xmlid,
|
||||
'account_purchase_tax_id': 'uae_purchase_tax_5',
|
||||
'expense_account_id': 'uae_account_400001',
|
||||
'income_account_id': 'uae_account_500001',
|
||||
'tax_calculation_rounding_method': 'round_per_line',
|
||||
'account_stock_journal_id': 'inventory_valuation',
|
||||
'account_stock_valuation_id': 'uae_account_131100',
|
||||
},
|
||||
}
|
||||
|
||||
@template('ae', 'account.journal')
|
||||
def _get_ae_account_journal(self):
|
||||
""" If UAE chart, we add 2 new journals TA and IFRS"""
|
||||
return {
|
||||
"tax_adjustment":{
|
||||
"name": "Tax Adjustments",
|
||||
"code": "TA",
|
||||
"type": "general",
|
||||
"show_on_dashboard": True,
|
||||
"sequence": 1,
|
||||
},
|
||||
"ifrs16": {
|
||||
"name": "IFRS 16",
|
||||
"code": "IFRS",
|
||||
"type": "general",
|
||||
"show_on_dashboard": True,
|
||||
"sequence": 10,
|
||||
}
|
||||
}
|
||||
|
||||
@template('ae', 'account.fiscal.position')
|
||||
def _get_ae_account_fiscal_position(self):
|
||||
fiscal_position_xmlid = {
|
||||
'AZ': 'account_fiscal_position_abu_dhabi',
|
||||
'AJ': 'account_fiscal_position_ajman',
|
||||
'DU': 'account_fiscal_position_dubai',
|
||||
'FU': 'account_fiscal_position_fujairah',
|
||||
'RK': 'account_fiscal_position_ras_al_khaima',
|
||||
'SH': 'account_fiscal_position_sharjah',
|
||||
'UQ': 'account_fiscal_position_umm_al_quwain',
|
||||
}.get(self.env.company.state_id.code, 'account_fiscal_position_dubai')
|
||||
return {
|
||||
fiscal_position_xmlid: {
|
||||
'sequence': 1,
|
||||
}
|
||||
}
|
||||
|
||||
@template('ae', 'account.account')
|
||||
def _get_ae_account_account(self):
|
||||
return {
|
||||
'uae_account_131100': {
|
||||
'account_stock_variation_id': 'uae_account_400001',
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue