[IMP]:Add demo data and changes in view

This commit is contained in:
Haresh Chavda 2018-12-03 06:47:45 +00:00 committed by Parthiv Patel
parent 5bd42a122c
commit 317b7583ba
22 changed files with 499 additions and 87 deletions

View File

@ -1063,6 +1063,7 @@
<group>
<group>
<field name="name"/>
<field name="sequence"/>
</group>
<group>
<field name="type_tax_use"/>

View File

@ -117,7 +117,7 @@
</div>
</div>
</div>
<h2>Currencies</h2>
<h2 name="currencies">Currencies</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane"/>

View File

@ -1643,7 +1643,6 @@
<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</field>
</record>
<record id="sale_uae_vat_5" model="account.tax.template">

View File

@ -19,7 +19,7 @@ United Arab Emirates accounting chart and localization.
'views/report_vat_201_view.xml',
'views/report_menu_view.xml',
'views/vat_config_type.xml',
'views/company_view.xml',
'views/res_config_view.xml',
'views/purchase_order_view.xml',
'views/sale_order_view.xml',
'views/account_invoice_view.xml',

View File

@ -60,7 +60,7 @@
<record id="rc_vat_account" model="account.account">
<field name="code">205301</field>
<field name="name">Reverse Charge(Vat)</field>
<field name="name">Reverse Charge(VAT)</field>
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
</record>
@ -70,12 +70,6 @@
<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>

View File

@ -25,7 +25,7 @@
<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>
<field name="quantity">18.0</field>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
@ -57,7 +57,7 @@
<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>
<field name="quantity">5.0</field>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
@ -69,6 +69,231 @@
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_2')]"/>
<record id="demo_invoice_ae_insidegcc_country" 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.insidegcc_sale_journal"/>
<field name="vat_config_type" ref="l10n_ae_extend.config_type_2"/>
</record>
<record id="demo_invoice_ae_insidegcc_country_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_insidegcc_country"/>
<field name="name">Graphics Card</field>
<field name="product_id" ref="product.product_product_24"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_sale_uae_account"/>
<field name="price_unit">885.0</field>
<field name="quantity">20.0</field>
</record>
<record id="demo_invoice_ae_insidegcc_country_line_1" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_insidegcc_country"/>
<field name="name">Basic Computer</field>
<field name="product_id" ref="product.consu_delivery_03"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_sale_uae_account"/>
<field name="price_unit">23500.0</field>
<field name="quantity">2.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.sale_uae_vat_zero')])]"/>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
eval="[ref('demo_invoice_ae_insidegcc_country_line')]"/>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_insidegcc_country')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_insidegcc_country')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_insidegcc_country')]"/>
<!-- Refund -->
<record id="demo_invoice_ae_insidegcc_country_refund" 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_insidegcc_country"/>
<field name="vat_config_type" ref="l10n_ae_extend.config_type_2"/>
</record>
<record id="demo_invoice_ae_insidegcc_country_refund_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_insidegcc_country_refund"/>
<field name="name">Graphics Card</field>
<field name="product_id" ref="product.product_product_24"/>
<field name="price_unit">800.0</field>
<field name="account_id" ref="l10n_ae_extend.insidegcc_sale_uae_account"/>
<field name="quantity">3.0</field>
</record>
<record id="demo_invoice_ae_insidegcc_country_refund_line_1" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_insidegcc_country_refund"/>
<field name="name">Basic Computer</field>
<field name="product_id" ref="product.consu_delivery_03"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_sale_uae_account"/>
<field name="price_unit">23000.0</field>
<field name="quantity">1.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.sale_uae_vat_zero')])]"/>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
eval="[ref('demo_invoice_ae_insidegcc_country_refund_line')]"/>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_insidegcc_country_refund')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_insidegcc_country_refund')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_insidegcc_country_refund')]"/>
<record id="demo_invoice_ae_outsidegcc_country" 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.outsidegcc_sale_journal"/>
<field name="vat_config_type" ref="l10n_ae_extend.config_type_3"/>
</record>
<record id="demo_invoice_ae_outsidegcc_country_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_outsidegcc_country"/>
<field name="name">Graphics Card</field>
<field name="product_id" ref="product.product_product_24"/>
<field name="account_id" ref="l10n_ae_extend.outsidegcc_sale_uae_account"/>
<field name="price_unit">885.0</field>
<field name="quantity">15.0</field>
</record>
<record id="demo_invoice_ae_outsidegcc_country_line_1" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_outsidegcc_country"/>
<field name="name">Basic Computer</field>
<field name="product_id" ref="product.consu_delivery_03"/>
<field name="account_id" ref="l10n_ae_extend.outsidegcc_sale_uae_account"/>
<field name="price_unit">23500.0</field>
<field name="quantity">4.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.sale_uae_vat_zero')])]"/>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
eval="[ref('demo_invoice_ae_outsidegcc_country_line')]"/>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_outsidegcc_country')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_outsidegcc_country')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_outsidegcc_country')]"/>
<!-- Refund -->
<record id="demo_invoice_ae_outsidegcc_country_refund" 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.outsidegcc_sale_journal"/>
<field name="refund_invoice_id" ref="demo_invoice_ae_outsidegcc_country"/>
<field name="vat_config_type" ref="l10n_ae_extend.config_type_3"/>
</record>
<record id="demo_invoice_ae_outsidegcc_country_refund_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_outsidegcc_country_refund"/>
<field name="name">Graphics Card</field>
<field name="product_id" ref="product.product_product_24"/>
<field name="price_unit">800.0</field>
<field name="account_id" ref="l10n_ae_extend.outsidegcc_sale_uae_account"/>
<field name="quantity">5.0</field>
</record>
<record id="demo_invoice_ae_outsidegcc_country_refund_line_1" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_outsidegcc_country_refund"/>
<field name="name">Basic Computer</field>
<field name="product_id" ref="product.consu_delivery_03"/>
<field name="account_id" ref="l10n_ae_extend.outsidegcc_sale_uae_account"/>
<field name="price_unit">23500.0</field>
<field name="quantity">2.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.sale_uae_vat_zero')])]"/>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
eval="[ref('demo_invoice_ae_outsidegcc_country_refund_line')]"/>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_outsidegcc_country_refund')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_outsidegcc_country_refund')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_outsidegcc_country_refund')]"/>
<record id="demo_invoice_ae_exempte" 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.designated_zone_sale_journal"/>
<field name="vat_config_type" ref="l10n_ae_extend.config_type_4"/>
</record>
<record id="demo_invoice_ae_exempte_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_exempte"/>
<field name="name">Little server</field>
<field name="product_id" ref="product.consu_delivery_02"/>
<field name="account_id" ref="l10n_ae_extend.designated_zone_sale_uae_account"/>
<field name="price_unit">40000</field>
<field name="quantity">5.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.sale_uae_vat_exempted')])]"/>
</record>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_exempte')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_exempte')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_exempte')]"/>
<!-- Refund -->
<record id="demo_invoice_ae_exempte_refund" 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.designated_zone_sale_journal"/>
<field name="refund_invoice_id" ref="demo_invoice_ae_exempte"/>
<field name="vat_config_type" ref="l10n_ae_extend.config_type_4"/>
</record>
<record id="demo_invoice_ae_exempte_refund_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_exempte_refund"/>
<field name="name">Little server</field>
<field name="product_id" ref="product.consu_delivery_02"/>
<field name="account_id" ref="l10n_ae_extend.designated_zone_sale_uae_account"/>
<field name="price_unit">40000</field>
<field name="quantity">1.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.sale_uae_vat_exempted')])]"/>
</record>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_exempte_refund')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_exempte_refund')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_exempte_refund')]"/>
<!-- Purchases -->
<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"/>
@ -194,4 +419,106 @@
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_6')]"/>
<record id="demo_invoice_ae_io_gcc" 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_6"/>
<field name="journal_id" ref="l10n_ae_extend.insidegcc_purchase_journal"/>
</record>
<record id="demo_invoice_ae_io_gcc_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_io_gcc"/>
<field name="name">Graphics Card</field>
<field name="product_id" ref="product.product_product_24"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_purchase_uae_account"/>
<field name="price_unit">876.0</field>
<field name="quantity">5.0</field>
</record>
<record id="demo_invoice_ae_io_gcc_line_1" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_io_gcc"/>
<field name="name">Basic Computer</field>
<field name="product_id" ref="product.consu_delivery_03"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_purchase_uae_account"/>
<field name="price_unit">23500.0</field>
<field name="quantity">2.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.purchase_uae_vat_zero')])]"/>
</record>
<record id="demo_invoice_ae_io_gcc_line_2" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_io_gcc"/>
<field name="name">Little server</field>
<field name="product_id" ref="product.consu_delivery_02"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_purchase_uae_account"/>
<field name="price_unit">40000</field>
<field name="quantity">3.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.purchase_uae_vat_exempted')])]"/>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
eval="[ref('demo_invoice_ae_io_gcc_line')]"/>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_io_gcc')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_io_gcc')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_io_gcc')]"/>
<!-- Refund -->
<record id="demo_invoice_ae_io_gcc_refund" 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_6"/>
<field name="journal_id" ref="l10n_ae_extend.insidegcc_purchase_journal"/>
<field name="refund_invoice_id" ref="demo_invoice_ae_io_gcc"/>
</record>
<record id="demo_invoice_ae_io_gcc_refund_line" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_io_gcc_refund"/>
<field name="name">Graphics Card</field>
<field name="product_id" ref="product.product_product_24"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_purchase_uae_account"/>
<field name="price_unit">876.0</field>
<field name="quantity">3.0</field>
</record>
<record id="demo_invoice_ae_io_gcc_refund_line_1" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_io_gcc_refund"/>
<field name="name">Basic Computer</field>
<field name="product_id" ref="product.consu_delivery_03"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_purchase_uae_account"/>
<field name="price_unit">23500.0</field>
<field name="quantity">1.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.purchase_uae_vat_zero')])]"/>
</record>
<record id="demo_invoice_ae_io_gcc_refund_line_2" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_ae_io_gcc_refund"/>
<field name="name">Little server</field>
<field name="product_id" ref="product.consu_delivery_02"/>
<field name="account_id" ref="l10n_ae_extend.insidegcc_purchase_uae_account"/>
<field name="price_unit">40000</field>
<field name="quantity">1.0</field>
<field name="invoice_line_tax_ids" eval="[(6, 0, [ref('l10n_ae.purchase_uae_vat_exempted')])]"/>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
eval="[ref('demo_invoice_ae_io_gcc_refund_line')]"/>
<function model="account.invoice" name="_onchange_invoice_line_ids"
eval="[ref('demo_invoice_ae_io_gcc_refund')]"/>
<function model="account.invoice" name="_get_total_amount"
eval="[ref('demo_invoice_ae_io_gcc_refund')]"/>
<function model="account.invoice" name="action_invoice_open"
eval="[ref('demo_invoice_ae_io_gcc_refund')]"/>
</flectra>

View File

@ -1,7 +1,7 @@
# Part of flectra. See LICENSE file for full copyright and licensing details.
from . import vat_config_type
from . import company
from . import res_config
from . import sale
from . import purchase
from . import account_invoice

View File

@ -1,7 +1,6 @@
# Part of Flectra. See LICENSE file for full copyright and licensing details.
from flectra import fields, models, api, _
from flectra.exceptions import Warning
from flectra import fields, models, api
class ReverseAccountInvoiceTax(models.Model):
@ -22,7 +21,7 @@ class AccountInvoice(models.Model):
return self.vat_config_type.search(domain, limit=1)
vat_config_type = fields.Many2one(
'vat.config.type', 'Vat Type', default=_default_config_type,
'vat.config.type', 'VAT Type', default=_default_config_type,
readonly=True, states={'draft': [('readonly', False)]})
reverse_charge = fields.Boolean(
'Reverse Charge', readonly=True,
@ -63,8 +62,14 @@ class AccountInvoice(models.Model):
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!'))
config_id = self.env[
'res.config.settings'].search([], order='id desc', limit=1)
rc_account = config_id.rc_vat_account_id or \
self.env.ref('l10n_ae_extend.rc_vat_account')
vat_account = config_id.vat_expense_account_id or \
self.env.ref('l10n_ae_extend.rc_vat_expense_account')
customs_account = config_id.customs_duty_account_id or \
self.env.ref('l10n_ae.uae_account_3694')
list_data = []
account_tax_obj = self.env['account.tax']
custom_amount = 0.0
@ -77,7 +82,7 @@ class AccountInvoice(models.Model):
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
account_id = vat_account.id
list_data.append((0, 0, {
'name': tax_line.name,
'partner_id':
@ -109,20 +114,22 @@ class AccountInvoice(models.Model):
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)))
(0, 0, self.get_move_line_vals(
total_tax_amount - custom_amount, rc_account)))
if custom_amount:
list_data.append((0, 0, self.get_move_line_vals(custom_amount)))
list_data.append((0, 0, self.get_move_line_vals(
custom_amount, customs_account)))
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):
def get_move_line_vals(self, credit, account_id):
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,
'account_id': account_id.id,
'credit': credit,
'move_id': self.move_id.id,
'invoice_id': self.id,

View File

@ -1,12 +0,0 @@
# 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')

View File

@ -12,7 +12,7 @@ class PurchaseOrder(models.Model):
('journal_id.type', '=', 'purchase')], limit=1)
vat_config_type = fields.Many2one(
'vat.config.type', 'Vat Type', default=_default_config_type,
'vat.config.type', 'VAT Type', default=_default_config_type,
readonly=True, states={'draft': [('readonly', False)]})
reverse_charge = fields.Boolean(
'Reverse Charge', readonly=True,

View File

@ -0,0 +1,34 @@
# Part of Flectra. See LICENSE file for full copyright and licensing details.
from flectra import fields, models, api
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
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')
@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()
res.update(
rc_vat_account_id=self.env.ref('l10n_ae_extend.rc_vat_account').id,
customs_duty_account_id=self.env.ref(
'l10n_ae.uae_account_3694').id,
vat_expense_account_id=self.env.ref(
'l10n_ae_extend.rc_vat_expense_account').id,
)
return res
def set_values(self):
super(ResConfigSettings, self).set_values()
params = self.env['ir.config_parameter'].sudo()
params.set_param('rc_vat_account_id',
self.rc_vat_account_id)
params.set_param('customs_duty_account_id',
self.customs_duty_account_id)
params.set_param('vat_expense_account_id',
self.vat_expense_account_id)

View File

@ -12,7 +12,7 @@ class SaleOrder(models.Model):
('journal_id.type', '=', 'sale')], limit=1)
vat_config_type = fields.Many2one(
'vat.config.type', 'Vat Type', default=_default_config_type,
'vat.config.type', 'VAT Type', default=_default_config_type,
readonly=True, states={'draft': [('readonly', False)]})
@api.multi

View File

@ -7,9 +7,9 @@ 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')
name = fields.Char('Name', required=True)
code = fields.Char('Code', required=True)
journal_id = fields.Many2one('account.journal', 'Journal', required=True)
vat_type = fields.Selection([
('local_sale', 'Local Sale'),
('inside_gcc_sale', 'Inside GCC Sale'),
@ -18,6 +18,7 @@ class JournalConfigType(models.Model):
('local_purchase', 'Local Purchase'),
('inside_gcc_purchase', 'Inside GCC Purchase'),
('outside_gcc_purchase', 'Outside GCC Purchase'),
('designated_zone_purchase', 'Designated Zone Purchase')])
('designated_zone_purchase', 'Designated Zone Purchase')],
'VAT Type', required=True)
type = fields.Selection([
('sale', 'Sale'), ('purchase', 'Purchase')], 'Type')
('sale', 'Sale'), ('purchase', 'Purchase')], 'Type', required=True)

View File

@ -55,9 +55,13 @@ class TestAccountInvoice(TestAECommon):
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)
config_id = self.env[
'res.config.settings'].search([], order='id desc', limit=1)
rc_account = config_id.rc_vat_account_id or \
self.env.ref('l10n_ae_extend.rc_vat_account')
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)])
('account_id', '=', rc_account.id)])
self.assertEquals(move_line_id.credit, amount_tax)
def test_report_data(self):
@ -76,11 +80,11 @@ class TestAccountInvoice(TestAECommon):
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)
dict_data['get_local_sale']['amount'], 15930.0)
self.assertEquals(dict_data['get_local_sale']['tax_amount'], 796.5)
self.assertEquals(dict_data['get_local_sale']['adjustment'], 4425.00)
self.assertEquals(
dict_data['get_local_sale']['return_tax_amount'], 44.25)
dict_data['get_local_sale']['return_tax_amount'], 221.25)
self.assertEquals(dict_data['get_local_purchase']['amount'], 17520)
self.assertEquals(dict_data['get_local_purchase']['tax_amount'], 876)
@ -96,5 +100,5 @@ class TestAccountInvoice(TestAECommon):
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)
self.assertEquals(round(
dict_data['get_total_vat_due']['total_tax_amount'], 2), 587.40)

View File

@ -15,6 +15,17 @@
</field>
</record>
<record id="uae_account_invoice_tree_inherit" model="ir.ui.view">
<field name="name">uae.account.invoice.tree.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='number']" position="after">
<field name="vat_config_type"/>
</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>
@ -52,6 +63,17 @@
</field>
</record>
<record id="uae_account_invoice_supplier_tree_inherit" model="ir.ui.view">
<field name="name">uae.account.invoice.supplier.tree.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='number']" position="after">
<field name="vat_config_type"/>
</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>

View File

@ -1,16 +0,0 @@
<?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>

View File

@ -3,7 +3,7 @@
<report
id="action_report_vat_201"
model="vat.201.report"
string="Vat 201"
string="VAT 201"
report_type="qweb-pdf"
name="l10n_ae_extend.vat_201"
file="l10n_ae_extend.vat_201"

View File

@ -7,8 +7,8 @@
<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>
<t t-if="data['form']['date_from']"><strong>Date from :</strong> <span t-esc="data['form']['date_from']"/><br/></t>
<t t-if="data['form']['date_to']"><strong>Date to : </strong><span t-esc="data['form']['date_to']"/></t>
</div>
</div>
<table class="table" width="100%">
@ -59,7 +59,7 @@
<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 rowspan="6" style="font-size: 14px; letter-spacing: 1px;">VAT on Purchase</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>
@ -97,28 +97,28 @@
</tr>
<tr>
<td></td>
<td>Total VAT due for current period</td>
<td><b>Total VAT due for current period</b></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><b>Corrections from previous period</b></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>VAT credit carried forword from previous period(s)</td>
<td><b>VAT credit carried forword from previous period(s)</b></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>Net VAT due</td>
<td><b>Net VAT due</b></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>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<flectra>
<record id="uae_res_config_settings_view_form" model="ir.ui.view">
<field name="name">uae.res.config.settings.view.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="40"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//h2[@name='currencies']" position="before">
<h2>UAE Accounts</h2>
<div class="row mt16 o_settings_container" id="accounting_reports">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<div class="content-group">
<div class="row mt16">
<label for="rc_vat_account_id" class="col-md-5 o_light_label"/>
<field name="rc_vat_account_id"/>
</div>
</div>
<div class="content-group">
<div class="row mt16">
<label for="customs_duty_account_id" class="col-md-5 o_light_label"/>
<field name="customs_duty_account_id"/>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<div class="content-group">
<div class="row mt16">
<label for="vat_expense_account_id" class="col-md-5 o_light_label"/>
<field name="vat_expense_account_id"/>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</flectra>

View File

@ -7,9 +7,9 @@
<tree>
<field name="code"/>
<field name="name"/>
<field name="vat_type"/>
<field name="journal_id"/>
<field name="type"/>
<!-- <field name="reverse_charge"/> -->
</tree>
</field>
</record>
@ -22,14 +22,13 @@
<sheet>
<group>
<group>
<field name="name" required="1"/>
<field name="vat_type" required="1"/>
<field name="type" required="1"/>
<field name="name"/>
<field name="vat_type"/>
<field name="type"/>
</group>
<group>
<field name="code" required="1"/>
<field name="journal_id" required="1"/>
<!-- <field name="reverse_charge" attrs="{'invisible': [('type', '!=', 'purchase')]}"/> -->
<field name="code"/>
<field name="journal_id"/>
</group>
</group>
</sheet>
@ -38,7 +37,7 @@
</record>
<record id="action_vat_config_type" model="ir.actions.act_window">
<field name="name">Vat Types</field>
<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>
@ -48,7 +47,7 @@
<menuitem id="menu_vat_config_type"
action="action_vat_config_type"
parent="account.menu_finance_configuration"
parent="account.account_account_menu"
sequence="10"/>
</flectra>

View File

@ -1,12 +1,12 @@
# Part of Flectra. See LICENSE file for full copyright and licensing details.
from flectra import fields, models
from flectra import fields, models, api, _
class Vat201Report(models.TransientModel):
_name = "vat.201.report"
_description = "Vat 201"
_description = "VAT 201"
date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date')
@ -15,6 +15,12 @@ class Vat201Report(models.TransientModel):
required=True, default=lambda self: self.env.user.company_id)
currency_id = fields.Many2one(related='company_id.currency_id')
@api.constrains('date_from', 'date_to')
def _check_date(self):
if self.date_from > self.date_to:
raise ValueError(_("End Date must be greater than "
"Start Date!"))
def print_report(self, data):
data['form'] = \
self.read(['date_from', 'date_to', 'company_id', 'currency_id'])[0]

View File

@ -5,7 +5,7 @@
<field name="name">Vat 201</field>
<field name="model">vat.201.report</field>
<field name="arch" type="xml">
<form string="Vat 201">
<form string="VAT 201">
<group col="4">
<field name="date_from" required="1"/>
<field name="date_to" required="1"/>
@ -19,7 +19,7 @@
</record>
<record id="action_vat_201_report" model="ir.actions.act_window">
<field name="name">Vat 201</field>
<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>
@ -29,6 +29,6 @@
<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"/>
<menuitem id="menu_account_report" name="VAT 201" action="action_vat_201_report" parent="account.menu_finance_legal_statement"/>
</flectra>