Merge branch '1.0' into i18n_fr_stable
This commit is contained in:
commit
e24f45e5cd
@ -1063,6 +1063,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="sequence"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="type_tax_use"/>
|
<field name="type_tax_use"/>
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2>Currencies</h2>
|
<h2 name="currencies">Currencies</h2>
|
||||||
<div class="row mt16 o_settings_container">
|
<div class="row mt16 o_settings_container">
|
||||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||||
<div class="o_setting_left_pane"/>
|
<div class="o_setting_left_pane"/>
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_employee_comp_rule" model="ir.rule">
|
||||||
|
<field name="name">Employee multi company rule</field>
|
||||||
|
<field name="model_id" ref="model_hr_employee"/>
|
||||||
|
<field name="global" eval="True"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="hr_job_comp_rule" model="ir.rule">
|
<record id="hr_job_comp_rule" model="ir.rule">
|
||||||
<field name="name">Job multi company rule</field>
|
<field name="name">Job multi company rule</field>
|
||||||
<field name="model_id" ref="model_hr_job"/>
|
<field name="model_id" ref="model_hr_job"/>
|
||||||
|
@ -20,6 +20,7 @@ You can assign several contracts per employee.
|
|||||||
'website': 'https://flectrahq.com/page/employees',
|
'website': 'https://flectrahq.com/page/employees',
|
||||||
'depends': ['hr'],
|
'depends': ['hr'],
|
||||||
'data': [
|
'data': [
|
||||||
|
'security/contract_security.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'data/hr_contract_data.xml',
|
'data/hr_contract_data.xml',
|
||||||
'views/hr_contract_views.xml',
|
'views/hr_contract_views.xml',
|
||||||
|
14
addons/hr_contract/security/contract_security.xml
Normal file
14
addons/hr_contract/security/contract_security.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<flectra>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
|
<record id="hr_contract_rule" model="ir.rule">
|
||||||
|
<field name="name">Hr Contract Multicompany</field>
|
||||||
|
<field name="model_id" ref="model_hr_contract"/>
|
||||||
|
<field name="domain_force">
|
||||||
|
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</flectra>
|
@ -19,7 +19,10 @@ class HrPayrollStructure(models.Model):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_parent(self):
|
def _get_parent(self):
|
||||||
|
if self.env.user.company_id.id == self.env.ref(
|
||||||
|
'base.base.main_company', False):
|
||||||
return self.env.ref('hr_payroll.structure_base', False)
|
return self.env.ref('hr_payroll.structure_base', False)
|
||||||
|
return False
|
||||||
|
|
||||||
name = fields.Char(required=True)
|
name = fields.Char(required=True)
|
||||||
code = fields.Char(string='Reference', required=True)
|
code = fields.Char(string='Reference', required=True)
|
||||||
|
@ -33,5 +33,29 @@
|
|||||||
<field name="groups" eval="[(4, ref('hr_payroll.group_hr_payroll_manager'))]"/>
|
<field name="groups" eval="[(4, ref('hr_payroll.group_hr_payroll_manager'))]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payslip_rule" model="ir.rule">
|
||||||
|
<field name="name">Payslip Multicompany</field>
|
||||||
|
<field name="model_id" ref="model_hr_payslip"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_structure_rule" model="ir.rule">
|
||||||
|
<field name="name">Payroll Structure Multicompany</field>
|
||||||
|
<field name="model_id" ref="model_hr_payroll_structure"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_salary_rule_rule" model="ir.rule">
|
||||||
|
<field name="name">Hr Salary Rule Multicompany</field>
|
||||||
|
<field name="model_id" ref="model_hr_salary_rule"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_contribution_register_rule" model="ir.rule">
|
||||||
|
<field name="name">Hr Contribution Register Multicompany</field>
|
||||||
|
<field name="model_id" ref="model_hr_contribution_register"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</flectra>
|
</flectra>
|
||||||
|
@ -1643,7 +1643,6 @@
|
|||||||
<field name="tax_type">customs</field>
|
<field name="tax_type">customs</field>
|
||||||
<field name="chart_template_id" ref="uae_chart_template_standard"/>
|
<field name="chart_template_id" ref="uae_chart_template_standard"/>
|
||||||
<field name="include_base_amount" eval="True"/>
|
<field name="include_base_amount" eval="True"/>
|
||||||
<field name="sequence">0</field>
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="sale_uae_vat_5" model="account.tax.template">
|
<record id="sale_uae_vat_5" model="account.tax.template">
|
||||||
|
@ -19,7 +19,7 @@ United Arab Emirates accounting chart and localization.
|
|||||||
'views/report_vat_201_view.xml',
|
'views/report_vat_201_view.xml',
|
||||||
'views/report_menu_view.xml',
|
'views/report_menu_view.xml',
|
||||||
'views/vat_config_type.xml',
|
'views/vat_config_type.xml',
|
||||||
'views/company_view.xml',
|
'views/res_config_view.xml',
|
||||||
'views/purchase_order_view.xml',
|
'views/purchase_order_view.xml',
|
||||||
'views/sale_order_view.xml',
|
'views/sale_order_view.xml',
|
||||||
'views/account_invoice_view.xml',
|
'views/account_invoice_view.xml',
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
<record id="rc_vat_account" model="account.account">
|
<record id="rc_vat_account" model="account.account">
|
||||||
<field name="code">205301</field>
|
<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"/>
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -70,12 +70,6 @@
|
|||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
||||||
</record>
|
</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 -->
|
<!-- Purchase -->
|
||||||
<record id="local_purchase_uae_account" model="account.account">
|
<record id="local_purchase_uae_account" model="account.account">
|
||||||
<field name="code">571001</field>
|
<field name="code">571001</field>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<field name="product_id" ref="product.product_product_24"/>
|
<field name="product_id" ref="product.product_product_24"/>
|
||||||
<field name="account_id" ref="l10n_ae_extend.local_sale_uae_account"/>
|
<field name="account_id" ref="l10n_ae_extend.local_sale_uae_account"/>
|
||||||
<field name="price_unit">885.0</field>
|
<field name="price_unit">885.0</field>
|
||||||
<field name="quantity">2.0</field>
|
<field name="quantity">18.0</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="account.invoice.line" name="_onchange_product_id"
|
<function model="account.invoice.line" name="_onchange_product_id"
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<field name="product_id" ref="product.product_product_24"/>
|
<field name="product_id" ref="product.product_product_24"/>
|
||||||
<field name="price_unit">885.0</field>
|
<field name="price_unit">885.0</field>
|
||||||
<field name="account_id" ref="l10n_ae_extend.local_sale_uae_account"/>
|
<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>
|
</record>
|
||||||
|
|
||||||
<function model="account.invoice.line" name="_onchange_product_id"
|
<function model="account.invoice.line" name="_onchange_product_id"
|
||||||
@ -69,6 +69,231 @@
|
|||||||
<function model="account.invoice" name="action_invoice_open"
|
<function model="account.invoice" name="action_invoice_open"
|
||||||
eval="[ref('demo_invoice_ae_2')]"/>
|
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">
|
<record id="demo_invoice_ae_3" model="account.invoice">
|
||||||
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
<field name="date_due" eval="DateTime.today().strftime('%Y-%m-28')"/>
|
||||||
<field name="currency_id" ref="base.AED"/>
|
<field name="currency_id" ref="base.AED"/>
|
||||||
@ -194,4 +419,106 @@
|
|||||||
<function model="account.invoice" name="action_invoice_open"
|
<function model="account.invoice" name="action_invoice_open"
|
||||||
eval="[ref('demo_invoice_ae_6')]"/>
|
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>
|
</flectra>
|
@ -1,7 +1,7 @@
|
|||||||
# Part of flectra. See LICENSE file for full copyright and licensing details.
|
# Part of flectra. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from . import vat_config_type
|
from . import vat_config_type
|
||||||
from . import company
|
from . import res_config
|
||||||
from . import sale
|
from . import sale
|
||||||
from . import purchase
|
from . import purchase
|
||||||
from . import account_invoice
|
from . import account_invoice
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from flectra import fields, models, api, _
|
from flectra import fields, models, api
|
||||||
from flectra.exceptions import Warning
|
|
||||||
|
|
||||||
|
|
||||||
class ReverseAccountInvoiceTax(models.Model):
|
class ReverseAccountInvoiceTax(models.Model):
|
||||||
@ -22,7 +21,7 @@ class AccountInvoice(models.Model):
|
|||||||
return self.vat_config_type.search(domain, limit=1)
|
return self.vat_config_type.search(domain, limit=1)
|
||||||
|
|
||||||
vat_config_type = fields.Many2one(
|
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)]})
|
readonly=True, states={'draft': [('readonly', False)]})
|
||||||
reverse_charge = fields.Boolean(
|
reverse_charge = fields.Boolean(
|
||||||
'Reverse Charge', readonly=True,
|
'Reverse Charge', readonly=True,
|
||||||
@ -63,8 +62,14 @@ class AccountInvoice(models.Model):
|
|||||||
def action_invoice_open(self):
|
def action_invoice_open(self):
|
||||||
if not self.reverse_charge:
|
if not self.reverse_charge:
|
||||||
return super(AccountInvoice, self).action_invoice_open()
|
return super(AccountInvoice, self).action_invoice_open()
|
||||||
if not self.company_id.rc_vat_account_id:
|
config_id = self.env[
|
||||||
raise Warning(_('Define Reverse Charge Account in Company!'))
|
'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 = []
|
list_data = []
|
||||||
account_tax_obj = self.env['account.tax']
|
account_tax_obj = self.env['account.tax']
|
||||||
custom_amount = 0.0
|
custom_amount = 0.0
|
||||||
@ -77,7 +82,7 @@ class AccountInvoice(models.Model):
|
|||||||
if self.partner_id.vat:
|
if self.partner_id.vat:
|
||||||
account_id = tax_line.account_id.id
|
account_id = tax_line.account_id.id
|
||||||
elif tax_id.tax_type == 'vat':
|
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, {
|
list_data.append((0, 0, {
|
||||||
'name': tax_line.name,
|
'name': tax_line.name,
|
||||||
'partner_id':
|
'partner_id':
|
||||||
@ -109,20 +114,22 @@ class AccountInvoice(models.Model):
|
|||||||
for move_line_id in list_data:
|
for move_line_id in list_data:
|
||||||
move_line_id[2].update({'move_id': self.move_id.id})
|
move_line_id[2].update({'move_id': self.move_id.id})
|
||||||
list_data.append(
|
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:
|
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.state = 'draft'
|
||||||
self.move_id.line_ids = list_data
|
self.move_id.line_ids = list_data
|
||||||
self.move_id.post()
|
self.move_id.post()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def get_move_line_vals(self, credit):
|
def get_move_line_vals(self, credit, account_id):
|
||||||
return {
|
return {
|
||||||
'name': '/',
|
'name': '/',
|
||||||
'partner_id': self.partner_id.parent_id.id or self.partner_id.id,
|
'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,
|
'credit': credit,
|
||||||
'move_id': self.move_id.id,
|
'move_id': self.move_id.id,
|
||||||
'invoice_id': self.id,
|
'invoice_id': self.id,
|
||||||
|
@ -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')
|
|
@ -12,7 +12,7 @@ class PurchaseOrder(models.Model):
|
|||||||
('journal_id.type', '=', 'purchase')], limit=1)
|
('journal_id.type', '=', 'purchase')], limit=1)
|
||||||
|
|
||||||
vat_config_type = fields.Many2one(
|
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)]})
|
readonly=True, states={'draft': [('readonly', False)]})
|
||||||
reverse_charge = fields.Boolean(
|
reverse_charge = fields.Boolean(
|
||||||
'Reverse Charge', readonly=True,
|
'Reverse Charge', readonly=True,
|
||||||
|
34
addons/l10n_ae_extend/models/res_config.py
Normal file
34
addons/l10n_ae_extend/models/res_config.py
Normal 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)
|
@ -12,7 +12,7 @@ class SaleOrder(models.Model):
|
|||||||
('journal_id.type', '=', 'sale')], limit=1)
|
('journal_id.type', '=', 'sale')], limit=1)
|
||||||
|
|
||||||
vat_config_type = fields.Many2one(
|
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)]})
|
readonly=True, states={'draft': [('readonly', False)]})
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
@ -7,9 +7,9 @@ class JournalConfigType(models.Model):
|
|||||||
_name = 'vat.config.type'
|
_name = 'vat.config.type'
|
||||||
_description = 'Config Type'
|
_description = 'Config Type'
|
||||||
|
|
||||||
name = fields.Char('Name')
|
name = fields.Char('Name', required=True)
|
||||||
code = fields.Char('Code')
|
code = fields.Char('Code', required=True)
|
||||||
journal_id = fields.Many2one('account.journal', 'Journal')
|
journal_id = fields.Many2one('account.journal', 'Journal', required=True)
|
||||||
vat_type = fields.Selection([
|
vat_type = fields.Selection([
|
||||||
('local_sale', 'Local Sale'),
|
('local_sale', 'Local Sale'),
|
||||||
('inside_gcc_sale', 'Inside GCC Sale'),
|
('inside_gcc_sale', 'Inside GCC Sale'),
|
||||||
@ -18,6 +18,7 @@ class JournalConfigType(models.Model):
|
|||||||
('local_purchase', 'Local Purchase'),
|
('local_purchase', 'Local Purchase'),
|
||||||
('inside_gcc_purchase', 'Inside GCC Purchase'),
|
('inside_gcc_purchase', 'Inside GCC Purchase'),
|
||||||
('outside_gcc_purchase', 'Outside 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([
|
type = fields.Selection([
|
||||||
('sale', 'Sale'), ('purchase', 'Purchase')], 'Type')
|
('sale', 'Sale'), ('purchase', 'Purchase')], 'Type', required=True)
|
||||||
|
@ -55,9 +55,13 @@ class TestAccountInvoice(TestAECommon):
|
|||||||
self.assertEquals(invoice_id.amount_tax, 0)
|
self.assertEquals(invoice_id.amount_tax, 0)
|
||||||
self.assertEquals(len(invoice_id.tax_line_ids), 0)
|
self.assertEquals(len(invoice_id.tax_line_ids), 0)
|
||||||
self.assertEquals(len(invoice_id.reverse_tax_line_ids), 1)
|
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_line_id = self.env['account.move.line'].search([
|
||||||
('move_id', '=', invoice_id.move_id.id),
|
('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)
|
self.assertEquals(move_line_id.credit, amount_tax)
|
||||||
|
|
||||||
def test_report_data(self):
|
def test_report_data(self):
|
||||||
@ -76,11 +80,11 @@ class TestAccountInvoice(TestAECommon):
|
|||||||
dict_data = report_obj.get_report_values(None, data)
|
dict_data = report_obj.get_report_values(None, data)
|
||||||
|
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
dict_data['get_local_sale']['amount'], 1770)
|
dict_data['get_local_sale']['amount'], 15930.0)
|
||||||
self.assertEquals(dict_data['get_local_sale']['tax_amount'], 88.5)
|
self.assertEquals(dict_data['get_local_sale']['tax_amount'], 796.5)
|
||||||
self.assertEquals(dict_data['get_local_sale']['adjustment'], 885)
|
self.assertEquals(dict_data['get_local_sale']['adjustment'], 4425.00)
|
||||||
self.assertEquals(
|
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']['amount'], 17520)
|
||||||
self.assertEquals(dict_data['get_local_purchase']['tax_amount'], 876)
|
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)
|
dict_data['get_reverse_charge_data']['adjustment'], 4380)
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
dict_data['get_reverse_charge_data']['return_tax_amount'], 219)
|
dict_data['get_reverse_charge_data']['return_tax_amount'], 219)
|
||||||
self.assertEquals(
|
self.assertEquals(round(
|
||||||
dict_data['get_total_vat_due']['total_tax_amount'], -1050.75)
|
dict_data['get_total_vat_due']['total_tax_amount'], 2), 587.40)
|
||||||
|
@ -15,6 +15,17 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</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">
|
<record id="view_reverse_invoice_tax_tree" model="ir.ui.view">
|
||||||
<field name="name">reverse.account.invoice.tax.tree</field>
|
<field name="name">reverse.account.invoice.tax.tree</field>
|
||||||
<field name="model">reverse.account.invoice.tax</field>
|
<field name="model">reverse.account.invoice.tax</field>
|
||||||
@ -52,6 +63,17 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</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">
|
<record id="uae_account_tax_form_inherit" model="ir.ui.view">
|
||||||
<field name="name">uae.account.tax.form.inherit</field>
|
<field name="name">uae.account.tax.form.inherit</field>
|
||||||
<field name="model">account.tax</field>
|
<field name="model">account.tax</field>
|
||||||
|
@ -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>
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
<report
|
<report
|
||||||
id="action_report_vat_201"
|
id="action_report_vat_201"
|
||||||
model="vat.201.report"
|
model="vat.201.report"
|
||||||
string="Vat 201"
|
string="VAT 201"
|
||||||
report_type="qweb-pdf"
|
report_type="qweb-pdf"
|
||||||
name="l10n_ae_extend.vat_201"
|
name="l10n_ae_extend.vat_201"
|
||||||
file="l10n_ae_extend.vat_201"
|
file="l10n_ae_extend.vat_201"
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
<h3 align="center">VAT 201</h3>
|
<h3 align="center">VAT 201</h3>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-4">
|
<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_from']"><strong>Date 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_to']"><strong>Date to : </strong><span t-esc="data['form']['date_to']"/></t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table class="table" width="100%">
|
<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>
|
<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>
|
||||||
<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="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('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('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
|
||||||
@ -97,28 +97,28 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<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></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>
|
<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>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Corrections from previous period</td>
|
<td><b>Corrections from previous period</b></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<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>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Net VAT due</td>
|
<td><b>Net VAT due</b></td>
|
||||||
<td></td>
|
<td></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>
|
<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>
|
||||||
|
46
addons/l10n_ae_extend/views/res_config_view.xml
Normal file
46
addons/l10n_ae_extend/views/res_config_view.xml
Normal 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>
|
||||||
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
|||||||
<tree>
|
<tree>
|
||||||
<field name="code"/>
|
<field name="code"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="vat_type"/>
|
||||||
<field name="journal_id"/>
|
<field name="journal_id"/>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<!-- <field name="reverse_charge"/> -->
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@ -22,14 +22,13 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="name" required="1"/>
|
<field name="name"/>
|
||||||
<field name="vat_type" required="1"/>
|
<field name="vat_type"/>
|
||||||
<field name="type" required="1"/>
|
<field name="type"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="code" required="1"/>
|
<field name="code"/>
|
||||||
<field name="journal_id" required="1"/>
|
<field name="journal_id"/>
|
||||||
<!-- <field name="reverse_charge" attrs="{'invisible': [('type', '!=', 'purchase')]}"/> -->
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</sheet>
|
</sheet>
|
||||||
@ -38,7 +37,7 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_vat_config_type" model="ir.actions.act_window">
|
<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="res_model">vat.config.type</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
@ -48,7 +47,7 @@
|
|||||||
|
|
||||||
<menuitem id="menu_vat_config_type"
|
<menuitem id="menu_vat_config_type"
|
||||||
action="action_vat_config_type"
|
action="action_vat_config_type"
|
||||||
parent="account.menu_finance_configuration"
|
parent="account.account_account_menu"
|
||||||
sequence="10"/>
|
sequence="10"/>
|
||||||
|
|
||||||
</flectra>
|
</flectra>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# Part of Flectra. See LICENSE file for full copyright and licensing details.
|
# 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):
|
class Vat201Report(models.TransientModel):
|
||||||
|
|
||||||
_name = "vat.201.report"
|
_name = "vat.201.report"
|
||||||
_description = "Vat 201"
|
_description = "VAT 201"
|
||||||
|
|
||||||
date_from = fields.Date(string='Start Date')
|
date_from = fields.Date(string='Start Date')
|
||||||
date_to = fields.Date(string='End 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)
|
required=True, default=lambda self: self.env.user.company_id)
|
||||||
currency_id = fields.Many2one(related='company_id.currency_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):
|
def print_report(self, data):
|
||||||
data['form'] = \
|
data['form'] = \
|
||||||
self.read(['date_from', 'date_to', 'company_id', 'currency_id'])[0]
|
self.read(['date_from', 'date_to', 'company_id', 'currency_id'])[0]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<field name="name">Vat 201</field>
|
<field name="name">Vat 201</field>
|
||||||
<field name="model">vat.201.report</field>
|
<field name="model">vat.201.report</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Vat 201">
|
<form string="VAT 201">
|
||||||
<group col="4">
|
<group col="4">
|
||||||
<field name="date_from" required="1"/>
|
<field name="date_from" required="1"/>
|
||||||
<field name="date_to" required="1"/>
|
<field name="date_to" required="1"/>
|
||||||
@ -19,7 +19,7 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_vat_201_report" model="ir.actions.act_window">
|
<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="res_model">vat.201.report</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
@ -29,6 +29,6 @@
|
|||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
</record>
|
</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>
|
</flectra>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'data/product_uom_data.xml',
|
'data/product_uom_data.xml',
|
||||||
'data/note_issue_reason_data.xml',
|
'data/note_issue_reason_data.xml',
|
||||||
|
'data/res_company_data.xml',
|
||||||
'wizard/account_invoice_refund_view.xml',
|
'wizard/account_invoice_refund_view.xml',
|
||||||
'views/product_uom_view.xml',
|
'views/product_uom_view.xml',
|
||||||
'views/res_partner_view.xml',
|
'views/res_partner_view.xml',
|
||||||
|
14
addons/l10n_in_gst/data/res_company_data.xml
Normal file
14
addons/l10n_in_gst/data/res_company_data.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<flectra noupdate="1">
|
||||||
|
|
||||||
|
<record id="in_gst_rc_account" model="account.account">
|
||||||
|
<field name="code">205311</field>
|
||||||
|
<field name="name">Reverse Charge(GST)</field>
|
||||||
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="base.main_company" model="res.company">
|
||||||
|
<field name="rc_gst_account_id" ref="in_gst_rc_account"/>
|
||||||
|
</record>
|
||||||
|
</flectra>
|
@ -52,6 +52,88 @@ class AccountInvoice(models.Model):
|
|||||||
readonly=True,
|
readonly=True,
|
||||||
states={
|
states={
|
||||||
'draft': [('readonly', False)]})
|
'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.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()
|
||||||
|
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', '=', tax_line.name)])
|
||||||
|
account_id = tax_id.account_id.id
|
||||||
|
if self.partner_id.vat:
|
||||||
|
account_id = tax_line.account_id.id
|
||||||
|
if not account_id:
|
||||||
|
account_id = tax_line.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)))
|
||||||
|
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_gst_account_id.id,
|
||||||
|
'credit': credit,
|
||||||
|
'move_id': self.move_id.id,
|
||||||
|
'invoice_id': self.id,
|
||||||
|
'quantity': 1,
|
||||||
|
}
|
||||||
|
|
||||||
@api.onchange('partner_id', 'company_id')
|
@api.onchange('partner_id', 'company_id')
|
||||||
def _onchange_partner_id(self):
|
def _onchange_partner_id(self):
|
||||||
@ -60,13 +142,32 @@ class AccountInvoice(models.Model):
|
|||||||
self.partner_id.partner_location = \
|
self.partner_id.partner_location = \
|
||||||
self.partner_id._get_partner_location_details(self.company_id)
|
self.partner_id._get_partner_location_details(self.company_id)
|
||||||
|
|
||||||
|
|
||||||
@api.onchange('fiscal_position_id')
|
@api.onchange('fiscal_position_id')
|
||||||
def _onchange_fiscal_position_id(self):
|
def _onchange_fiscal_position_id(self):
|
||||||
""" Onchange of Fiscal Position update tax values in invoice lines. """
|
""" Onchange of Fiscal Position update tax values in invoice lines. """
|
||||||
|
if self.fiscal_position_id:
|
||||||
for line in self.invoice_line_ids:
|
for line in self.invoice_line_ids:
|
||||||
line._set_taxes()
|
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)
|
||||||
|
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
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_move_create(self):
|
def action_move_create(self):
|
||||||
""" Do not apply taxes if company has been registered under
|
""" Do not apply taxes if company has been registered under
|
||||||
@ -128,3 +229,14 @@ class AccountInvoice(models.Model):
|
|||||||
'gst_type': invoice.gst_type,
|
'gst_type': invoice.gst_type,
|
||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
class ReverseAccountInvoiceTax(models.Model):
|
||||||
|
_inherit = 'account.invoice.tax'
|
||||||
|
_name = 'reverse.account.invoice.tax'
|
||||||
|
|
||||||
|
|
||||||
|
class AccountInvoiceLine(models.Model):
|
||||||
|
_inherit = "account.invoice.line"
|
||||||
|
|
||||||
|
reverse_invoice_line_tax_ids = fields.Many2many(
|
||||||
|
'account.tax', string='Taxes', copy=False)
|
@ -20,6 +20,7 @@ class Company(models.Model):
|
|||||||
default=time.strftime('2017-07-01'))
|
default=time.strftime('2017-07-01'))
|
||||||
company_b2c_limit_line = fields.One2many('res.company.b2c.limit',
|
company_b2c_limit_line = fields.One2many('res.company.b2c.limit',
|
||||||
'company_id', string='B2C Limit')
|
'company_id', string='B2C Limit')
|
||||||
|
rc_gst_account_id = fields.Many2one('account.account', 'Reverse Charge')
|
||||||
|
|
||||||
def onchange_state(self, gst_type, vat, state):
|
def onchange_state(self, gst_type, vat, state):
|
||||||
result = {'vat': '', 'country_id': False}
|
result = {'vat': '', 'country_id': False}
|
||||||
|
@ -135,7 +135,6 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
('gst_invoice', '=', 'b2b'), ('vat', '!=', False)]
|
('gst_invoice', '=', 'b2b'), ('vat', '!=', False)]
|
||||||
if post.get('gst_invoice') == 'cdnur':
|
if post.get('gst_invoice') == 'cdnur':
|
||||||
final_inv_domain = common_domain + refund_domain + cdnur_domain
|
final_inv_domain = common_domain + refund_domain + cdnur_domain
|
||||||
|
|
||||||
final_invoice_ids = acc_invoice.search(final_inv_domain)
|
final_invoice_ids = acc_invoice.search(final_inv_domain)
|
||||||
for inv in final_invoice_ids:
|
for inv in final_invoice_ids:
|
||||||
inv_data_list = []
|
inv_data_list = []
|
||||||
@ -159,15 +158,17 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
|
|
||||||
for line in inv.invoice_line_ids:
|
for line in inv.invoice_line_ids:
|
||||||
cess_amount = igst_amount = cgst_amount = sgst_amount = 0.0
|
cess_amount = igst_amount = cgst_amount = sgst_amount = 0.0
|
||||||
|
if inv.reverse_charge:
|
||||||
if line.invoice_line_tax_ids:
|
tax_lines = line.reverse_invoice_line_tax_ids
|
||||||
|
else:
|
||||||
|
tax_lines = line.invoice_line_tax_ids
|
||||||
|
if tax_lines:
|
||||||
price_unit = line.price_unit * (
|
price_unit = line.price_unit * (
|
||||||
1 - (line.discount or 0.0) / 100.0)
|
1 - (line.discount or 0.0) / 100.0)
|
||||||
taxes = line.invoice_line_tax_ids.compute_all(
|
taxes = tax_lines.compute_all(
|
||||||
price_unit, line.invoice_id.currency_id,
|
price_unit, line.invoice_id.currency_id,
|
||||||
line.quantity, line.product_id,
|
line.quantity, line.product_id,
|
||||||
line.invoice_id.partner_id)['taxes']
|
line.invoice_id.partner_id)['taxes']
|
||||||
|
|
||||||
for tax_data in taxes:
|
for tax_data in taxes:
|
||||||
tax = acc_tax.browse(tax_data['id'])
|
tax = acc_tax.browse(tax_data['id'])
|
||||||
if tax.tax_group_id.name == 'Cess':
|
if tax.tax_group_id.name == 'Cess':
|
||||||
@ -185,7 +186,7 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
'amount'] > 0):
|
'amount'] > 0):
|
||||||
sgst_amount += tax_data['amount']
|
sgst_amount += tax_data['amount']
|
||||||
|
|
||||||
for tax in line.invoice_line_tax_ids:
|
for tax in tax_lines:
|
||||||
rate = 0
|
rate = 0
|
||||||
if tax.id not in tax_list:
|
if tax.id not in tax_list:
|
||||||
if tax.tax_group_id.name == 'IGST' \
|
if tax.tax_group_id.name == 'IGST' \
|
||||||
@ -213,7 +214,6 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
line_data = self._prepare_taxable_line_data(
|
line_data = self._prepare_taxable_line_data(
|
||||||
line, inv, igst_amount, cgst_amount,
|
line, inv, igst_amount, cgst_amount,
|
||||||
sgst_amount, cess_amount, rate, tax)
|
sgst_amount, cess_amount, rate, tax)
|
||||||
|
|
||||||
if post.get('gst_invoice') in \
|
if post.get('gst_invoice') in \
|
||||||
['b2b', 'b2cl', 'b2cs', 'b2bur']:
|
['b2b', 'b2cl', 'b2cs', 'b2bur']:
|
||||||
line_data.update({
|
line_data.update({
|
||||||
@ -241,7 +241,7 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
if post.get('gst_invoice') == 'b2b':
|
if post.get('gst_invoice') == 'b2b':
|
||||||
line_data.update({
|
line_data.update({
|
||||||
'inv_type': 'Regular',
|
'inv_type': 'Regular',
|
||||||
'reverse_charge': 'N',
|
'reverse_charge': 'Y' if inv.reverse_charge else 'N',
|
||||||
})
|
})
|
||||||
if post.get('gst_invoice') == 'b2bur':
|
if post.get('gst_invoice') == 'b2bur':
|
||||||
supply_type = dict(inv.fields_get(
|
supply_type = dict(inv.fields_get(
|
||||||
@ -376,10 +376,14 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
invoice_domain)
|
invoice_domain)
|
||||||
for line in hsn_invoice_line_ids:
|
for line in hsn_invoice_line_ids:
|
||||||
igst_amount = cgst_amount = sgst_amount = cess_amount = 0.0
|
igst_amount = cgst_amount = sgst_amount = cess_amount = 0.0
|
||||||
if line.invoice_line_tax_ids:
|
if line.invoice_id.reverse_charge:
|
||||||
|
tax_lines = line.reverse_invoice_line_tax_ids
|
||||||
|
else:
|
||||||
|
tax_lines = line.invoice_line_tax_ids
|
||||||
|
if tax_lines:
|
||||||
price_unit = line.price_unit * (
|
price_unit = line.price_unit * (
|
||||||
1 - (line.discount or 0.0) / 100.0)
|
1 - (line.discount or 0.0) / 100.0)
|
||||||
taxes = line.invoice_line_tax_ids.compute_all(
|
taxes = tax_lines.compute_all(
|
||||||
price_unit, line.invoice_id.currency_id,
|
price_unit, line.invoice_id.currency_id,
|
||||||
line.quantity, line.product_id,
|
line.quantity, line.product_id,
|
||||||
line.invoice_id.partner_id)['taxes']
|
line.invoice_id.partner_id)['taxes']
|
||||||
@ -446,6 +450,7 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
no_of_recepient = 0
|
no_of_recepient = 0
|
||||||
|
|
||||||
for inv in result:
|
for inv in result:
|
||||||
|
if inv.get('reverse_charge') != 'Y':
|
||||||
taxable_value_total += float(inv['taxable_value'])
|
taxable_value_total += float(inv['taxable_value'])
|
||||||
igst_amount += float(inv['igst'])
|
igst_amount += float(inv['igst'])
|
||||||
sgst_amount += float(inv['sgst'])
|
sgst_amount += float(inv['sgst'])
|
||||||
@ -473,7 +478,7 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
invoice_value = 0.0
|
invoice_value = 0.0
|
||||||
for invoice_id in invoices_list:
|
for invoice_id in invoices_list:
|
||||||
ids = self.env['account.invoice'].search(
|
ids = self.env['account.invoice'].search(
|
||||||
[('number', '=', invoice_id)])
|
[('number', '=', invoice_id), ('reverse_charge', '=', False)])
|
||||||
invoice_value += ids.amount_total
|
invoice_value += ids.amount_total
|
||||||
summary.update({
|
summary.update({
|
||||||
"no_of_invoices": no_of_invoices,
|
"no_of_invoices": no_of_invoices,
|
||||||
|
@ -3,3 +3,4 @@ access_note_issue_reason_all,access_note_issue_reason_all,model_note_issue_reaso
|
|||||||
access_note_issue_reason,access_note_issue_reason,model_note_issue_reason,,1,0,0,0
|
access_note_issue_reason,access_note_issue_reason,model_note_issue_reason,,1,0,0,0
|
||||||
access_res_company_b2c_limit_all,access_res_company_b2c_limit_all,model_res_company_b2c_limit,base.group_system,1,1,1,1
|
access_res_company_b2c_limit_all,access_res_company_b2c_limit_all,model_res_company_b2c_limit,base.group_system,1,1,1,1
|
||||||
access_res_company_b2c_limit,access_res_company_b2c_limit,model_res_company_b2c_limit,,1,0,0,0
|
access_res_company_b2c_limit,access_res_company_b2c_limit,model_res_company_b2c_limit,,1,0,0,0
|
||||||
|
access_reverse_account_invoice_tax,access_reverse_account_invoice_tax,model_reverse_account_invoice_tax,,1,0,0,0
|
|
@ -77,6 +77,9 @@
|
|||||||
<field name="vat" readonly="1"
|
<field name="vat" readonly="1"
|
||||||
attrs="{'invisible': [('state', 'not in', ('open', 'paid'))]}"/>
|
attrs="{'invisible': [('state', 'not in', ('open', 'paid'))]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='date_due']" position="after">
|
||||||
|
<field name="reverse_charge" attrs="{'invisible': [('type', 'in', ['out_invoice', 'out_refund'])]}"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='partner_id']" position="after">
|
<xpath expr="//field[@name='partner_id']" position="after">
|
||||||
<field name="e_commerce_partner_id"
|
<field name="e_commerce_partner_id"
|
||||||
attrs="{'readonly': [('state', '!=', 'draft')]}"
|
attrs="{'readonly': [('state', '!=', 'draft')]}"
|
||||||
@ -85,6 +88,14 @@
|
|||||||
<xpath expr="//field[@name='tax_line_ids']" position="attributes">
|
<xpath expr="//field[@name='tax_line_ids']" position="attributes">
|
||||||
<attribute name="attrs">{'invisible': [('tax_line_ids', '=', [])]}</attribute>
|
<attribute name="attrs">{'invisible': [('tax_line_ids', '=', [])]}</attribute>
|
||||||
</xpath>
|
</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>
|
||||||
|
<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>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -112,5 +123,18 @@
|
|||||||
<field name="name">Nature of Transaction</field>
|
<field name="name">Nature of Transaction</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="view_in_reverse_invoice_tax_tree" model="ir.ui.view">
|
||||||
|
<field name="name">in_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>
|
||||||
|
|
||||||
|
|
||||||
</flectra>
|
</flectra>
|
@ -18,6 +18,9 @@
|
|||||||
<separator string="B2C Limit"/>
|
<separator string="B2C Limit"/>
|
||||||
<field name="company_b2c_limit_line"/>
|
<field name="company_b2c_limit_line"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='report_header']" position="after">
|
||||||
|
<field name="rc_gst_account_id" required="1"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ PostgreSQL server :
|
|||||||
In order to print PDF reports, you must install wkhtmltopdf_ yourself:
|
In order to print PDF reports, you must install wkhtmltopdf_ yourself:
|
||||||
the version of wkhtmltopdf_ available in debian repositories does not support
|
the version of wkhtmltopdf_ available in debian repositories does not support
|
||||||
headers and footers so it can not be installed automatically.
|
headers and footers so it can not be installed automatically.
|
||||||
The recommended version is 0.12.1 and is available on `the wkhtmltopdf download page`_,
|
The recommended version is 0.12.5 and is available on `the wkhtmltopdf download page`_,
|
||||||
in the archive section.
|
in the archive section.
|
||||||
|
|
||||||
Repository
|
Repository
|
||||||
@ -513,7 +513,7 @@ offcial Flectra `docker image <https://hub.docker.com/r/flectrahq/flectra/>`_ pa
|
|||||||
http://www.enterprisedb.com/products-services-training/pgdownload
|
http://www.enterprisedb.com/products-services-training/pgdownload
|
||||||
.. _Quilt: http://en.wikipedia.org/wiki/Quilt_(software)
|
.. _Quilt: http://en.wikipedia.org/wiki/Quilt_(software)
|
||||||
.. _saas: https://www.flectrahq.com
|
.. _saas: https://www.flectrahq.com
|
||||||
.. _the wkhtmltopdf download page: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/tag/0.12.1
|
.. _the wkhtmltopdf download page: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/tag/0.12.5
|
||||||
.. _UAC: http://en.wikipedia.org/wiki/User_Account_Control
|
.. _UAC: http://en.wikipedia.org/wiki/User_Account_Control
|
||||||
.. _wkhtmltopdf: http://wkhtmltopdf.org
|
.. _wkhtmltopdf: http://wkhtmltopdf.org
|
||||||
.. _pip: https://pip.pypa.io
|
.. _pip: https://pip.pypa.io
|
||||||
|
@ -44,6 +44,7 @@ def _get_wkhtmltopdf_bin():
|
|||||||
|
|
||||||
# Check the presence of Wkhtmltopdf and return its version at Flectra start-up
|
# Check the presence of Wkhtmltopdf and return its version at Flectra start-up
|
||||||
wkhtmltopdf_state = 'install'
|
wkhtmltopdf_state = 'install'
|
||||||
|
wkhtmltopdf_dpi_zoom_ratio = False
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
[_get_wkhtmltopdf_bin(), '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
[_get_wkhtmltopdf_bin(), '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||||
@ -61,6 +62,8 @@ else:
|
|||||||
wkhtmltopdf_state = 'upgrade'
|
wkhtmltopdf_state = 'upgrade'
|
||||||
else:
|
else:
|
||||||
wkhtmltopdf_state = 'ok'
|
wkhtmltopdf_state = 'ok'
|
||||||
|
if LooseVersion(version) >= LooseVersion('0.12.2'):
|
||||||
|
wkhtmltopdf_dpi_zoom_ratio = True
|
||||||
|
|
||||||
if config['workers'] == 1:
|
if config['workers'] == 1:
|
||||||
_logger.info('You need to start Flectra with at least two workers to print a pdf version of the reports.')
|
_logger.info('You need to start Flectra with at least two workers to print a pdf version of the reports.')
|
||||||
@ -206,7 +209,7 @@ class IrActionsReport(models.Model):
|
|||||||
:param set_viewport_size: Enable a viewport sized '1024x1280' or '1280x1024' depending of landscape arg.
|
:param set_viewport_size: Enable a viewport sized '1024x1280' or '1280x1024' depending of landscape arg.
|
||||||
:return: A list of string representing the wkhtmltopdf process command args.
|
:return: A list of string representing the wkhtmltopdf process command args.
|
||||||
'''
|
'''
|
||||||
command_args = []
|
command_args = ['--disable-local-file-access']
|
||||||
if set_viewport_size:
|
if set_viewport_size:
|
||||||
command_args.extend(['--viewport-size', landscape and '1024x1280' or '1280x1024'])
|
command_args.extend(['--viewport-size', landscape and '1024x1280' or '1280x1024'])
|
||||||
|
|
||||||
@ -234,14 +237,19 @@ class IrActionsReport(models.Model):
|
|||||||
else:
|
else:
|
||||||
command_args.extend(['--margin-top', str(paperformat_id.margin_top)])
|
command_args.extend(['--margin-top', str(paperformat_id.margin_top)])
|
||||||
|
|
||||||
|
dpi = None
|
||||||
if specific_paperformat_args and specific_paperformat_args.get('data-report-dpi'):
|
if specific_paperformat_args and specific_paperformat_args.get('data-report-dpi'):
|
||||||
command_args.extend(['--dpi', str(specific_paperformat_args['data-report-dpi'])])
|
dpi = int(specific_paperformat_args['data-report-dpi'])
|
||||||
elif paperformat_id.dpi:
|
elif paperformat_id.dpi:
|
||||||
if os.name == 'nt' and int(paperformat_id.dpi) <= 95:
|
if os.name == 'nt' and int(paperformat_id.dpi) <= 95:
|
||||||
_logger.info("Generating PDF on Windows platform require DPI >= 96. Using 96 instead.")
|
_logger.info("Generating PDF on Windows platform require DPI >= 96. Using 96 instead.")
|
||||||
command_args.extend(['--dpi', '96'])
|
dpi = 96
|
||||||
else:
|
else:
|
||||||
command_args.extend(['--dpi', str(paperformat_id.dpi)])
|
dpi = paperformat_id.dpi
|
||||||
|
if dpi:
|
||||||
|
command_args.extend(['--dpi', str(dpi)])
|
||||||
|
if wkhtmltopdf_dpi_zoom_ratio:
|
||||||
|
command_args.extend(['--zoom', str(96.0 / dpi)])
|
||||||
|
|
||||||
if specific_paperformat_args and specific_paperformat_args.get('data-report-header-spacing'):
|
if specific_paperformat_args and specific_paperformat_args.get('data-report-header-spacing'):
|
||||||
command_args.extend(['--header-spacing', str(specific_paperformat_args['data-report-header-spacing'])])
|
command_args.extend(['--header-spacing', str(specific_paperformat_args['data-report-header-spacing'])])
|
||||||
|
Loading…
Reference in New Issue
Block a user