[ADD] Unite Arab Emirates (UAE) VAT Implementation
This commit is contained in:
parent
ade1b2467e
commit
ff31a8ff33
@ -1,4 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright
|
||||
# and licensing details.
|
||||
|
||||
# Copyright (C) 2014 Tech Receptives (<http://techreceptives.com>).
|
||||
|
||||
from . import models
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright
|
||||
# and licensing details.
|
||||
|
||||
# Copyright (C) 2014 Tech Receptives (<http://techreceptives.com>)
|
||||
|
||||
@ -17,6 +18,7 @@ United Arab Emirates accounting chart and localization.
|
||||
'data': [
|
||||
'data/account_data.xml',
|
||||
'data/l10n_ae_chart_data.xml',
|
||||
'data/account_chart_template_data.yml',
|
||||
'data/account_fiscal_position_data.xml',
|
||||
'data/account_chart_template_data.yml'
|
||||
],
|
||||
}
|
||||
|
112
addons/l10n_ae/data/account_fiscal_position_data.xml
Normal file
112
addons/l10n_ae/data/account_fiscal_position_data.xml
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
|
||||
<!-- Fiscal Position Templates -->
|
||||
<record model="account.fiscal.position.template" id="fp_in_zero">
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
<field name="name">Zero</field>
|
||||
</record>
|
||||
|
||||
<!-- Fiscal Position Tax Templates -->
|
||||
<record id="fp_sale_vat_5_percent_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="sale_uae_vat_5"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_vat_5_percent_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="purchase_uae_vat_5"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_sale_excise_50_percent_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="sale_uae_excise_50"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_excise_50_percent_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="purchase_uae_excise_50"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_sale_excise_100_percent_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="sale_uae_excise_100"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_excise_100_percent_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="purchase_uae_excise_10"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_sale_tax_template_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="l10n_ae.sale_tax_template"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_tax_template_zero" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_zero"/>
|
||||
<field name="tax_src_id" ref="l10n_ae.purchase_tax_template"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_zero"/>
|
||||
</record>
|
||||
|
||||
<record model="account.fiscal.position.template" id="fp_in_exempted">
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
<field name="name">Exempted</field>
|
||||
</record>
|
||||
|
||||
<record id="fp_sale_vat_5_percent_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="sale_uae_vat_5"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_vat_5_percent_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="purchase_uae_vat_5"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_sale_excise_50_percent_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="sale_uae_excise_50"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_excise_50_percent_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="purchase_uae_excise_50"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_sale_excise_100_percent_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="sale_uae_excise_100"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_excise_100_percent_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="purchase_uae_excise_10"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_sale_tax_template_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="l10n_ae.sale_tax_template"/>
|
||||
<field name="tax_dest_id" ref="sale_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
<record id="fp_purchase_tax_template_exempted" model="account.fiscal.position.tax.template">
|
||||
<field name="position_id" ref="fp_in_exempted"/>
|
||||
<field name="tax_src_id" ref="l10n_ae.purchase_tax_template"/>
|
||||
<field name="tax_dest_id" ref="purchase_uae_vat_exempted"/>
|
||||
</record>
|
||||
|
||||
</flectra>
|
@ -13,7 +13,7 @@
|
||||
<field name="bank_account_code_prefix">101</field>
|
||||
<field name="currency_id" ref="base.AED" />
|
||||
<field name="transfer_account_id" ref="transfer_account_id"/>
|
||||
<field name="complete_tax_set" eval="False"/>
|
||||
<!-- <field name="complete_tax_set" eval="False"/> -->
|
||||
</record>
|
||||
|
||||
<record model="account.account.template" id="transfer_account_id">
|
||||
@ -1469,6 +1469,13 @@
|
||||
<field name="chart_template_id" ref="uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="rc_customs_expense_account" model="account.account.template">
|
||||
<field name="code">581001</field>
|
||||
<field name="name">Customs Expense</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
||||
<field name="chart_template_id" ref="uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="uae_chart_template_standard" model="account.chart.template">
|
||||
<field name="property_account_receivable_id" ref="uae_account_3681" />
|
||||
<field name="property_account_payable_id" ref="uae_account_3753" />
|
||||
@ -1498,4 +1505,169 @@
|
||||
<field name="refund_account_id" ref="uae_account_3726"/>
|
||||
<field name="tax_group_id" ref="tax_group_15"/>
|
||||
</record>
|
||||
|
||||
<record model="account.account.template" id="excise_payable_account">
|
||||
<field name="name">Excise Payable Account</field>
|
||||
<field name="code">2013001</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_current_liabilities" />
|
||||
<field name="reconcile" eval="True" />
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record model="account.account.template" id="excise_receivable_account">
|
||||
<field name="name">Excise Receivable Account</field>
|
||||
<field name="code">1034001</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_current_assets" />
|
||||
<field name="reconcile" eval="True" />
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record model="account.account.template" id="vat_payable_account">
|
||||
<field name="name">Vat Payable Account</field>
|
||||
<field name="code">2013002</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_current_liabilities" />
|
||||
<field name="reconcile" eval="True" />
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record model="account.account.template" id="vat_receivable_account">
|
||||
<field name="name">Vat Receivable Account</field>
|
||||
<field name="code">1034002</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_current_assets" />
|
||||
<field name="reconcile" eval="True" />
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="sale_uae_excise_50" model="account.tax.template">
|
||||
<field name="name">Sale - Excise 50%</field>
|
||||
<field name="description">Sale Excise 50%</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">50</field>
|
||||
<field name="account_id" ref="vat_payable_account"/>
|
||||
<field name="refund_account_id" ref="vat_payable_account"/>
|
||||
<field name="tax_type">excise</field>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="purchase_uae_excise_50" model="account.tax.template">
|
||||
<field name="name">Purchase - Excise 50%</field>
|
||||
<field name="description">Purchase Excise 50%</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">50</field>
|
||||
<field name="account_id" ref="excise_receivable_account"/>
|
||||
<field name="refund_account_id" ref="excise_receivable_account"/>
|
||||
<field name="tax_type">excise</field>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="sale_uae_vat_zero" model="account.tax.template">
|
||||
<field name="name">Sale - Zero%</field>
|
||||
<field name="description">Sale Zero%</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">0</field>
|
||||
<field name="account_id" ref="vat_payable_account"/>
|
||||
<field name="refund_account_id" ref="vat_payable_account"/>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="purchase_uae_vat_zero" model="account.tax.template">
|
||||
<field name="name">Purchase - Zero%</field>
|
||||
<field name="description">Purchase Zero%</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">0</field>
|
||||
<field name="account_id" ref="vat_receivable_account"/>
|
||||
<field name="refund_account_id" ref="vat_receivable_account"/>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="sale_uae_excise_100" model="account.tax.template">
|
||||
<field name="name">Sale - Excise 100%</field>
|
||||
<field name="description">Sale Excise 100%</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">100</field>
|
||||
<field name="account_id" ref="excise_payable_account"/>
|
||||
<field name="refund_account_id" ref="excise_payable_account"/>
|
||||
<field name="tax_type">excise</field>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="purchase_uae_excise_10" model="account.tax.template">
|
||||
<field name="name">Purchase - Excise 100%</field>
|
||||
<field name="description">Purchase Excise 100%</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_type">excise</field>
|
||||
<field name="amount">100</field>
|
||||
<field name="account_id" ref="excise_receivable_account"/>
|
||||
<field name="refund_account_id" ref="excise_receivable_account"/>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="sale_uae_vat_exempted" model="account.tax.template">
|
||||
<field name="name">Sale - VAT Exempted</field>
|
||||
<field name="description">Sale VAT Exempted</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">0</field>
|
||||
<field name="account_id" ref="vat_payable_account"/>
|
||||
<field name="refund_account_id" ref="vat_payable_account"/>
|
||||
<field name="tax_type">exempted</field>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="purchase_uae_vat_exempted" model="account.tax.template">
|
||||
<field name="name">Purchase - VAT Exempted</field>
|
||||
<field name="description">Purchase VAT Exempted</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">0</field>
|
||||
<field name="account_id" ref="vat_receivable_account"/>
|
||||
<field name="refund_account_id" ref="vat_receivable_account"/>
|
||||
<field name="tax_type">exempted</field>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="vat_custom" model="account.tax.template">
|
||||
<field name="name">Custom</field>
|
||||
<field name="description">Custom VAT </field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">5</field>
|
||||
<field name="account_id" ref="rc_customs_expense_account"/>
|
||||
<field name="refund_account_id" ref="rc_customs_expense_account"/>
|
||||
<field name="tax_type">customs</field>
|
||||
<field name="chart_template_id" ref="uae_chart_template_standard"/>
|
||||
<field name="include_base_amount" eval="True"/>
|
||||
<field name="sequence"/>0</record>
|
||||
</record>
|
||||
|
||||
<record id="sale_uae_vat_5" model="account.tax.template">
|
||||
<field name="name">Sale - VAT 5%</field>
|
||||
<field name="description">Sale VAT 5%</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">5</field>
|
||||
<field name="account_id" ref="vat_payable_account"/>
|
||||
<field name="refund_account_id" ref="vat_payable_account"/>
|
||||
<field name="tax_type">vat</field>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
<record id="purchase_uae_vat_5" model="account.tax.template">
|
||||
<field name="name">Purchase - VAT 5%</field>
|
||||
<field name="description">Purchase VAT 5%</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="amount">5</field>
|
||||
<field name="account_id" ref="vat_receivable_account"/>
|
||||
<field name="refund_account_id" ref="vat_receivable_account"/>
|
||||
<field name="tax_type">vat</field>
|
||||
<field name="chart_template_id" ref="l10n_ae.uae_chart_template_standard"/>
|
||||
</record>
|
||||
|
||||
</flectra>
|
||||
|
4
addons/l10n_ae/models/__init__.py
Normal file
4
addons/l10n_ae/models/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import account_tax
|
27
addons/l10n_ae/models/account_tax.py
Normal file
27
addons/l10n_ae/models/account_tax.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
|
||||
from flectra import fields, models
|
||||
|
||||
|
||||
class AccountTaxTemplate(models.Model):
|
||||
_inherit = 'account.tax.template'
|
||||
|
||||
tax_type = fields.Selection([
|
||||
('vat', 'VAT'), ('customs', 'Customs'), ('excise', 'Excise'),
|
||||
('exempted', 'Exempted'), ('other', 'Other')], 'VAT Type')
|
||||
|
||||
def _get_tax_vals(self, company, tax_template_to_tax):
|
||||
self.ensure_one()
|
||||
res = super(AccountTaxTemplate, self)._get_tax_vals(
|
||||
company, tax_template_to_tax)
|
||||
res['tax_type'] = self.tax_type
|
||||
return res
|
||||
|
||||
|
||||
class AccountTax(models.Model):
|
||||
_inherit = 'account.tax'
|
||||
|
||||
tax_type = fields.Selection([
|
||||
('vat', 'VAT'), ('customs', 'Customs'), ('excise', 'Excise'),
|
||||
('exempted', 'Exempted'), ('other', 'Other')], 'VAT Type')
|
5
addons/l10n_ae_extend/__init__.py
Normal file
5
addons/l10n_ae_extend/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
from . import reports
|
30
addons/l10n_ae_extend/__manifest__.py
Normal file
30
addons/l10n_ae_extend/__manifest__.py
Normal file
@ -0,0 +1,30 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'U.A.E. - Accounting Extend',
|
||||
'author': 'FlectraHQ',
|
||||
'website': 'https://www.flectrahq.com/',
|
||||
'category': 'Localization',
|
||||
'description': """
|
||||
United Arab Emirates accounting chart and localization.
|
||||
=======================================================
|
||||
|
||||
""",
|
||||
'depends': ['l10n_ae', 'account_invoicing', 'sale_management', 'purchase'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/journal_data.xml',
|
||||
'data/vat_config_type_data.xml',
|
||||
'views/report_vat_201_view.xml',
|
||||
'views/report_menu_view.xml',
|
||||
'views/vat_config_type.xml',
|
||||
'views/company_view.xml',
|
||||
'views/purchase_order_view.xml',
|
||||
'views/sale_order_view.xml',
|
||||
'views/account_invoice_view.xml',
|
||||
'wizard/vat_201_view.xml',
|
||||
],
|
||||
'demo': [
|
||||
'demo/account_invoice_demo.xml',
|
||||
],
|
||||
}
|
137
addons/l10n_ae_extend/data/journal_data.xml
Normal file
137
addons/l10n_ae_extend/data/journal_data.xml
Normal file
@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra noupdate="1">
|
||||
|
||||
<!-- Sale -->
|
||||
<record id="local_sale_uae_account" model="account.account">
|
||||
<field name="code">433101</field>
|
||||
<field name="name">Local Sale</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_revenue"/>
|
||||
</record>
|
||||
|
||||
<record id="local_sale_journal" model="account.journal">
|
||||
<field name="name">Local Sale</field>
|
||||
<field name="code">LCLS</field>
|
||||
<field name="type">sale</field>
|
||||
<field name="default_credit_account_id" ref="local_sale_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="local_sale_uae_account"/>
|
||||
</record>
|
||||
|
||||
<record id="insidegcc_sale_uae_account" model="account.account">
|
||||
<field name="code">433102</field>
|
||||
<field name="name">Inside GCC Sale</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_revenue"/>
|
||||
</record>
|
||||
|
||||
<record id="insidegcc_sale_journal" model="account.journal">
|
||||
<field name="name">Inside GCC Sale</field>
|
||||
<field name="code">IGCCS</field>
|
||||
<field name="type">sale</field>
|
||||
<field name="default_credit_account_id" ref="insidegcc_sale_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="insidegcc_sale_uae_account"/>
|
||||
</record>
|
||||
|
||||
<record id="outsidegcc_sale_uae_account" model="account.account">
|
||||
<field name="code">433103</field>
|
||||
<field name="name">Outside GCC Sale</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_revenue"/>
|
||||
</record>
|
||||
|
||||
<record id="outsidegcc_sale_journal" model="account.journal">
|
||||
<field name="name">Outside GCC Sale</field>
|
||||
<field name="code">OGCCS</field>
|
||||
<field name="type">sale</field>
|
||||
<field name="default_credit_account_id" ref="outsidegcc_sale_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="outsidegcc_sale_uae_account"/>
|
||||
</record>
|
||||
|
||||
<record id="designated_zone_sale_uae_account" model="account.account">
|
||||
<field name="code">433104</field>
|
||||
<field name="name">Designated Zone Sale</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_revenue"/>
|
||||
</record>
|
||||
|
||||
<record id="designated_zone_sale_journal" model="account.journal">
|
||||
<field name="name">Designated Zone Sale</field>
|
||||
<field name="code">DZS</field>
|
||||
<field name="type">sale</field>
|
||||
<field name="default_credit_account_id" ref="designated_zone_sale_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="designated_zone_sale_uae_account"/>
|
||||
</record>
|
||||
|
||||
<record id="rc_vat_account" model="account.account">
|
||||
<field name="code">205301</field>
|
||||
<field name="name">Reverse Charge(Vat)</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||
</record>
|
||||
|
||||
<record id="rc_vat_expense_account" model="account.account">
|
||||
<field name="code">581002</field>
|
||||
<field name="name">VAT Expense</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
||||
</record>
|
||||
|
||||
<record id="base.main_company" model="res.company">
|
||||
<field name="rc_vat_account_id" ref="rc_vat_account"/>
|
||||
<field name="customs_duty_account_id" ref="l10n_ae.uae_account_3694"/>
|
||||
<field name="vat_expense_account_id" ref="rc_vat_expense_account"/>
|
||||
</record>
|
||||
|
||||
<!-- Purchase -->
|
||||
<record id="local_purchase_uae_account" model="account.account">
|
||||
<field name="code">571001</field>
|
||||
<field name="name">Local Purchase</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
||||
</record>
|
||||
|
||||
<record id="local_purchase_journal" model="account.journal">
|
||||
<field name="name">Local Purchase</field>
|
||||
<field name="code">LCLP</field>
|
||||
<field name="type">purchase</field>
|
||||
<field name="default_credit_account_id" ref="local_purchase_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="local_purchase_uae_account"/>
|
||||
</record>
|
||||
|
||||
<record id="insidegcc_purchase_uae_account" model="account.account">
|
||||
<field name="code">571002</field>
|
||||
<field name="name">Inside GCC Purchase</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
||||
</record>
|
||||
|
||||
<record id="insidegcc_purchase_journal" model="account.journal">
|
||||
<field name="name">Inside GCC Purchase</field>
|
||||
<field name="code">IGCCP</field>
|
||||
<field name="type">purchase</field>
|
||||
<field name="default_credit_account_id" ref="insidegcc_purchase_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="insidegcc_purchase_uae_account"/>
|
||||
</record>
|
||||
|
||||
<record id="outsidegcc_purchase_uae_account" model="account.account">
|
||||
<field name="code">571003</field>
|
||||
<field name="name">Outside GCC Purchase</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
||||
</record>
|
||||
|
||||
<record id="outsidegcc_purchase_journal" model="account.journal">
|
||||
<field name="name">Outside GCC Purchase</field>
|
||||
<field name="code">OGCCP</field>
|
||||
<field name="type">purchase</field>
|
||||
<field name="default_credit_account_id" ref="outsidegcc_purchase_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="outsidegcc_purchase_uae_account"/>
|
||||
</record>
|
||||
|
||||
<record id="designated_zone_purchase_uae_account" model="account.account">
|
||||
<field name="code">571004</field>
|
||||
<field name="name">Designated Zone Purchase</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
||||
</record>
|
||||
|
||||
<record id="designated_zone_purchase_journal" model="account.journal">
|
||||
<field name="name">Designated Zone Purchase</field>
|
||||
<field name="code">DZP</field>
|
||||
<field name="type">purchase</field>
|
||||
<field name="default_credit_account_id" ref="designated_zone_purchase_uae_account"/>
|
||||
<field name="default_debit_account_id" ref="designated_zone_purchase_uae_account"/>
|
||||
</record>
|
||||
|
||||
</flectra>
|
||||
|
71
addons/l10n_ae_extend/data/vat_config_type_data.xml
Normal file
71
addons/l10n_ae_extend/data/vat_config_type_data.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
|
||||
<!-- Sale Config Type-->
|
||||
<record id="config_type_1" model="vat.config.type">
|
||||
<field name="name">Local Sale</field>
|
||||
<field name="code">LCLSJC</field>
|
||||
<field name="journal_id" ref="local_sale_journal"/>
|
||||
<field name="type">sale</field>
|
||||
<field name="vat_type">local_sale</field>
|
||||
</record>
|
||||
|
||||
<record id="config_type_2" model="vat.config.type">
|
||||
<field name="name">Inside GCC Sale</field>
|
||||
<field name="code">IGCCSJC</field>
|
||||
<field name="journal_id" ref="insidegcc_sale_journal"/>
|
||||
<field name="type">sale</field>
|
||||
<field name="vat_type">inside_gcc_sale</field>
|
||||
</record>
|
||||
|
||||
<record id="config_type_3" model="vat.config.type">
|
||||
<field name="name">Outside GCC Sale</field>
|
||||
<field name="code">OGCCSJC</field>
|
||||
<field name="journal_id" ref="outsidegcc_sale_journal"/>
|
||||
<field name="type">sale</field>
|
||||
<field name="vat_type">outside_gcc_sale</field>
|
||||
</record>
|
||||
|
||||
<record id="config_type_4" model="vat.config.type">
|
||||
<field name="name">Designated Zone Sale</field>
|
||||
<field name="code">DZSJC</field>
|
||||
<field name="journal_id" ref="designated_zone_sale_journal"/>
|
||||
<field name="type">sale</field>
|
||||
<field name="vat_type">designated_zone_sale</field>
|
||||
</record>
|
||||
|
||||
<!-- Purchase Config Type-->
|
||||
<record id="config_type_5" model="vat.config.type">
|
||||
<field name="name">Local Purchase</field>
|
||||
<field name="code">LCLPJC</field>
|
||||
<field name="journal_id" ref="local_purchase_journal"/>
|
||||
<field name="type">purchase</field>
|
||||
<field name="vat_type">local_purchase</field>
|
||||
</record>
|
||||
|
||||
<record id="config_type_6" model="vat.config.type">
|
||||
<field name="name">Inside GCC Purchase</field>
|
||||
<field name="code">IGCCPJC</field>
|
||||
<field name="journal_id" ref="insidegcc_purchase_journal"/>
|
||||
<field name="type">purchase</field>
|
||||
<field name="vat_type">inside_gcc_purchase</field>
|
||||
</record>
|
||||
|
||||
<record id="config_type_7" model="vat.config.type">
|
||||
<field name="name">Outside GCC Purchase</field>
|
||||
<field name="code">OGCCPJC</field>
|
||||
<field name="journal_id" ref="outsidegcc_purchase_journal"/>
|
||||
<field name="type">purchase</field>
|
||||
<field name="vat_type">outside_gcc_purchase</field>
|
||||
</record>
|
||||
|
||||
<record id="config_type_8" model="vat.config.type">
|
||||
<field name="name">Designated Zone Purchase</field>
|
||||
<field name="code">DZPJC</field>
|
||||
<field name="journal_id" ref="designated_zone_purchase_journal"/>
|
||||
<field name="type">purchase</field>
|
||||
<field name="vat_type">designated_zone_purchase</field>
|
||||
</record>
|
||||
|
||||
</flectra>
|
||||
|
197
addons/l10n_ae_extend/demo/account_invoice_demo.xml
Normal file
197
addons/l10n_ae_extend/demo/account_invoice_demo.xml
Normal file
@ -0,0 +1,197 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<flectra noupdate="1">
|
||||
|
||||
<record id="product.product_product_24" model="product.product">
|
||||
<field name="taxes_id" eval="[(6, 0, [ref('l10n_ae.sale_uae_vat_5')])]"/>
|
||||
<field name="supplier_taxes_id" eval="[(6, 0, [ref('l10n_ae.purchase_uae_vat_5')])]"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_invoice_ae_1" model="account.invoice">
|
||||
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
||||
<field name="currency_id" ref="base.AED"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="type">out_invoice</field>
|
||||
<field name="date_invoice" eval="DateTime.today().strftime('%Y-%m-01')"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="journal_id" ref="l10n_ae_extend.local_sale_journal"/>
|
||||
<field name="vat_config_type" ref="l10n_ae_extend.config_type_1"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_invoice_ae_line1" model="account.invoice.line">
|
||||
<field name="invoice_id" ref="demo_invoice_ae_1"/>
|
||||
<field name="name">Graphics Card</field>
|
||||
<field name="product_id" ref="product.product_product_24"/>
|
||||
<field name="account_id" ref="l10n_ae_extend.local_sale_uae_account"/>
|
||||
<field name="price_unit">885.0</field>
|
||||
<field name="quantity">2.0</field>
|
||||
</record>
|
||||
|
||||
<function model="account.invoice.line" name="_onchange_product_id"
|
||||
eval="[ref('demo_invoice_ae_line1')]"/>
|
||||
<function model="account.invoice" name="_onchange_invoice_line_ids"
|
||||
eval="[ref('demo_invoice_ae_1')]"/>
|
||||
<function model="account.invoice" name="_get_total_amount"
|
||||
eval="[ref('demo_invoice_ae_1')]"/>
|
||||
<function model="account.invoice" name="action_invoice_open"
|
||||
eval="[ref('demo_invoice_ae_1')]"/>
|
||||
|
||||
<!-- Refund -->
|
||||
<record id="demo_invoice_ae_2" model="account.invoice">
|
||||
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
||||
<field name="currency_id" ref="base.AED"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="type">out_refund</field>
|
||||
<field name="date_invoice" eval="DateTime.today().strftime('%Y-%m-01')"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="journal_id" ref="l10n_ae_extend.local_sale_journal"/>
|
||||
<field name="refund_invoice_id" ref="demo_invoice_ae_1"/>
|
||||
<field name="vat_config_type" ref="l10n_ae_extend.config_type_1"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_invoice_ae_line2" model="account.invoice.line">
|
||||
<field name="invoice_id" ref="demo_invoice_ae_2"/>
|
||||
<field name="name">Graphics Card</field>
|
||||
<field name="product_id" ref="product.product_product_24"/>
|
||||
<field name="price_unit">885.0</field>
|
||||
<field name="account_id" ref="l10n_ae_extend.local_sale_uae_account"/>
|
||||
<field name="quantity">1.0</field>
|
||||
</record>
|
||||
|
||||
<function model="account.invoice.line" name="_onchange_product_id"
|
||||
eval="[ref('demo_invoice_ae_line2')]"/>
|
||||
<function model="account.invoice" name="_onchange_invoice_line_ids"
|
||||
eval="[ref('demo_invoice_ae_2')]"/>
|
||||
<function model="account.invoice" name="_get_total_amount"
|
||||
eval="[ref('demo_invoice_ae_2')]"/>
|
||||
<function model="account.invoice" name="action_invoice_open"
|
||||
eval="[ref('demo_invoice_ae_2')]"/>
|
||||
|
||||
<record id="demo_invoice_ae_3" model="account.invoice">
|
||||
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
||||
<field name="currency_id" ref="base.AED"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="date_invoice" eval="DateTime.today().strftime('%Y-%m-01')"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="vat_config_type" ref="l10n_ae_extend.config_type_5"/>
|
||||
<field name="journal_id" ref="l10n_ae_extend.local_purchase_journal"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_invoice_ae_line3" model="account.invoice.line">
|
||||
<field name="invoice_id" ref="demo_invoice_ae_3"/>
|
||||
<field name="name">Graphics Card</field>
|
||||
<field name="product_id" ref="product.product_product_24"/>
|
||||
<field name="account_id" ref="l10n_ae_extend.local_purchase_uae_account"/>
|
||||
<field name="price_unit">876.0</field>
|
||||
<field name="quantity">20.0</field>
|
||||
</record>
|
||||
|
||||
<function model="account.invoice.line" name="_onchange_product_id"
|
||||
eval="[ref('demo_invoice_ae_line3')]"/>
|
||||
<function model="account.invoice" name="_onchange_invoice_line_ids"
|
||||
eval="[ref('demo_invoice_ae_3')]"/>
|
||||
<function model="account.invoice" name="_get_total_amount"
|
||||
eval="[ref('demo_invoice_ae_3')]"/>
|
||||
<function model="account.invoice" name="action_invoice_open"
|
||||
eval="[ref('demo_invoice_ae_3')]"/>
|
||||
|
||||
<!-- Refund -->
|
||||
<record id="demo_invoice_ae_4" model="account.invoice">
|
||||
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
||||
<field name="currency_id" ref="base.AED"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="type">in_refund</field>
|
||||
<field name="date_invoice" eval="DateTime.today().strftime('%Y-%m-01')"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="vat_config_type" ref="l10n_ae_extend.config_type_5"/>
|
||||
<field name="journal_id" ref="l10n_ae_extend.local_purchase_journal"/>
|
||||
<field name="refund_invoice_id" ref="demo_invoice_ae_3"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_invoice_ae_line4" model="account.invoice.line">
|
||||
<field name="invoice_id" ref="demo_invoice_ae_4"/>
|
||||
<field name="name">Graphics Card</field>
|
||||
<field name="product_id" ref="product.product_product_24"/>
|
||||
<field name="account_id" ref="l10n_ae_extend.local_purchase_uae_account"/>
|
||||
<field name="price_unit">876.0</field>
|
||||
<field name="quantity">10.0</field>
|
||||
</record>
|
||||
|
||||
<function model="account.invoice.line" name="_onchange_product_id"
|
||||
eval="[ref('demo_invoice_ae_line4')]"/>
|
||||
<function model="account.invoice" name="_onchange_invoice_line_ids"
|
||||
eval="[ref('demo_invoice_ae_4')]"/>
|
||||
<function model="account.invoice" name="_get_total_amount"
|
||||
eval="[ref('demo_invoice_ae_4')]"/>
|
||||
<function model="account.invoice" name="action_invoice_open"
|
||||
eval="[ref('demo_invoice_ae_4')]"/>
|
||||
|
||||
<!-- Reverse -->
|
||||
<record id="demo_invoice_ae_5" model="account.invoice">
|
||||
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
||||
<field name="currency_id" ref="base.AED"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="type">in_invoice</field>
|
||||
<field name="date_invoice" eval="DateTime.today().strftime('%Y-%m-01')"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="journal_id" ref="l10n_ae_extend.local_purchase_journal"/>
|
||||
<field name="vat_config_type" ref="l10n_ae_extend.config_type_5"/>
|
||||
<field name="reverse_charge" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_invoice_ae_line5" model="account.invoice.line">
|
||||
<field name="invoice_id" ref="demo_invoice_ae_5"/>
|
||||
<field name="name">Graphics Card</field>
|
||||
<field name="product_id" ref="product.product_product_24"/>
|
||||
<field name="account_id" ref="l10n_ae_extend.local_sale_uae_account"/>
|
||||
<field name="price_unit">876.0</field>
|
||||
<field name="quantity">20.0</field>
|
||||
</record>
|
||||
|
||||
<function model="account.invoice.line" name="_onchange_product_id"
|
||||
eval="[ref('demo_invoice_ae_line5')]"/>
|
||||
<function model="account.invoice" name="_onchange_invoice_line_ids"
|
||||
eval="[ref('demo_invoice_ae_5')]"/>
|
||||
<function model="account.invoice" name="_get_total_amount"
|
||||
eval="[ref('demo_invoice_ae_5')]"/>
|
||||
<function model="account.invoice" name="action_invoice_open"
|
||||
eval="[ref('demo_invoice_ae_5')]"/>
|
||||
|
||||
<record id="demo_invoice_ae_6" model="account.invoice">
|
||||
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
||||
<field name="currency_id" ref="base.AED"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="type">in_refund</field>
|
||||
<field name="date_invoice" eval="DateTime.today().strftime('%Y-%m-01')"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="journal_id" ref="l10n_ae_extend.local_purchase_journal"/>
|
||||
<field name="vat_config_type" ref="l10n_ae_extend.config_type_5"/>
|
||||
<field name="reverse_charge" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_invoice_ae_line6" model="account.invoice.line">
|
||||
<field name="invoice_id" ref="demo_invoice_ae_6"/>
|
||||
<field name="name">Graphics Card</field>
|
||||
<field name="product_id" ref="product.product_product_24"/>
|
||||
<field name="account_id" ref="l10n_ae_extend.local_sale_uae_account"/>
|
||||
<field name="price_unit">876.0</field>
|
||||
<field name="quantity">5.0</field>
|
||||
</record>
|
||||
|
||||
<function model="account.invoice.line" name="_onchange_product_id"
|
||||
eval="[ref('demo_invoice_ae_line6')]"/>
|
||||
<function model="account.invoice" name="_onchange_invoice_line_ids"
|
||||
eval="[ref('demo_invoice_ae_6')]"/>
|
||||
<function model="account.invoice" name="_get_total_amount"
|
||||
eval="[ref('demo_invoice_ae_6')]"/>
|
||||
<function model="account.invoice" name="action_invoice_open"
|
||||
eval="[ref('demo_invoice_ae_6')]"/>
|
||||
|
||||
</flectra>
|
7
addons/l10n_ae_extend/models/__init__.py
Normal file
7
addons/l10n_ae_extend/models/__init__.py
Normal file
@ -0,0 +1,7 @@
|
||||
# Part of flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import vat_config_type
|
||||
from . import company
|
||||
from . import sale
|
||||
from . import purchase
|
||||
from . import account_invoice
|
191
addons/l10n_ae_extend/models/account_invoice.py
Normal file
191
addons/l10n_ae_extend/models/account_invoice.py
Normal file
@ -0,0 +1,191 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra import fields, models, api, _
|
||||
from flectra.exceptions import Warning
|
||||
|
||||
|
||||
class ReverseAccountInvoiceTax(models.Model):
|
||||
_inherit = 'account.invoice.tax'
|
||||
_name = 'reverse.account.invoice.tax'
|
||||
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
@api.multi
|
||||
def _default_config_type(self):
|
||||
domain = []
|
||||
if self._context.get('type', False) in ['out_invoice', 'out_refund']:
|
||||
domain = [('journal_id.type', '=', 'sale')]
|
||||
elif self._context.get('type', False) in ['in_invoice', 'in_refund']:
|
||||
domain = [('journal_id.type', '=', 'purchase')]
|
||||
return self.vat_config_type.search(domain, limit=1)
|
||||
|
||||
vat_config_type = fields.Many2one(
|
||||
'vat.config.type', 'Vat Type', default=_default_config_type,
|
||||
readonly=True, states={'draft': [('readonly', False)]})
|
||||
reverse_charge = fields.Boolean(
|
||||
'Reverse Charge', readonly=True,
|
||||
states={'draft': [('readonly', False)]})
|
||||
reverse_tax_line_ids = fields.One2many(
|
||||
'reverse.account.invoice.tax', 'invoice_id', string='Tax Lines',
|
||||
readonly=True, states={'draft': [('readonly', False)]}, copy=False)
|
||||
|
||||
@api.onchange('vat_config_type')
|
||||
def onchange_vat_config_type(self):
|
||||
if self.vat_config_type:
|
||||
self.journal_id = self.vat_config_type.journal_id.id
|
||||
if self.vat_config_type.vat_type == 'designated_zone_purchase':
|
||||
fiscal_position_id = self.fiscal_position_id.search(
|
||||
[('name', 'ilike', 'exempt')], limit=1)
|
||||
if not fiscal_position_id:
|
||||
fiscal_position_id = self.env.ref('l10n_ae.fp_in_exempted')
|
||||
else:
|
||||
fiscal_position_id = fiscal_position_id.id
|
||||
self.fiscal_position_id = fiscal_position_id
|
||||
else:
|
||||
self.journal_id = self._default_journal()
|
||||
|
||||
@api.one
|
||||
@api.depends(
|
||||
'state', 'currency_id', 'invoice_line_ids.price_subtotal',
|
||||
'move_id.line_ids.amount_residual',
|
||||
'move_id.line_ids.currency_id')
|
||||
def _compute_residual(self):
|
||||
super(AccountInvoice, self)._compute_residual()
|
||||
sign = self.type in ['in_refund', 'out_refund'] and -1 or 1
|
||||
if self.reverse_charge:
|
||||
residual = self.residual - self.amount_tax
|
||||
self.residual_signed = abs(residual) * sign
|
||||
self.residual = abs(residual)
|
||||
|
||||
@api.multi
|
||||
def action_invoice_open(self):
|
||||
if not self.reverse_charge:
|
||||
return super(AccountInvoice, self).action_invoice_open()
|
||||
if not self.company_id.rc_vat_account_id:
|
||||
raise Warning(_('Define Reverse Charge Account in Company!'))
|
||||
list_data = []
|
||||
account_tax_obj = self.env['account.tax']
|
||||
custom_amount = 0.0
|
||||
self.reverse_tax_line_ids = [[6, 0, []]]
|
||||
for tax_line in self.tax_line_ids:
|
||||
tax_id = account_tax_obj.search([('name', 'ilike', tax_line.name)])
|
||||
custom_amount += \
|
||||
tax_line.amount_total if tax_id.tax_type == 'customs' else 0.0
|
||||
account_id = tax_id.account_id.id
|
||||
if self.partner_id.vat:
|
||||
account_id = tax_line.account_id.id
|
||||
elif tax_id.tax_type == 'vat':
|
||||
account_id = self.company_id.vat_expense_account_id.id
|
||||
list_data.append((0, 0, {
|
||||
'name': tax_line.name,
|
||||
'partner_id':
|
||||
self.partner_id.parent_id.id or self.partner_id.id,
|
||||
'account_id': account_id,
|
||||
'debit': tax_line.amount_total,
|
||||
'move_id': False,
|
||||
'invoice_id': self.id,
|
||||
'tax_line_id': tax_id,
|
||||
'quantity': 1,
|
||||
}
|
||||
))
|
||||
|
||||
total_tax_amount = self.amount_tax
|
||||
reverse_list_data = []
|
||||
for tax_line_id in self.tax_line_ids:
|
||||
reverse_list_data.append((0, 0, tax_line_id.read()[0]))
|
||||
|
||||
if reverse_list_data:
|
||||
self.update({'reverse_tax_line_ids': reverse_list_data})
|
||||
for line_id in self.invoice_line_ids:
|
||||
line_id.reverse_invoice_line_tax_ids = \
|
||||
[[6, 0, line_id.invoice_line_tax_ids.ids]]
|
||||
|
||||
self.invoice_line_ids.update({'invoice_line_tax_ids': [[6, 0, []]]})
|
||||
self.update({'tax_line_ids': [[6, 0, []]], 'amount_tax': 0.0})
|
||||
res = super(AccountInvoice, self).action_invoice_open()
|
||||
|
||||
for move_line_id in list_data:
|
||||
move_line_id[2].update({'move_id': self.move_id.id})
|
||||
list_data.append(
|
||||
(0, 0, self.get_move_line_vals(total_tax_amount - custom_amount)))
|
||||
if custom_amount:
|
||||
list_data.append((0, 0, self.get_move_line_vals(custom_amount)))
|
||||
self.move_id.state = 'draft'
|
||||
self.move_id.line_ids = list_data
|
||||
self.move_id.post()
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def get_move_line_vals(self, credit):
|
||||
return {
|
||||
'name': '/',
|
||||
'partner_id': self.partner_id.parent_id.id or self.partner_id.id,
|
||||
'account_id': self.company_id.rc_vat_account_id.id,
|
||||
'credit': credit,
|
||||
'move_id': self.move_id.id,
|
||||
'invoice_id': self.id,
|
||||
'quantity': 1,
|
||||
}
|
||||
|
||||
@api.onchange('purchase_id')
|
||||
def purchase_order_change(self):
|
||||
if self.purchase_id:
|
||||
self.vat_config_type = self.purchase_id.vat_config_type.id
|
||||
self.reverse_charge = self.purchase_id.reverse_charge
|
||||
return super(AccountInvoice, self).purchase_order_change()
|
||||
|
||||
@api.onchange('partner_id', 'company_id')
|
||||
def _onchange_partner_id(self):
|
||||
res = super(AccountInvoice, self)._onchange_partner_id()
|
||||
self.journal_id = self.vat_config_type.journal_id.id
|
||||
return res
|
||||
|
||||
@api.onchange('state', 'partner_id', 'invoice_line_ids',
|
||||
'vat_config_type', 'reverse_charge')
|
||||
def _onchange_allowed_purchase_ids(self):
|
||||
result = super(AccountInvoice, self)._onchange_allowed_purchase_ids()
|
||||
result['domain']['purchase_id'] += [
|
||||
('vat_config_type', '=', self.vat_config_type.id),
|
||||
('reverse_charge', '=', self.reverse_charge)]
|
||||
return result
|
||||
|
||||
@api.onchange('fiscal_position_id')
|
||||
def _onchange_fiscal_position_id(self):
|
||||
if self.fiscal_position_id:
|
||||
for line in self.invoice_line_ids:
|
||||
line._set_taxes()
|
||||
|
||||
@api.multi
|
||||
@api.returns('self')
|
||||
def refund(self, date_invoice=None,
|
||||
date=None, description=None, journal_id=None):
|
||||
result = super(AccountInvoice, self).refund(
|
||||
date_invoice=date_invoice, date=date,
|
||||
description=description, journal_id=journal_id)
|
||||
result.write({
|
||||
'vat_config_type': result.refund_invoice_id.vat_config_type.id})
|
||||
if result.refund_invoice_id.type == 'in_invoice':
|
||||
result.write(
|
||||
{'reverse_charge': result.refund_invoice_id.reverse_charge})
|
||||
if result.type == 'in_refund' \
|
||||
and result.refund_invoice_id.reverse_charge:
|
||||
for index, line_id in enumerate(result.invoice_line_ids):
|
||||
line_id.invoice_line_tax_ids = [[
|
||||
6, 0, result.refund_invoice_id.invoice_line_ids[
|
||||
index].reverse_invoice_line_tax_ids.ids]]
|
||||
result._onchange_invoice_line_ids()
|
||||
return result
|
||||
|
||||
|
||||
class AccountInvoiceLine(models.Model):
|
||||
_inherit = "account.invoice.line"
|
||||
|
||||
reverse_invoice_line_tax_ids = fields.Many2many(
|
||||
'account.tax', string='Taxes', copy=False)
|
||||
|
||||
@api.v8
|
||||
def get_invoice_line_account(self, type, product, fpos, company):
|
||||
return self.invoice_id.vat_config_type.\
|
||||
journal_id.default_debit_account_id
|
12
addons/l10n_ae_extend/models/company.py
Normal file
12
addons/l10n_ae_extend/models/company.py
Normal file
@ -0,0 +1,12 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra import fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
rc_vat_account_id = fields.Many2one('account.account', 'Reverse Charge')
|
||||
customs_duty_account_id = fields.Many2one(
|
||||
'account.account', 'Customs Expense')
|
||||
vat_expense_account_id = fields.Many2one('account.account', 'Vat Expense')
|
19
addons/l10n_ae_extend/models/purchase.py
Normal file
19
addons/l10n_ae_extend/models/purchase.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra import fields, models, api
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
@api.multi
|
||||
def _default_config_type(self):
|
||||
return self.vat_config_type.search([
|
||||
('journal_id.type', '=', 'purchase')], limit=1)
|
||||
|
||||
vat_config_type = fields.Many2one(
|
||||
'vat.config.type', 'Vat Type', default=_default_config_type,
|
||||
readonly=True, states={'draft': [('readonly', False)]})
|
||||
reverse_charge = fields.Boolean(
|
||||
'Reverse Charge', readonly=True,
|
||||
states={'draft': [('readonly', False)]})
|
27
addons/l10n_ae_extend/models/sale.py
Normal file
27
addons/l10n_ae_extend/models/sale.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra import fields, models, api
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
@api.multi
|
||||
def _default_config_type(self):
|
||||
return self.vat_config_type.search([
|
||||
('journal_id.type', '=', 'sale')], limit=1)
|
||||
|
||||
vat_config_type = fields.Many2one(
|
||||
'vat.config.type', 'Vat Type', default=_default_config_type,
|
||||
readonly=True, states={'draft': [('readonly', False)]})
|
||||
|
||||
@api.multi
|
||||
def _prepare_invoice(self):
|
||||
invoice_vals = super(SaleOrder, self)._prepare_invoice()
|
||||
invoice_vals.update({
|
||||
'vat_config_type': self.vat_config_type.id,
|
||||
'journal_id': self.vat_config_type.journal_id.id,
|
||||
'account_id':
|
||||
self.vat_config_type.journal_id.default_debit_account_id.id,
|
||||
})
|
||||
return invoice_vals
|
23
addons/l10n_ae_extend/models/vat_config_type.py
Normal file
23
addons/l10n_ae_extend/models/vat_config_type.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra import fields, models
|
||||
|
||||
|
||||
class JournalConfigType(models.Model):
|
||||
_name = 'vat.config.type'
|
||||
_description = 'Config Type'
|
||||
|
||||
name = fields.Char('Name')
|
||||
code = fields.Char('Code')
|
||||
journal_id = fields.Many2one('account.journal', 'Journal')
|
||||
vat_type = fields.Selection([
|
||||
('local_sale', 'Local Sale'),
|
||||
('inside_gcc_sale', 'Inside GCC Sale'),
|
||||
('outside_gcc_sale', 'Outside GCC Sale'),
|
||||
('designated_zone_sale', 'Designated Zone Sale'),
|
||||
('local_purchase', 'Local Purchase'),
|
||||
('inside_gcc_purchase', 'Inside GCC Purchase'),
|
||||
('outside_gcc_purchase', 'Outside GCC Purchase'),
|
||||
('designated_zone_purchase', 'Designated Zone Purchase')])
|
||||
type = fields.Selection([
|
||||
('sale', 'Sale'), ('purchase', 'Purchase')], 'Type')
|
3
addons/l10n_ae_extend/reports/__init__.py
Normal file
3
addons/l10n_ae_extend/reports/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import vat_201_report
|
201
addons/l10n_ae_extend/reports/vat_201_report.py
Normal file
201
addons/l10n_ae_extend/reports/vat_201_report.py
Normal file
@ -0,0 +1,201 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
|
||||
from flectra import api, models
|
||||
|
||||
VAT_SALE_TYPE = ['local_sale', 'inside_gcc_sale',
|
||||
'outside_gcc_sale', 'designated_zone_sale']
|
||||
VAT_PURCHASE_TYPE = ['local_purchase', 'inside_gcc_purchase',
|
||||
'outside_gcc_purchase', 'designated_zone_purchase']
|
||||
|
||||
|
||||
class ReportVat201(models.AbstractModel):
|
||||
_name = 'report.l10n_ae_extend.vat_201'
|
||||
|
||||
def get_invoice_ids(self, data, invoice_type, vat_type, reverse_charge):
|
||||
return self.env['account.invoice'].search([
|
||||
('date_invoice', '<=', data['form']['date_to']),
|
||||
('date_invoice', '>=', data['form']['date_from']),
|
||||
('state', 'in', ['open', 'paid']),
|
||||
('type', 'in', invoice_type),
|
||||
('vat_config_type.vat_type', 'in', vat_type),
|
||||
('reverse_charge', '=', reverse_charge)])
|
||||
|
||||
def get_local_sale(self, data):
|
||||
return self.get_invoice_data_for_local(data, ['local_sale'])
|
||||
|
||||
def get_inside_gcc_sale(self, data):
|
||||
return self.get_invoice_data_for_local(data, ['inside_gcc_sale'])
|
||||
|
||||
def get_outside_gcc_sale(self, data):
|
||||
return self.get_invoice_data_for_local(data, ['outside_gcc_sale'])
|
||||
|
||||
def get_designated_zone_sale(self, data):
|
||||
return self.get_invoice_data_for_local(data, VAT_SALE_TYPE)
|
||||
|
||||
def get_total_sale(self, data):
|
||||
return self.get_invoice_data_for_local(data, VAT_SALE_TYPE)
|
||||
|
||||
def get_subtotal(self, line, tax_ids):
|
||||
return line.price_subtotal if any(
|
||||
[tax_id for tax_id in tax_ids
|
||||
if tax_id.tax_type == 'vat' and tax_id.amount != 0.0]) else 0.0
|
||||
|
||||
def get_customs_amount(self, tax_ids):
|
||||
account_tax_object = self.env['account.tax']
|
||||
customs_amount = 0.0
|
||||
for tax_line_id in tax_ids:
|
||||
tax_id = account_tax_object.search([
|
||||
('name', '=', tax_line_id.name), ('tax_type', '=', 'customs')])
|
||||
customs_amount += tax_line_id.amount_total if tax_id else 0.0
|
||||
return customs_amount
|
||||
|
||||
def get_tax_amount(self, tax_ids):
|
||||
return sum([tax_id.amount for tax_id in tax_ids
|
||||
if tax_id.tax_id.tax_type == 'vat'])
|
||||
|
||||
def get_invoice_data_for_local(self, data, vat_type):
|
||||
invoices = self.get_invoice_ids(
|
||||
data, ['out_invoice', 'out_refund'], vat_type, False)
|
||||
data_dict = {
|
||||
'amount': 0.0, 'total_exempted_amount': 0.0,
|
||||
'total_exempted_adjustment': 0.0, 'adjustment': 0.0,
|
||||
'tax_amount': 0.0, 'return_tax_amount': 0.0,
|
||||
'total_zero_amount': 0.0, 'zero_adjustment': 0.0}
|
||||
for invoice_id in invoices:
|
||||
check_line_vat_tax = 0.0
|
||||
tax_amount = self.get_tax_amount(invoice_id.tax_line_ids)
|
||||
for line in invoice_id.invoice_line_ids:
|
||||
data_dict.update(
|
||||
self.set_zero_exempted_amount(
|
||||
data_dict, invoice_id, line,
|
||||
line.invoice_line_tax_ids))
|
||||
check_line_vat_tax += \
|
||||
self.get_subtotal(line, line.invoice_line_tax_ids)
|
||||
check_line_vat_tax += \
|
||||
self.get_customs_amount(invoice_id.tax_line_ids)
|
||||
if invoice_id.type == 'out_refund':
|
||||
data_dict['adjustment'] += check_line_vat_tax
|
||||
data_dict['return_tax_amount'] += tax_amount
|
||||
else:
|
||||
data_dict['amount'] += check_line_vat_tax
|
||||
data_dict['tax_amount'] += tax_amount
|
||||
return data_dict
|
||||
|
||||
def set_zero_exempted_amount(
|
||||
self, data_dict, invoice_id, line, tax_line_ids):
|
||||
for tax_id in tax_line_ids:
|
||||
if tax_id.amount == 0.0:
|
||||
if invoice_id.type in ['out_invoice', 'in_invoice']:
|
||||
data_dict['total_exempted_amount'] += \
|
||||
line.price_subtotal \
|
||||
if tax_id.tax_type == 'exempted' else 0.0
|
||||
data_dict['total_zero_amount'] += \
|
||||
line.price_subtotal \
|
||||
if tax_id.tax_type != 'exempted' else 0.0
|
||||
elif invoice_id.type in ['out_refund', 'in_refund']:
|
||||
data_dict['total_exempted_adjustment'] += \
|
||||
line.price_subtotal \
|
||||
if tax_id.tax_type == 'exempted' else 0.0
|
||||
data_dict['zero_adjustment'] += \
|
||||
line.price_subtotal \
|
||||
if tax_id.tax_type != 'exempted' else 0.0
|
||||
return data_dict
|
||||
|
||||
def get_invoice_data_for_local_purchase(self, data, vat_type):
|
||||
invoices = self.get_invoice_ids(
|
||||
data, ['in_invoice', 'in_refund'], vat_type, False)
|
||||
return self.get_data(invoices)
|
||||
|
||||
def get_data(self, invoices):
|
||||
data_dict = {
|
||||
'amount': 0.0, 'total_exempted_amount': 0.0,
|
||||
'total_exempted_adjustment': 0.0, 'adjustment': 0.0,
|
||||
'tax_amount': 0.0, 'return_tax_amount': 0.0,
|
||||
'total_zero_amount': 0.0, 'zero_adjustment': 0.0}
|
||||
for invoice_id in invoices:
|
||||
check_line_vat_tax = 0.0
|
||||
invoice_tax_lines = invoice_id.tax_line_ids
|
||||
if invoice_id.reverse_charge:
|
||||
invoice_tax_lines = invoice_id.reverse_tax_line_ids
|
||||
tax_amount = self.get_tax_amount(invoice_tax_lines)
|
||||
|
||||
for line in invoice_id.invoice_line_ids:
|
||||
tax_line_ids = line.invoice_line_tax_ids
|
||||
if invoice_id.reverse_charge:
|
||||
tax_line_ids = line.reverse_invoice_line_tax_ids
|
||||
data_dict.update(self.set_zero_exempted_amount(
|
||||
data_dict, invoice_id, line, tax_line_ids))
|
||||
check_line_vat_tax += self.get_subtotal(line, tax_line_ids)
|
||||
check_line_vat_tax += \
|
||||
self.get_customs_amount(invoice_id.tax_line_ids)
|
||||
if invoice_id.type == 'in_refund':
|
||||
data_dict['adjustment'] += check_line_vat_tax
|
||||
data_dict['return_tax_amount'] += tax_amount
|
||||
else:
|
||||
data_dict['amount'] += check_line_vat_tax
|
||||
data_dict['tax_amount'] += tax_amount
|
||||
return data_dict
|
||||
|
||||
def get_local_purchase(self, data):
|
||||
return self.get_invoice_data_for_local_purchase(
|
||||
data, ['local_purchase'])
|
||||
|
||||
def get_inside_outside_gcc_purchase(self, data):
|
||||
return self.get_invoice_data_for_local_purchase(
|
||||
data, ['inside_gcc_purchase', 'outside_gcc_purchase'])
|
||||
|
||||
def get_zero_vat_purchase(self, data):
|
||||
return self.get_invoice_data_for_local_purchase(
|
||||
data, VAT_PURCHASE_TYPE)
|
||||
|
||||
def get_total_purchase(self, data):
|
||||
reverse_dict = self.get_reverse_charge_data(data)
|
||||
all_type_dict = self.get_invoice_data_for_local_purchase(
|
||||
data, VAT_PURCHASE_TYPE)
|
||||
all_type_dict['amount'] += \
|
||||
reverse_dict['amount'] + all_type_dict['total_zero_amount'] + \
|
||||
all_type_dict['total_exempted_amount']
|
||||
all_type_dict['tax_amount'] += reverse_dict['tax_amount']
|
||||
all_type_dict['return_tax_amount'] += reverse_dict['return_tax_amount']
|
||||
all_type_dict['adjustment'] += \
|
||||
reverse_dict['adjustment'] + all_type_dict['zero_adjustment'] + \
|
||||
all_type_dict['total_exempted_adjustment']
|
||||
return all_type_dict
|
||||
|
||||
def get_reverse_charge_data(self, data):
|
||||
invoices = self.get_invoice_ids(
|
||||
data, ['in_invoice', 'in_refund'], VAT_PURCHASE_TYPE, True)
|
||||
return self.get_data(invoices)
|
||||
|
||||
def get_total_vat_due(self, data):
|
||||
sale_data = self.get_total_sale(data)
|
||||
purchase_data = self.get_total_purchase(data)
|
||||
vals = {
|
||||
'total_tax_amount':
|
||||
(sale_data['tax_amount'] - sale_data['return_tax_amount']
|
||||
) - (purchase_data['tax_amount'] - purchase_data[
|
||||
'return_tax_amount'])}
|
||||
return vals
|
||||
|
||||
@api.model
|
||||
def get_report_values(self, docids, data=None):
|
||||
currency_id = \
|
||||
self.env['res.currency'].browse(data['form']['currency_id'][0])
|
||||
return {
|
||||
'data': data,
|
||||
'currency_name': currency_id.name,
|
||||
'get_local_sale': self.get_local_sale(data),
|
||||
'get_inside_gcc_sale': self.get_inside_gcc_sale(data),
|
||||
'get_outside_gcc_sale': self.get_outside_gcc_sale(data),
|
||||
'get_designated_zone_sale': self.get_designated_zone_sale(data),
|
||||
'get_total_sale': self.get_total_sale(data),
|
||||
'get_local_purchase': self.get_local_purchase(data),
|
||||
'get_inside_outside_gcc_purchase':
|
||||
self.get_inside_outside_gcc_purchase(data),
|
||||
'get_zero_vat_purchase': self.get_zero_vat_purchase(data),
|
||||
'get_total_purchase': self.get_total_purchase(data),
|
||||
'get_total_vat_due': self.get_total_vat_due(data),
|
||||
'get_reverse_charge_data': self.get_reverse_charge_data(data),
|
||||
'currency_id': currency_id,
|
||||
}
|
3
addons/l10n_ae_extend/security/ir.model.access.csv
Normal file
3
addons/l10n_ae_extend/security/ir.model.access.csv
Normal file
@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_vat_config_type,access_vat_config_type,model_vat_config_type,,1,0,0,0
|
||||
access_reverse_account_invoice_tax,access_reverse_account_invoice_tax,model_reverse_account_invoice_tax,,1,0,0,0
|
|
BIN
addons/l10n_ae_extend/static/description/icon.png
Normal file
BIN
addons/l10n_ae_extend/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 448 B |
4
addons/l10n_ae_extend/tests/__init__.py
Normal file
4
addons/l10n_ae_extend/tests/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# Part of Flectra See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_ae_common
|
||||
from . import test_account_invoice
|
100
addons/l10n_ae_extend/tests/test_account_invoice.py
Normal file
100
addons/l10n_ae_extend/tests/test_account_invoice.py
Normal file
@ -0,0 +1,100 @@
|
||||
# Part of Flectra See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from .test_ae_common import TestAECommon
|
||||
import time
|
||||
import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
class TestAccountInvoice(TestAECommon):
|
||||
def setUp(self):
|
||||
super(TestAccountInvoice, self).setUp()
|
||||
|
||||
def get_invoice(self, invoice_type, reverse_charge):
|
||||
invoice_id = self.AccountInvoice.create({
|
||||
'name': 'Test Customer Invoice',
|
||||
'partner_id': self.partner_id.id,
|
||||
'currency_id': self.env.ref('base.USD').id,
|
||||
'account_id': self.account_id.id,
|
||||
'type': invoice_type,
|
||||
'date_invoice': time.strftime('%Y') + '-03-12',
|
||||
'journal_id': self.journal_id.id,
|
||||
'vat_config_type': self.config_type_local_sale.id,
|
||||
'reverse_charge': reverse_charge,
|
||||
})
|
||||
self.AccountInvoiceLine.create({
|
||||
'product_id': self.product_id.id,
|
||||
'quantity': 10,
|
||||
'price_unit': 885.00,
|
||||
'invoice_id': invoice_id.id,
|
||||
'name': 'Graphics Card',
|
||||
'account_id': self.account_id.id,
|
||||
})
|
||||
return invoice_id
|
||||
|
||||
def test_customer_invoice(self):
|
||||
invoice_id = self.get_invoice('out_invoice', False)
|
||||
line_1 = invoice_id.invoice_line_ids[0]
|
||||
line_1.get_invoice_line_account(
|
||||
'out_invoice', self.product_id, False, self.main_company)
|
||||
self.assertEquals(
|
||||
line_1.account_id,
|
||||
invoice_id.vat_config_type.journal_id.default_debit_account_id)
|
||||
self.assertEquals(
|
||||
invoice_id.journal_id, invoice_id.vat_config_type.journal_id)
|
||||
|
||||
def test_vendor_bills(self):
|
||||
invoice_id = self.get_invoice('in_invoice', True)
|
||||
line_1 = invoice_id.invoice_line_ids[0]
|
||||
line_1._onchange_product_id()
|
||||
invoice_id._onchange_invoice_line_ids()
|
||||
amount_tax = invoice_id.amount_tax
|
||||
self.assertEquals(len(invoice_id.tax_line_ids), 1)
|
||||
self.assertEquals(len(invoice_id.reverse_tax_line_ids), 0)
|
||||
invoice_id.action_invoice_open()
|
||||
self.assertEquals(invoice_id.amount_tax, 0)
|
||||
self.assertEquals(len(invoice_id.tax_line_ids), 0)
|
||||
self.assertEquals(len(invoice_id.reverse_tax_line_ids), 1)
|
||||
move_line_id = self.env['account.move.line'].search([
|
||||
('move_id', '=', invoice_id.move_id.id),
|
||||
('account_id', '=', self.main_company.rc_vat_account_id.id)])
|
||||
self.assertEquals(move_line_id.credit, amount_tax)
|
||||
|
||||
def test_report_data(self):
|
||||
report_obj = self.env['report.l10n_ae_extend.vat_201']
|
||||
date_to = (datetime.date.today() - relativedelta(days=10)
|
||||
).strftime('%Y-%m-%d')
|
||||
date_from = (datetime.date.today() - relativedelta(months=1)
|
||||
).strftime('%Y-%m-01')
|
||||
data = {'form': {
|
||||
'date_to': date_to,
|
||||
'date_from': date_from,
|
||||
'company_id': [self.main_company.id, self.main_company.name],
|
||||
'currency_id': [self.main_company.currency_id.id,
|
||||
self.main_company.currency_id.name],
|
||||
}}
|
||||
dict_data = report_obj.get_report_values(None, data)
|
||||
|
||||
self.assertEquals(
|
||||
dict_data['get_local_sale']['amount'], 1770)
|
||||
self.assertEquals(dict_data['get_local_sale']['tax_amount'], 88.5)
|
||||
self.assertEquals(dict_data['get_local_sale']['adjustment'], 885)
|
||||
self.assertEquals(
|
||||
dict_data['get_local_sale']['return_tax_amount'], 44.25)
|
||||
|
||||
self.assertEquals(dict_data['get_local_purchase']['amount'], 17520)
|
||||
self.assertEquals(dict_data['get_local_purchase']['tax_amount'], 876)
|
||||
self.assertEquals(dict_data['get_local_purchase']['adjustment'], 8760)
|
||||
self.assertEquals(
|
||||
dict_data['get_local_purchase']['return_tax_amount'], 438)
|
||||
|
||||
self.assertEquals(
|
||||
dict_data['get_reverse_charge_data']['amount'], 17520)
|
||||
self.assertEquals(
|
||||
dict_data['get_reverse_charge_data']['tax_amount'], 876)
|
||||
self.assertEquals(
|
||||
dict_data['get_reverse_charge_data']['adjustment'], 4380)
|
||||
self.assertEquals(
|
||||
dict_data['get_reverse_charge_data']['return_tax_amount'], 219)
|
||||
self.assertEquals(
|
||||
dict_data['get_total_vat_due']['total_tax_amount'], -1050.75)
|
27
addons/l10n_ae_extend/tests/test_ae_common.py
Normal file
27
addons/l10n_ae_extend/tests/test_ae_common.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Part of Flectra See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestAECommon(TransactionCase):
|
||||
def setUp(self):
|
||||
super(TestAECommon, self).setUp()
|
||||
|
||||
self.AccountInvoice = self.env['account.invoice']
|
||||
self.AccountInvoiceLine = self.env['account.invoice.line']
|
||||
self.config_type_local_sale = \
|
||||
self.env.ref('l10n_ae_extend.config_type_1')
|
||||
self.config_type_inside_gcc = \
|
||||
self.env.ref('l10n_ae_extend.config_type_2')
|
||||
self.main_company = self.env.ref('base.main_company')
|
||||
|
||||
self.partner_id = self.env.ref('base.res_partner_3')
|
||||
self.account_id = self.env.ref('l10n_ae_extend.local_sale_uae_account')
|
||||
self.journal_id = self.env.ref('l10n_ae_extend.local_sale_journal')
|
||||
self.product_id = self.env.ref('product.product_product_24')
|
||||
|
||||
self.customer_tax_id = self.env.ref('l10n_ae.sale_uae_vat_5')
|
||||
self.supplier_tax_id = self.env.ref('l10n_ae.purchase_uae_vat_5')
|
||||
self.product_id.write({
|
||||
'taxes_id': [(6, 0, [self.customer_tax_id.id])],
|
||||
'supplier_taxes_id': [(6, 0, [self.supplier_tax_id.id])]})
|
66
addons/l10n_ae_extend/views/account_invoice_view.xml
Normal file
66
addons/l10n_ae_extend/views/account_invoice_view.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<record id="uae_account_invoice_form_inherit" model="ir.ui.view">
|
||||
<field name="name">uae.account.invoice.form.inherit</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="vat_config_type" domain="[('journal_id.type', '=', 'sale')]"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='fiscal_position_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='date_due']" position="after">
|
||||
<field name="fiscal_position_id" options="{'no_create': True}" placeholder="Auto-detect"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_reverse_invoice_tax_tree" model="ir.ui.view">
|
||||
<field name="name">reverse.account.invoice.tax.tree</field>
|
||||
<field name="model">reverse.account.invoice.tax</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Reverse Invoice Taxes">
|
||||
<field name="name"/>
|
||||
<field name="account_id" groups="account.group_account_user"/>
|
||||
<field name="base"/>
|
||||
<field name="amount_total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="uae_account_invoice_supplier_form_inherit" model="ir.ui.view">
|
||||
<field name="name">uae.account.invoice.supplier.form.inherit</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="vat_config_type" domain="[('journal_id.type', '=', 'purchase')]"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='fiscal_position_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='date_due']" position="after">
|
||||
<field name="fiscal_position_id" options="{'no_create': True}" placeholder="Auto-detect"/>
|
||||
<field name="reverse_charge" attrs="{'invisible': [('type', 'in', ['out_invoice', 'out_refund'])]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[@name='other_info']" position="after">
|
||||
<page string="Reverse Charge" name="reverse_charge_info" attrs="{'invisible': [('reverse_charge', '=', False)]}">
|
||||
<field name="reverse_tax_line_ids" nolabel="1"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//field/tree/field[@name='invoice_line_tax_ids']" position="after">
|
||||
<field name="reverse_invoice_line_tax_ids" widget="many2many_tags" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="uae_account_tax_form_inherit" model="ir.ui.view">
|
||||
<field name="name">uae.account.tax.form.inherit</field>
|
||||
<field name="model">account.tax</field>
|
||||
<field name="inherit_id" ref="account.view_tax_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='type_tax_use']" position="after">
|
||||
<field name="tax_type"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</flectra>
|
16
addons/l10n_ae_extend/views/company_view.xml
Normal file
16
addons/l10n_ae_extend/views/company_view.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<record id="uae_res_company_form_inherit" model="ir.ui.view">
|
||||
<field name="name">uae.res.company.form.inherit</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='report_header']" position="after">
|
||||
<field name="rc_vat_account_id" required="1"/>
|
||||
<field name="customs_duty_account_id" required="1"/>
|
||||
<field name="vat_expense_account_id" required="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</flectra>
|
||||
|
16
addons/l10n_ae_extend/views/purchase_order_view.xml
Normal file
16
addons/l10n_ae_extend/views/purchase_order_view.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<record id="uae_purchase_order_form_inherit" model="ir.ui.view">
|
||||
<field name="name">uae.purchase.order.form.inherit</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="vat_config_type" domain="[('journal_id.type', '=', 'purchase')]"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<field name="reverse_charge"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</flectra>
|
11
addons/l10n_ae_extend/views/report_menu_view.xml
Normal file
11
addons/l10n_ae_extend/views/report_menu_view.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<report
|
||||
id="action_report_vat_201"
|
||||
model="vat.201.report"
|
||||
string="Vat 201"
|
||||
report_type="qweb-pdf"
|
||||
name="l10n_ae_extend.vat_201"
|
||||
file="l10n_ae_extend.vat_201"
|
||||
/>
|
||||
</flectra>
|
131
addons/l10n_ae_extend/views/report_vat_201_view.xml
Normal file
131
addons/l10n_ae_extend/views/report_vat_201_view.xml
Normal file
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<template id="vat_201">
|
||||
<t t-call="web.html_container">
|
||||
<t t-call="web.internal_layout">
|
||||
<div class="page">
|
||||
<h3 align="center">VAT 201</h3>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<t t-if="data['form']['date_from']"><strong>From</strong> <span t-esc="data['form']['date_from']"/><br/></t>
|
||||
<t t-if="data['form']['date_to']"><strong>To </strong><span t-esc="data['form']['date_to']"/></t>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="3%"></th>
|
||||
<th width="52%" class="text-center"></th>
|
||||
<th width="15%" class="text-center">Amount(<span t-esc="currency_name"/>)</th>
|
||||
<th width="15%" class="text-center">Adjustment(<span t-esc="currency_name"/>)</th>
|
||||
<th width="15%" class="text-center">VAT(<span t-esc="currency_name"/>)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td rowspan="6" style="font-size: 14px; letter-spacing: 1px;">VAT on Sales</td>
|
||||
<td class="success">Standard rated sales</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_local_sale.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_local_sale.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_local_sale.get('tax_amount') - get_local_sale.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="success">Sales to customers in VAT implementing GCC Countries</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_inside_gcc_sale.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_inside_gcc_sale.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_inside_gcc_sale.get('tax_amount') - get_inside_gcc_sale.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="success">Zero rated domestic sales</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_designated_zone_sale.get('total_zero_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_designated_zone_sale.get('zero_adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="0.0" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="success">Exports</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_outside_gcc_sale.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_outside_gcc_sale.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_outside_gcc_sale.get('tax_amount') - get_outside_gcc_sale.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="success">Exempte sales</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_designated_zone_sale.get('total_exempted_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_designated_zone_sale.get('total_exempted_adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="0.0" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="success">Total sales</td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_sale.get('amount') + get_total_sale.get('total_zero_amount') + get_total_sale.get('total_exempted_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_sale.get('adjustment') + get_total_sale.get('zero_adjustment') + get_total_sale.get('total_exempted_adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_sale.get('tax_amount') - get_total_sale.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b><br/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="6" style="font-size: 14px; letter-spacing: 1px;">VAT on Purchas</td>
|
||||
<td class="danger">Standard rated domestic purchases</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_local_purchase.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_local_purchase.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_local_purchase.get('tax_amount') - get_local_purchase.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="danger">Imports subject to VAT paid at customs</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_inside_outside_gcc_purchase.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_inside_outside_gcc_purchase.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_inside_outside_gcc_purchase.get('tax_amount') - get_inside_outside_gcc_purchase.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="danger">Imports subject to VAT accounted for through reverse charge mechanism</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_reverse_charge_data.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_reverse_charge_data.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_reverse_charge_data.get('tax_amount') - get_reverse_charge_data.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="danger">Zero rated purchases</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_zero_vat_purchase.get('total_zero_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_zero_vat_purchase.get('zero_adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="0.0" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="danger">Exempte purchases</td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_zero_vat_purchase.get('total_exempted_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="get_zero_vat_purchase.get('total_exempted_adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
<td class="text-right"><span t-att-style="style" t-esc="0.0" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td class="danger">Total purchases</td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_purchase.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_purchase.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_purchase.get('tax_amount') - get_total_purchase.get('return_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Total VAT due for current period</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_vat_due.get('total_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Corrections from previous period</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>VAT credit carried forword from previous period(s)</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Net VAT due</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_vat_due.get('total_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</flectra>
|
13
addons/l10n_ae_extend/views/sale_order_view.xml
Normal file
13
addons/l10n_ae_extend/views/sale_order_view.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<record id="uae_sale_order_form_inherit" model="ir.ui.view">
|
||||
<field name="name">uae.sale.order.form.inherit</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="vat_config_type" domain="[('journal_id.type', '=', 'sale')]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</flectra>
|
54
addons/l10n_ae_extend/views/vat_config_type.xml
Normal file
54
addons/l10n_ae_extend/views/vat_config_type.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flectra>
|
||||
<record model="ir.ui.view" id="vat_config_type_tree">
|
||||
<field name="name">vat.config.type.tree</field>
|
||||
<field name="model">vat.config.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="type"/>
|
||||
<!-- <field name="reverse_charge"/> -->
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="vat_config_type_form">
|
||||
<field name="name">vat.config.type.form</field>
|
||||
<field name="model">vat.config.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="vat_type" required="1"/>
|
||||
<field name="type" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="code" required="1"/>
|
||||
<field name="journal_id" required="1"/>
|
||||
<!-- <field name="reverse_charge" attrs="{'invisible': [('type', '!=', 'purchase')]}"/> -->
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_vat_config_type" model="ir.actions.act_window">
|
||||
<field name="name">Vat Types</field>
|
||||
<field name="res_model">vat.config.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_vat_config_type"
|
||||
action="action_vat_config_type"
|
||||
parent="account.menu_finance_configuration"
|
||||
sequence="10"/>
|
||||
|
||||
</flectra>
|
3
addons/l10n_ae_extend/wizard/__init__.py
Normal file
3
addons/l10n_ae_extend/wizard/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import vat_201
|
22
addons/l10n_ae_extend/wizard/vat_201.py
Normal file
22
addons/l10n_ae_extend/wizard/vat_201.py
Normal file
@ -0,0 +1,22 @@
|
||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra import fields, models
|
||||
|
||||
|
||||
class Vat201Report(models.TransientModel):
|
||||
|
||||
_name = "vat.201.report"
|
||||
_description = "Vat 201"
|
||||
|
||||
date_from = fields.Date(string='Start Date')
|
||||
date_to = fields.Date(string='End Date')
|
||||
company_id = fields.Many2one(
|
||||
'res.company', string='Company',
|
||||
required=True, default=lambda self: self.env.user.company_id)
|
||||
currency_id = fields.Many2one(related='company_id.currency_id')
|
||||
|
||||
def print_report(self, data):
|
||||
data['form'] = \
|
||||
self.read(['date_from', 'date_to', 'company_id', 'currency_id'])[0]
|
||||
return self.env.ref('l10n_ae_extend.action_report_vat_201'
|
||||
).report_action(self, data=data)
|
34
addons/l10n_ae_extend/wizard/vat_201_view.xml
Normal file
34
addons/l10n_ae_extend/wizard/vat_201_view.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
|
||||
<record id="vat_201_report_view" model="ir.ui.view">
|
||||
<field name="name">Vat 201</field>
|
||||
<field name="model">vat.201.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Vat 201">
|
||||
<group col="4">
|
||||
<field name="date_from" required="1"/>
|
||||
<field name="date_to" required="1"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="print_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
|
||||
<button string="Cancel" class="btn btn-default" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_vat_201_report" model="ir.actions.act_window">
|
||||
<field name="name">Vat 201</field>
|
||||
<field name="res_model">vat.201.report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="vat_201_report_view"/>
|
||||
<field name="context">{}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_account_report" name="Vat 201" action="action_vat_201_report" parent="account.menu_finance_legal_statement"/>
|
||||
|
||||
</flectra>
|
Loading…
Reference in New Issue
Block a user