Compare commits

..

No commits in common. "master" and "branch_mixin_fix" have entirely different histories.

57 changed files with 145 additions and 854 deletions

View File

@ -12,7 +12,7 @@ Core mechanisms for the accounting modules. To display the menuitems, install th
'category': 'Accounting',
'website': 'https://flectrahq.com/accounting',
'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'],
'depends' : ['base_setup', 'product', 'analytic', 'web_planner', 'portal', 'digest', 'base_branch_company'],
'depends' : ['base_setup', 'product', 'analytic', 'web_planner', 'portal', 'digest'],
'data': [
'security/account_security.xml',
'security/ir.model.access.csv',

View File

@ -1063,7 +1063,6 @@
<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 name="currencies">Currencies</h2>
<h2>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

@ -7,7 +7,7 @@
'version': '1.1',
'website' : 'https://flectrahq.com/accounting',
'category': 'Hidden/Dependency',
'depends' : ['base', 'decimal_precision', 'mail', 'base_branch_company'],
'depends' : ['base', 'decimal_precision', 'mail'],
'description': """
Module for defining analytic accounting object.
===============================================

View File

@ -92,19 +92,6 @@ class Users(models.Model):
_inherit = "res.users"
@api.multi
def read(self, fields=None, load='_classic_read'):
result = super(Users, self).read(fields, load=load)
self.with_context({'check_branch': True}).check_missing_branch()
return result
@api.multi
def check_missing_branch(self):
for user_id in self:
if self._context.get('check_branch', False) and user_id.company_id.branch_id and not user_id.default_branch_id:
user_id.default_branch_id = user_id.company_id.branch_id.id
user_id.branch_ids = [(4, user_id.company_id.branch_id.id)]
@api.model
def branch_default_get(self, user):
if not user:

View File

@ -134,7 +134,7 @@ class ResConfigSettings(models.TransientModel):
if self.activator_key and self.contract_id:
try:
set_param = self.env['ir.config_parameter'].sudo().set_param
binary = json.loads(base64.decodestring(self.activator_key).decode('utf-8')).encode('ascii')
binary = json.loads(base64.decodestring(self.activator_key)).encode('ascii')
binary = base64.decodestring(binary)
enc = json.dumps(decrypt(binary, self.contract_id))
if enc:

View File

@ -22,7 +22,6 @@
'web_tour',
'contacts',
'digest',
'base_branch_company'
],
'data': [
'security/crm_security.xml',

View File

@ -138,7 +138,7 @@
<field name="arch" type="xml">
<kanban default_group_by="stage_id"
class="o_kanban_small_column o_kanban_project_tasks"
on_create="quick_create" group_create="false">
on_create="quick_create">
<field name="id"/>
<field name="name"/>
<field name="team_id"/>

View File

@ -28,13 +28,6 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</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">
<field name="name">Job multi company rule</field>
<field name="model_id" ref="model_hr_job"/>

View File

@ -20,7 +20,6 @@ You can assign several contracts per employee.
'website': 'https://flectrahq.com/page/employees',
'depends': ['hr'],
'data': [
'security/contract_security.xml',
'security/ir.model.access.csv',
'data/hr_contract_data.xml',
'views/hr_contract_views.xml',

View File

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

View File

@ -19,10 +19,7 @@ class HrPayrollStructure(models.Model):
@api.model
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 False
return self.env.ref('hr_payroll.structure_base', False)
name = fields.Char(required=True)
code = fields.Char(string='Reference', required=True)

View File

@ -33,29 +33,5 @@
<field name="groups" eval="[(4, ref('hr_payroll.group_hr_payroll_manager'))]"/>
</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>
</flectra>

View File

@ -1643,6 +1643,7 @@
<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/res_config_view.xml',
'views/company_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,6 +70,12 @@
<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">18.0</field>
<field name="quantity">2.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">5.0</field>
<field name="quantity">1.0</field>
</record>
<function model="account.invoice.line" name="_onchange_product_id"
@ -69,231 +69,6 @@
<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"/>
@ -419,106 +194,4 @@
<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 res_config
from . import company
from . import sale
from . import purchase
from . import account_invoice

View File

@ -1,6 +1,7 @@
# 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):
@ -21,7 +22,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,
@ -62,14 +63,8 @@ class AccountInvoice(models.Model):
def action_invoice_open(self):
if not self.reverse_charge:
return super(AccountInvoice, self).action_invoice_open()
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')
if not self.company_id.rc_vat_account_id:
raise Warning(_('Define Reverse Charge Account in Company!'))
list_data = []
account_tax_obj = self.env['account.tax']
custom_amount = 0.0
@ -82,7 +77,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 = vat_account.id
account_id = self.company_id.vat_expense_account_id.id
list_data.append((0, 0, {
'name': tax_line.name,
'partner_id':
@ -114,22 +109,20 @@ 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, rc_account)))
(0, 0, self.get_move_line_vals(total_tax_amount - custom_amount)))
if custom_amount:
list_data.append((0, 0, self.get_move_line_vals(
custom_amount, customs_account)))
list_data.append((0, 0, self.get_move_line_vals(custom_amount)))
self.move_id.state = 'draft'
self.move_id.line_ids = list_data
self.move_id.post()
return res
@api.multi
def get_move_line_vals(self, credit, account_id):
def get_move_line_vals(self, credit):
return {
'name': '/',
'partner_id': self.partner_id.parent_id.id or self.partner_id.id,
'account_id': account_id.id,
'account_id': self.company_id.rc_vat_account_id.id,
'credit': credit,
'move_id': self.move_id.id,
'invoice_id': self.id,

View File

@ -0,0 +1,12 @@
# Part of Flectra. See LICENSE file for full copyright and licensing details.
from flectra import fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
rc_vat_account_id = fields.Many2one('account.account', 'Reverse Charge')
customs_duty_account_id = fields.Many2one(
'account.account', 'Customs Expense')
vat_expense_account_id = fields.Many2one('account.account', 'Vat Expense')

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

@ -1,34 +0,0 @@
# 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', required=True)
code = fields.Char('Code', required=True)
journal_id = fields.Many2one('account.journal', 'Journal', required=True)
name = fields.Char('Name')
code = fields.Char('Code')
journal_id = fields.Many2one('account.journal', 'Journal')
vat_type = fields.Selection([
('local_sale', 'Local Sale'),
('inside_gcc_sale', 'Inside GCC Sale'),
@ -18,7 +18,6 @@ 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')],
'VAT Type', required=True)
('designated_zone_purchase', 'Designated Zone Purchase')])
type = fields.Selection([
('sale', 'Sale'), ('purchase', 'Purchase')], 'Type', required=True)
('sale', 'Sale'), ('purchase', 'Purchase')], 'Type')

View File

@ -55,13 +55,9 @@ 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', '=', rc_account.id)])
('account_id', '=', self.main_company.rc_vat_account_id.id)])
self.assertEquals(move_line_id.credit, amount_tax)
def test_report_data(self):
@ -80,11 +76,11 @@ class TestAccountInvoice(TestAECommon):
dict_data = report_obj.get_report_values(None, data)
self.assertEquals(
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)
dict_data['get_local_sale']['amount'], 1770)
self.assertEquals(dict_data['get_local_sale']['tax_amount'], 88.5)
self.assertEquals(dict_data['get_local_sale']['adjustment'], 885)
self.assertEquals(
dict_data['get_local_sale']['return_tax_amount'], 221.25)
dict_data['get_local_sale']['return_tax_amount'], 44.25)
self.assertEquals(dict_data['get_local_purchase']['amount'], 17520)
self.assertEquals(dict_data['get_local_purchase']['tax_amount'], 876)
@ -100,5 +96,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(round(
dict_data['get_total_vat_due']['total_tax_amount'], 2), 587.40)
self.assertEquals(
dict_data['get_total_vat_due']['total_tax_amount'], -1050.75)

View File

@ -15,17 +15,6 @@
</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>
@ -63,17 +52,6 @@
</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

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<flectra>
<record id="uae_res_company_form_inherit" model="ir.ui.view">
<field name="name">uae.res.company.form.inherit</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='report_header']" position="after">
<field name="rc_vat_account_id" required="1"/>
<field name="customs_duty_account_id" required="1"/>
<field name="vat_expense_account_id" required="1"/>
</xpath>
</field>
</record>
</flectra>

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>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>
<t t-if="data['form']['date_from']"><strong>From</strong> <span t-esc="data['form']['date_from']"/><br/></t>
<t t-if="data['form']['date_to']"><strong>To </strong><span t-esc="data['form']['date_to']"/></t>
</div>
</div>
<table class="table" width="100%">
@ -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 Purchase</td>
<td rowspan="6" style="font-size: 14px; letter-spacing: 1px;">VAT on Purchas</td>
<td class="danger">Standard rated domestic purchases</td>
<td class="text-right"><span t-att-style="style" t-esc="get_local_purchase.get('amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
<td class="text-right"><span t-att-style="style" t-esc="get_local_purchase.get('adjustment')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></td>
@ -97,28 +97,28 @@
</tr>
<tr>
<td></td>
<td><b>Total VAT due for current period</b></td>
<td>Total VAT due for current period</td>
<td></td>
<td></td>
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_vat_due.get('total_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>
</tr>
<tr>
<td></td>
<td><b>Corrections from previous period</b></td>
<td>Corrections from previous period</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><b>VAT credit carried forword from previous period(s)</b></td>
<td>VAT credit carried forword from previous period(s)</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><b>Net VAT due</b></td>
<td>Net VAT due</td>
<td></td>
<td></td>
<td class="text-right"><b><span t-att-style="style" t-esc="get_total_vat_due.get('total_tax_amount')" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/></b></td>

View File

@ -1,46 +0,0 @@
<?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,13 +22,14 @@
<sheet>
<group>
<group>
<field name="name"/>
<field name="vat_type"/>
<field name="type"/>
<field name="name" required="1"/>
<field name="vat_type" required="1"/>
<field name="type" required="1"/>
</group>
<group>
<field name="code"/>
<field name="journal_id"/>
<field name="code" required="1"/>
<field name="journal_id" required="1"/>
<!-- <field name="reverse_charge" attrs="{'invisible': [('type', '!=', 'purchase')]}"/> -->
</group>
</group>
</sheet>
@ -37,7 +38,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>
@ -47,7 +48,7 @@
<menuitem id="menu_vat_config_type"
action="action_vat_config_type"
parent="account.account_account_menu"
parent="account.menu_finance_configuration"
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, api, _
from flectra import fields, models
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,12 +15,6 @@ 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>

View File

@ -17,7 +17,6 @@
'security/ir.model.access.csv',
'data/product_uom_data.xml',
'data/note_issue_reason_data.xml',
'data/res_company_data.xml',
'wizard/account_invoice_refund_view.xml',
'views/product_uom_view.xml',
'views/res_partner_view.xml',

View File

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

View File

@ -52,88 +52,6 @@ class AccountInvoice(models.Model):
readonly=True,
states={
'draft': [('readonly', False)]})
reverse_charge = fields.Boolean(
'Reverse Charge', readonly=True,
states={'draft': [('readonly', False)]})
reverse_tax_line_ids = fields.One2many(
'reverse.account.invoice.tax', 'invoice_id', string='Tax Lines',
readonly=True, states={'draft': [('readonly', False)]}, copy=False)
@api.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')
def _onchange_partner_id(self):
@ -142,31 +60,12 @@ class AccountInvoice(models.Model):
self.partner_id.partner_location = \
self.partner_id._get_partner_location_details(self.company_id)
@api.onchange('fiscal_position_id')
def _onchange_fiscal_position_id(self):
""" Onchange of Fiscal Position update tax values in invoice lines. """
if self.fiscal_position_id:
for line in self.invoice_line_ids:
line._set_taxes()
@api.multi
@api.returns('self')
def refund(self, date_invoice=None,
date=None, description=None, journal_id=None):
result = super(AccountInvoice, self).refund(
date_invoice=date_invoice, date=date,
description=description, journal_id=journal_id)
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
for line in self.invoice_line_ids:
line._set_taxes()
@api.multi
def action_move_create(self):
@ -229,14 +128,3 @@ class AccountInvoice(models.Model):
'gst_type': invoice.gst_type,
})
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)

View File

@ -20,7 +20,6 @@ class Company(models.Model):
default=time.strftime('2017-07-01'))
company_b2c_limit_line = fields.One2many('res.company.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):
result = {'vat': '', 'country_id': False}

View File

@ -135,6 +135,7 @@ class GSTR1Report(models.AbstractModel):
('gst_invoice', '=', 'b2b'), ('vat', '!=', False)]
if post.get('gst_invoice') == 'cdnur':
final_inv_domain = common_domain + refund_domain + cdnur_domain
final_invoice_ids = acc_invoice.search(final_inv_domain)
for inv in final_invoice_ids:
inv_data_list = []
@ -158,17 +159,15 @@ class GSTR1Report(models.AbstractModel):
for line in inv.invoice_line_ids:
cess_amount = igst_amount = cgst_amount = sgst_amount = 0.0
if inv.reverse_charge:
tax_lines = line.reverse_invoice_line_tax_ids
else:
tax_lines = line.invoice_line_tax_ids
if tax_lines:
if line.invoice_line_tax_ids:
price_unit = line.price_unit * (
1 - (line.discount or 0.0) / 100.0)
taxes = tax_lines.compute_all(
taxes = line.invoice_line_tax_ids.compute_all(
price_unit, line.invoice_id.currency_id,
line.quantity, line.product_id,
line.invoice_id.partner_id)['taxes']
for tax_data in taxes:
tax = acc_tax.browse(tax_data['id'])
if tax.tax_group_id.name == 'Cess':
@ -186,7 +185,7 @@ class GSTR1Report(models.AbstractModel):
'amount'] > 0):
sgst_amount += tax_data['amount']
for tax in tax_lines:
for tax in line.invoice_line_tax_ids:
rate = 0
if tax.id not in tax_list:
if tax.tax_group_id.name == 'IGST' \
@ -214,6 +213,7 @@ class GSTR1Report(models.AbstractModel):
line_data = self._prepare_taxable_line_data(
line, inv, igst_amount, cgst_amount,
sgst_amount, cess_amount, rate, tax)
if post.get('gst_invoice') in \
['b2b', 'b2cl', 'b2cs', 'b2bur']:
line_data.update({
@ -241,7 +241,7 @@ class GSTR1Report(models.AbstractModel):
if post.get('gst_invoice') == 'b2b':
line_data.update({
'inv_type': 'Regular',
'reverse_charge': 'Y' if inv.reverse_charge else 'N',
'reverse_charge': 'N',
})
if post.get('gst_invoice') == 'b2bur':
supply_type = dict(inv.fields_get(
@ -376,14 +376,10 @@ class GSTR1Report(models.AbstractModel):
invoice_domain)
for line in hsn_invoice_line_ids:
igst_amount = cgst_amount = sgst_amount = cess_amount = 0.0
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:
if line.invoice_line_tax_ids:
price_unit = line.price_unit * (
1 - (line.discount or 0.0) / 100.0)
taxes = tax_lines.compute_all(
taxes = line.invoice_line_tax_ids.compute_all(
price_unit, line.invoice_id.currency_id,
line.quantity, line.product_id,
line.invoice_id.partner_id)['taxes']
@ -450,11 +446,10 @@ class GSTR1Report(models.AbstractModel):
no_of_recepient = 0
for inv in result:
if inv.get('reverse_charge') != 'Y':
taxable_value_total += float(inv['taxable_value'])
igst_amount += float(inv['igst'])
sgst_amount += float(inv['sgst'])
cgst_amount += float(inv['cgst'])
taxable_value_total += float(inv['taxable_value'])
igst_amount += float(inv['igst'])
sgst_amount += float(inv['sgst'])
cgst_amount += float(inv['cgst'])
if post.get('gst_invoice') == 'b2b':
if inv['reverse_charge'] == 'N':
@ -478,7 +473,7 @@ class GSTR1Report(models.AbstractModel):
invoice_value = 0.0
for invoice_id in invoices_list:
ids = self.env['account.invoice'].search(
[('number', '=', invoice_id), ('reverse_charge', '=', False)])
[('number', '=', invoice_id)])
invoice_value += ids.amount_total
summary.update({
"no_of_invoices": no_of_invoices,

View File

@ -3,4 +3,3 @@ 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_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_reverse_account_invoice_tax,access_reverse_account_invoice_tax,model_reverse_account_invoice_tax,,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_note_issue_reason access_note_issue_reason model_note_issue_reason 1 0 0 0
4 access_res_company_b2c_limit_all access_res_company_b2c_limit_all model_res_company_b2c_limit base.group_system 1 1 1 1
5 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

View File

@ -77,9 +77,6 @@
<field name="vat" readonly="1"
attrs="{'invisible': [('state', 'not in', ('open', 'paid'))]}"/>
</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">
<field name="e_commerce_partner_id"
attrs="{'readonly': [('state', '!=', 'draft')]}"
@ -88,14 +85,6 @@
<xpath expr="//field[@name='tax_line_ids']" position="attributes">
<attribute name="attrs">{'invisible': [('tax_line_ids', '=', [])]}</attribute>
</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>
</record>
@ -123,18 +112,5 @@
<field name="name">Nature of Transaction</field>
</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>

View File

@ -18,9 +18,6 @@
<separator string="B2C Limit"/>
<field name="company_b2c_limit_line"/>
</xpath>
<xpath expr="//field[@name='report_header']" position="after">
<field name="rc_gst_account_id" required="1"/>
</xpath>
</field>
</record>

View File

@ -19,8 +19,7 @@
'web',
'web_planner',
'web_tour',
'digest',
'base_branch_company'
'digest'
],
'description': "",
'data': [

View File

@ -333,9 +333,7 @@
<a class="o_kanban_manage_toggle_button o_left" href="#" groups="project.group_project_manager"><i class="fa fa-ellipsis-v" /></a>
<span class="o_right"><field name="is_favorite" widget="boolean_favorite" nolabel="1" force_save="1" /></span>
</div>
<div t-if="record.displayed_image_id.value">
<field name="displayed_image_id" widget="attachment_image"/>
</div>
<div class="o_project_kanban_boxes">
<a class="o_project_kanban_box" name="%(act_project_project_2_project_task_all)d" type="action">
<div>

View File

@ -9,7 +9,7 @@
'sequence': 40,
'summary': 'A module for Scrum implementation',
'depends': [
'project', 'resource', 'base_branch_company'
'project', 'resource'
],
'data': [
'security/ir.model.access.csv',

View File

@ -10,7 +10,7 @@
'summary': 'Purchase Orders, Receipts, Vendor Bills',
'description': "",
'website': 'https://flectrahq.com/purchase',
'depends': ['stock_account', 'base_branch_company'],
'depends': ['stock_account'],
'data': [
'security/purchase_security.xml',
'security/ir.model.access.csv',

View File

@ -13,7 +13,6 @@
'depends': [
'purchase',
'purchase_requisition',
'base_branch_company'
],
'data': [
'security/ir.model.access.csv',

View File

@ -10,7 +10,7 @@
'description': """
This module contains all the common features of Sales Management and eCommerce.
""",
'depends': ['sales_team', 'account', 'portal', 'base_branch_company'],
'depends': ['sales_team', 'account', 'portal'],
'data': [
'security/sale_security.xml',
'security/ir.model.access.csv',

View File

@ -11,7 +11,7 @@ Using this application you can manage Sales Channels with CRM and/or Sales
===========================================================================
""",
'website': 'https://flectrahq.com/page/crm',
'depends': ['base', 'mail', 'base_branch_company'],
'depends': ['base', 'mail'],
'data': ['security/sales_team_security.xml',
'security/ir.model.access.csv',
'data/sales_team_data.xml',

View File

@ -8,7 +8,7 @@
'summary': 'Inventory, Logistics, Warehousing',
'description': "",
'website': 'https://flectrahq.com/page/warehouse',
'depends': ['product', 'barcodes', 'web_planner', 'base_branch_company'],
'depends': ['product', 'barcodes', 'web_planner'],
'category': 'Warehouse',
'sequence': 13,
'demo': [

View File

@ -135,7 +135,7 @@ class Location(models.Model):
('lot_stock_id', 'in', record.ids),
('wh_output_stock_loc_id', 'in', record.ids)])
for warehouse_id in warehouses_ids:
if record.branch_id and warehouse_id.branch_id and record.branch_id != warehouse_id.branch_id:
if record.branch_id and record.branch_id != warehouse_id.branch_id:
raise ValidationError(
_('Configuration Error of Branch:\n'
'The Location Branch (%s) and '

View File

@ -1867,44 +1867,13 @@ class ReportController(http.Controller):
class LicensingController(http.Controller):
@http.route('/flectra/licensing', type='http', auth="user")
def download(self, contract_id=None, type=None, binary='', **kwargs):
if type == 'offline':
filename = '%s.%s' % (FILENAME, EXT)
content = binary
return request.make_response(
content,
headers=[
('Content-Type', 'plain/text' or 'application/octet-stream'),
('Content-Disposition', content_disposition(filename))
]
)
elif type == 'online':
error = {
'code': 200,
'message': "Invalid License Key",
'data': ''
}
try:
if contract_id:
data = {
'data': binary,
'contract_id': contract_id
}
p = requests.post(
server_url + '/my/contract/validate/online',
params=data,
headers={'Content-type': 'plain/text' or 'application/octet-stream'})
content = json.loads(p.content.decode('utf-8'))
if 'activation_key' in content:
date = datetime.datetime.now() + datetime.timedelta(days=(12 * 30 * 1))
set_param = request.env['ir.config_parameter'].sudo().set_param
set_param('database.expiration_date', date)
set_param('contract.validity',
base64.encodestring(
encrypt(json.dumps(str(date)),str(date))))
if 'error_in_key' in content:
return request.make_response(html_escape(json.dumps(error)))
except Exception as e:
error['code'] = 400
error['message'] = 'Flectra Error!'
return request.make_response(html_escape(json.dumps(error)))
def download(self, binary='', **kwargs):
filename = '%s.%s' % (FILENAME, EXT)
content = binary
return request.make_response(
content,
headers=[
('Content-Type', 'plain/text' or 'application/octet-stream'),
('Content-Disposition', content_disposition(filename))
]
)

View File

@ -61,28 +61,17 @@ class Http(models.AbstractModel):
currencies = Currency.search([]).read(['symbol', 'position', 'decimal_places'])
return { c['id']: {'symbol': c['symbol'], 'position': c['position'], 'digits': [69,c['decimal_places']]} for c in currencies}
def get_contracted_modules(self, type=None, contract_key=None, ir_module_module_ids=None):
def get_contracted_modules(self, contract_key='', ir_module_module_ids=None):
if ir_module_module_ids:
contract_key = contract_key or ''
contracted_module_list = ir_module_module_ids.mapped('name')
warrant = self.env['publisher_warranty.contract'].sudo()._get_message()
warrant.update({
'contracts': contracted_module_list,
'contract_id': contract_key
})
if type != 'online':
contracts = encrypt(json.dumps(warrant), contract_key)
else:
contracts = str.encode(json.dumps(warrant))
contracts = encrypt(json.dumps(contracted_module_list), contract_key)
return contracts
@api.model
def contract_validate_file(self, contract_id, type):
contracts = []
if contract_id:
ir_module_module_ids = self.env['ir.module.module'].sudo().search(
[('contract_certificate', '!=', False), ('state', '=', 'installed')])
contracts = self.get_contracted_modules(type, contract_id, ir_module_module_ids)
def contract_validate_file(self, contract_id):
ir_module_module_ids = self.env['ir.module.module'].sudo().search(
[('contract_certificate', '!=', False), ('state', '=', 'installed')])
contracts = self.get_contracted_modules(contract_id,ir_module_module_ids)
return json.dumps(base64.encodestring(contracts).decode('ascii'))
def check_validate_date(self, config):

View File

@ -24,16 +24,15 @@ flectra.define('FlectraLicensing.DialogRegisterContract', function (require) {
save: function () {
var contract_id = this.$el.find('#contract_id').val();
var self = this;
var type = this.$el.find("input[name='activate']:checked").val();
if (!contract_id || !type) {
if (!contract_id) {
return;
}
rpc.query({
model: 'ir.http',
method: 'contract_validate_file',
args: [contract_id,type]
args: [contract_id]
}).done(function (bin) {
self.trigger('get_key', {'key': contract_id, 'binary': bin, 'type': type});
self.trigger('get_key', {'key': contract_id, 'binary': bin});
self.close();
});
}

View File

@ -244,17 +244,7 @@ return AbstractWebClient.extend({
session.get_file({
url: '/flectra/licensing',
data: {
'binary': key['binary'],
'type': key['type'],
'contract_id': key['key']
},
error: function (err) {
new require('web.Dialog').alert(null,err['message']);
},
success:function () {
if (key['type'] === 'online') {
window.location.reload();
}
'binary': key['binary']
}
});
});
@ -301,7 +291,7 @@ return AbstractWebClient.extend({
overlayCSS: {cursor: 'auto'}
});
self.contract_expired();
}, 150000);
}, 15000);
},
});

View File

@ -122,14 +122,6 @@
<div t-name="FlectraLicense.dialog_contract_registration" >
<div id="register_contract_form">
<div class="form-group">
<div>
<label for="activate_online">
<input id="activate_online" type="radio" name="activate" value="online">Online</input>
</label>
<label for="activate_offline">
<input id="activate_offline" type="radio" name="activate" value="offline" checked="">Offline</input>
</label>
</div>
<label for="contract_id">Contract ID</label>
<input type="text" class="form-control" id="contract_id" placeholder="Contract ID"/>
<input type="hidden" value=""/>

View File

@ -76,7 +76,7 @@ PostgreSQL server :
In order to print PDF reports, you must install wkhtmltopdf_ yourself:
the version of wkhtmltopdf_ available in debian repositories does not support
headers and footers so it can not be installed automatically.
The recommended version is 0.12.5 and is available on `the wkhtmltopdf download page`_,
The recommended version is 0.12.1 and is available on `the wkhtmltopdf download page`_,
in the archive section.
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
.. _Quilt: http://en.wikipedia.org/wiki/Quilt_(software)
.. _saas: https://www.flectrahq.com
.. _the wkhtmltopdf download page: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/tag/0.12.5
.. _the wkhtmltopdf download page: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/tag/0.12.1
.. _UAC: http://en.wikipedia.org/wiki/User_Account_Control
.. _wkhtmltopdf: http://wkhtmltopdf.org
.. _pip: https://pip.pypa.io

View File

@ -44,7 +44,6 @@ def _get_wkhtmltopdf_bin():
# Check the presence of Wkhtmltopdf and return its version at Flectra start-up
wkhtmltopdf_state = 'install'
wkhtmltopdf_dpi_zoom_ratio = False
try:
process = subprocess.Popen(
[_get_wkhtmltopdf_bin(), '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE
@ -62,8 +61,6 @@ else:
wkhtmltopdf_state = 'upgrade'
else:
wkhtmltopdf_state = 'ok'
if LooseVersion(version) >= LooseVersion('0.12.2'):
wkhtmltopdf_dpi_zoom_ratio = True
if config['workers'] == 1:
_logger.info('You need to start Flectra with at least two workers to print a pdf version of the reports.')
@ -209,7 +206,7 @@ class IrActionsReport(models.Model):
: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.
'''
command_args = ['--disable-local-file-access']
command_args = []
if set_viewport_size:
command_args.extend(['--viewport-size', landscape and '1024x1280' or '1280x1024'])
@ -237,19 +234,14 @@ class IrActionsReport(models.Model):
else:
command_args.extend(['--margin-top', str(paperformat_id.margin_top)])
dpi = None
if specific_paperformat_args and specific_paperformat_args.get('data-report-dpi'):
dpi = int(specific_paperformat_args['data-report-dpi'])
command_args.extend(['--dpi', str(specific_paperformat_args['data-report-dpi'])])
elif paperformat_id.dpi:
if os.name == 'nt' and int(paperformat_id.dpi) <= 95:
_logger.info("Generating PDF on Windows platform require DPI >= 96. Using 96 instead.")
dpi = 96
command_args.extend(['--dpi', '96'])
else:
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)])
command_args.extend(['--dpi', str(paperformat_id.dpi)])
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'])])