[IMP] account: add bank statement operation presets as template in l10n modules.
In details: * account.operation.template object renamed into account.reconcile.model * account.reconcile.model.template object created * added some records for l10n_be Was PR 11230
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
}
|
||||
if account_id:
|
||||
vals['account_id'] = account_id
|
||||
self._update('account.operation.template', 'account', vals, 'statement_operation_template_1')
|
||||
self._update(cr, uid, 'account.reconcile.model', 'account', vals, 'account_reconcile_model_1')
|
||||
-
|
||||
!python {model: ir.model.data, id: False} : |
|
||||
account_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_expenses')), ('tag_ids', '=', ref('account_tag_operating'))], limit=1).id
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
if account_id:
|
||||
vals['account_id'] = account_id
|
||||
self._update('account.operation.template', 'account', vals, 'statement_operation_template_2')
|
||||
self._update(cr, uid, 'account.reconcile.model', 'account', vals, 'account_reconcile_model_2')
|
||||
-
|
||||
!python {model: ir.model.data, id: False} : |
|
||||
account_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_revenue')), ('tag_ids', '=', ref('account_tag_operating'))], limit=1).id
|
||||
@@ -33,5 +33,5 @@
|
||||
}
|
||||
if account_id:
|
||||
vals['account_id'] = account_id
|
||||
self._update('account.operation.template', 'account', vals, 'statement_operation_template_3')
|
||||
self._update(cr, uid, 'account.reconcile.model', 'account', vals, 'account_reconcile_model_3')
|
||||
-
|
||||
|
||||
@@ -758,8 +758,8 @@ class AccountTax(models.Model):
|
||||
return incl_tax.compute_all(price)['total_excluded']
|
||||
return price
|
||||
|
||||
class AccountOperationTemplate(models.Model):
|
||||
_name = "account.operation.template"
|
||||
class AccountReconcileModel(models.Model):
|
||||
_name = "account.reconcile.model"
|
||||
_description = "Preset to create journal entries during a invoices and payments matching"
|
||||
|
||||
name = fields.Char(string='Button Label', required=True)
|
||||
|
||||
@@ -335,6 +335,9 @@ class AccountChartTemplate(models.Model):
|
||||
# Generate Fiscal Position , Fiscal Position Accounts and Fiscal Position Taxes from templates
|
||||
self.generate_fiscal_position(taxes_ref, account_ref, company)
|
||||
|
||||
# Generate account operation template templates
|
||||
self.generate_account_reconcile_model(taxes_ref, account_ref, company)
|
||||
|
||||
return account_ref, taxes_ref
|
||||
|
||||
@api.multi
|
||||
@@ -385,6 +388,38 @@ class AccountChartTemplate(models.Model):
|
||||
acc_template_ref[account_template.id] = new_account
|
||||
return acc_template_ref
|
||||
|
||||
@api.multi
|
||||
def generate_account_reconcile_model(self, tax_template_ref, acc_template_ref, company):
|
||||
""" This method for generating accounts from templates.
|
||||
|
||||
:param tax_template_ref: Taxes templates reference for write taxes_id in account_account.
|
||||
:param acc_template_ref: dictionary with the mappping between the account templates and the real accounts.
|
||||
:param company_id: company_id selected from wizard.multi.charts.accounts.
|
||||
:returns: return new_account_reconcile_model for reference purpose.
|
||||
:rtype: dict
|
||||
"""
|
||||
self.ensure_one()
|
||||
account_reconcile_models = self.env['account.reconcile.model.template'].search([])
|
||||
for account_reconcile_model in account_reconcile_models:
|
||||
vals = {
|
||||
'name': account_reconcile_model.name,
|
||||
'sequence': account_reconcile_model.sequence,
|
||||
'has_second_line': account_reconcile_model.has_second_line,
|
||||
'company_id': company.id,
|
||||
'account_id': acc_template_ref[account_reconcile_model.account_id.id],
|
||||
'label': account_reconcile_model.label,
|
||||
'amount_type': account_reconcile_model.amount_type,
|
||||
'amount': account_reconcile_model.amount,
|
||||
'tax_id': account_reconcile_model.tax_id and tax_template_ref[account_reconcile_model.tax_id.id] or False,
|
||||
'second_account_id': account_reconcile_model.second_account_id and acc_template_ref[account_reconcile_model.second_account_id.id] or False,
|
||||
'second_label': account_reconcile_model.second_label,
|
||||
'second_amount_type': account_reconcile_model.second_amount_type,
|
||||
'second_amount': account_reconcile_model.second_amount,
|
||||
'second_tax_id': account_reconcile_model.second_tax_id and tax_template_ref[account_reconcile_model.second_tax_id.id] or False,
|
||||
}
|
||||
self.create_record_with_xmlid(company, account_reconcile_model, 'account.reconcile.model', vals)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def generate_fiscal_position(self, tax_template_ref, acc_template_ref, company):
|
||||
""" This method generate Fiscal Position, Fiscal Position Accounts and Fiscal Position Taxes from templates.
|
||||
@@ -814,3 +849,27 @@ class AccountBankAccountsWizard(models.TransientModel):
|
||||
currency_id = fields.Many2one('res.currency', string='Account Currency',
|
||||
help="Forces all moves for this account to have this secondary currency.")
|
||||
account_type = fields.Selection([('cash', 'Cash'), ('bank', 'Bank')])
|
||||
|
||||
|
||||
class AccountReconcileModelTemplate(models.Model):
|
||||
_name = "account.reconcile.model.template"
|
||||
|
||||
name = fields.Char(string='Button Label', required=True)
|
||||
sequence = fields.Integer(required=True, default=10)
|
||||
has_second_line = fields.Boolean(string='Add a second line', default=False)
|
||||
account_id = fields.Many2one('account.account.template', string='Account', ondelete='cascade', domain=[('deprecated', '=', False)])
|
||||
label = fields.Char(string='Journal Item Label')
|
||||
amount_type = fields.Selection([
|
||||
('fixed', 'Fixed'),
|
||||
('percentage', 'Percentage of balance')
|
||||
], required=True, default='percentage')
|
||||
amount = fields.Float(digits=0, required=True, default=100.0, help="Fixed amount will count as a debit if it is negative, as a credit if it is positive.")
|
||||
tax_id = fields.Many2one('account.tax.template', string='Tax', ondelete='restrict', domain=[('type_tax_use', '=', 'purchase')])
|
||||
second_account_id = fields.Many2one('account.account.template', string='Second Account', ondelete='cascade', domain=[('deprecated', '=', False)])
|
||||
second_label = fields.Char(string='Second Journal Item Label')
|
||||
second_amount_type = fields.Selection([
|
||||
('fixed', 'Fixed'),
|
||||
('percentage', 'Percentage of amount')
|
||||
], string="Second Amount type",required=True, default='percentage')
|
||||
second_amount = fields.Float(string='Second Amount', digits=0, required=True, default=100.0, help="Fixed amount will count as a debit if it is negative, as a credit if it is positive.")
|
||||
second_tax_id = fields.Many2one('account.tax.template', string='Second Tax', ondelete='restrict', domain=[('type_tax_use', '=', 'purchase')])
|
||||
|
||||
@@ -109,9 +109,9 @@
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="account_operation_template_comp_rule">
|
||||
<field name="name">Account operation template company rule</field>
|
||||
<field name="model_id" ref="model_account_operation_template"/>
|
||||
<record model="ir.rule" id="account_reconcile_model_template_comp_rule">
|
||||
<field name="name">Account reconcile model template company rule</field>
|
||||
<field name="model_id" ref="model_account_reconcile_model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
@@ -63,7 +63,8 @@ access_account_financial_report,account.financial.report,model_account_financial
|
||||
access_account_financial_report_invoice,account.financial.report invoice,model_account_financial_report,account.group_account_invoice,1,0,0,0
|
||||
access_account_account_tax,account.account.tag,model_account_account_tag,account.group_account_user,1,0,0,0
|
||||
access_account_account_tax_user,account.account.tag,model_account_account_tag,account.group_account_invoice,1,0,0,0
|
||||
access_account_operation_template,account.operation.template,model_account_operation_template,account.group_account_user,1,1,1,1
|
||||
access_account_reconcile_model,account.reconcile.model,model_account_reconcile_model,account.group_account_user,1,1,1,1
|
||||
access_account_reconcile_model_template,account.reconcile.model.template,model_account_reconcile_model_template,account.group_account_user,1,1,1,1
|
||||
access_account_partial_reconcile_group_invoice,account.partial.reconcile.group.invoice,model_account_partial_reconcile,account.group_account_invoice,1,1,1,0
|
||||
access_account_partial_reconcile,account.partial.reconcile,model_account_partial_reconcile,account.group_account_user,1,1,1,1
|
||||
access_account_full_reconcile_group_invoice,account.full.reconcile.group.invoice,model_account_full_reconcile,account.group_account_invoice,1,1,1,0
|
||||
|
||||
|
@@ -76,7 +76,7 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, {
|
||||
this.formatCurrencies; // Method that formats the currency ; loaded from the server
|
||||
this.model_res_users = new Model("res.users");
|
||||
this.model_tax = new Model("account.tax");
|
||||
this.model_presets = new Model("account.operation.template");
|
||||
this.model_presets = new Model("account.reconcile.model");
|
||||
this.max_move_lines_displayed = 5;
|
||||
// Number of reconciliations loaded initially and by clicking 'show more'
|
||||
this.num_reconciliations_fetched_in_batch = 10;
|
||||
@@ -277,7 +277,7 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, {
|
||||
presetConfigCreateClickHandler: function(e) {
|
||||
e.preventDefault();
|
||||
var self = this;
|
||||
return self.rpc("/web/action/load", {action_id: "account.action_account_operation_template"}).then(function(result) {
|
||||
return self.rpc("/web/action/load", {action_id: "account.action_account_reconcile_model"}).then(function(result) {
|
||||
result.views = [[false, "form"], [false, "list"]];
|
||||
return self.do_action(result);
|
||||
});
|
||||
@@ -286,7 +286,7 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, {
|
||||
presetConfigEditClickHandler: function(e) {
|
||||
e.preventDefault();
|
||||
var self = this;
|
||||
return self.rpc("/web/action/load", {action_id: "account.action_account_operation_template"}).then(function(result) {
|
||||
return self.rpc("/web/action/load", {action_id: "account.action_account_reconcile_model"}).then(function(result) {
|
||||
result.views = [[false, "list"], [false, "form"]];
|
||||
return self.do_action(result);
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<span t-if="dashboard.number_to_reconcile == 0" class="text-muted">Nothing to Reconcile</span>
|
||||
</div>
|
||||
<div>
|
||||
<a type="object" name="open_action_with_context" context="{'action_name': 'action_account_operation_template', 'use_domain': True}" groups="account.group_account_manager">Reconciliation Models</a>
|
||||
<a type="object" name="open_action_with_context" context="{'action_name': 'action_account_reconcile_model', 'use_domain': True}" groups="account.group_account_manager">Reconciliation Models</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -753,9 +753,9 @@
|
||||
<field name="tag">manual_reconciliation_view</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_operation_template_form" model="ir.ui.view">
|
||||
<field name="name">account.operation.template.form</field>
|
||||
<field name="model">account.operation.template</field>
|
||||
<record id="view_account_reconcile_model_form" model="ir.ui.view">
|
||||
<field name="name">account.reconcile.model.form</field>
|
||||
<field name="model">account.reconcile.model</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Operation Templates">
|
||||
<sheet>
|
||||
@@ -806,9 +806,9 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_account_operation_template_tree" model="ir.ui.view">
|
||||
<field name="name">account.operation.template.tree</field>
|
||||
<field name="model">account.operation.template</field>
|
||||
<record id="view_account_reconcile_model_tree" model="ir.ui.view">
|
||||
<field name="name">account.reconcile.model.tree</field>
|
||||
<field name="model">account.reconcile.model</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Bank Reconciliation Move Presets">
|
||||
<field name="sequence" widget="handle" />
|
||||
@@ -819,9 +819,9 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_account_operation_template_search" model="ir.ui.view">
|
||||
<field name="name">account.operation.template.search</field>
|
||||
<field name="model">account.operation.template</field>
|
||||
<record id="view_account_reconcile_model_search" model="ir.ui.view">
|
||||
<field name="name">account.reconcile.model.search</field>
|
||||
<field name="model">account.reconcile.model</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Bank Reconciliation Move preset">
|
||||
<filter string="With tax" domain="[('tax_id','!=',False)]"/>
|
||||
@@ -830,12 +830,12 @@
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_account_operation_template" model="ir.actions.act_window">
|
||||
<record id="action_account_reconcile_model" model="ir.actions.act_window">
|
||||
<field name="name">Reconciliation Models</field>
|
||||
<field name="res_model">account.operation.template</field>
|
||||
<field name="res_model">account.reconcile.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_account_operation_template_search"/>
|
||||
<field name="search_view_id" ref="view_account_reconcile_model_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a reconciliation model.
|
||||
|
||||
@@ -48,8 +48,9 @@ Wizards provided by this module:
|
||||
'data/l10n_be_sequence_data.xml',
|
||||
'data/fiscal_templates_data.xml',
|
||||
'data/account_fiscal_position_tax_template_data.xml',
|
||||
'data/account_reconcile_model_template.xml',
|
||||
'data/account_chart_template_data.yml',
|
||||
'data/menuitem_data.xml'
|
||||
'data/menuitem_data.xml',
|
||||
],
|
||||
'demo': [
|
||||
'demo/l10n_be_demo.yml',
|
||||
|
||||
@@ -908,6 +908,13 @@
|
||||
<field name="chart_template_id" ref="l10nbe_chart_template"/>
|
||||
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_operating')])]"/>
|
||||
</record>
|
||||
<record id="a653" model="account.account.template">
|
||||
<field name="code">653</field>
|
||||
<field name="name">Escomptes clients</field>
|
||||
<field name="user_type_id" ref="account.data_account_type_expenses" />
|
||||
<field name="chart_template_id" ref="l10nbe_chart_template"/>
|
||||
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_financing')])]"/>
|
||||
</record>
|
||||
<record id="a654" model="account.account.template">
|
||||
<field name="name">Différences de change</field>
|
||||
<field name="code">654</field>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="escompte_template" model="account.reconcile.model.template">
|
||||
<field name="name">Escompte</field>
|
||||
<field name="account_id" ref="a653"/>
|
||||
<field name="amount_type">percentage</field>
|
||||
<field name="amount">100</field>
|
||||
<field name="label">Escompte accordé</field>
|
||||
</record>
|
||||
<record id="frais_bancaires_htva_template" model="account.reconcile.model.template">
|
||||
<field name="name">Frais bancaires HTVA</field>
|
||||
<field name="account_id" ref="a656" />
|
||||
<field name="amount_type">percentage</field>
|
||||
<field name="amount">100</field>
|
||||
<field name="label">Frais bancaires HTVA</field>
|
||||
</record>
|
||||
<record id="frais_bancaires_tva21_template" model="account.reconcile.model.template">
|
||||
<field name="name">Frais bancaires TVA21</field>
|
||||
<field name="account_id" ref="a656"/>
|
||||
<field name="amount_type">percentage</field>
|
||||
<field name="tax_id" ref="attn_TVA-21-inclus-dans-prix"/>
|
||||
<field name="amount">100</field>
|
||||
<field name="label">Frais bancaires TVA21</field>
|
||||
</record>
|
||||
<record id="virements_internes_template" model="account.reconcile.model.template">
|
||||
<field name="name">Virements internes</field>
|
||||
<field name="account_id" ref="trans"/>
|
||||
<field name="amount_type">percentage</field>
|
||||
<field name="amount">100</field>
|
||||
<field name="label">Virements internes</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -343,6 +343,19 @@
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="chart_template_id" ref="l10nbe_chart_template"/>
|
||||
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_81'), ref('tax_tag_85')])]"/>
|
||||
</record>
|
||||
<record id="attn_TVA-21-inclus-dans-prix" model="account.tax.template">
|
||||
<field name="sequence">12</field>
|
||||
<field name="description">21% Services - TTC</field>
|
||||
<field name="name">21% TVA</field>
|
||||
<field name="refund_account_id" ref="a411059"/>
|
||||
<field name="account_id" ref="a411059"/>
|
||||
<field name="price_include" eval="1"/>
|
||||
<field name="amount">21</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="type_tax_use">none</field>
|
||||
<field name="chart_template_id" ref="l10nbe_chart_template"/>
|
||||
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_82'), ref('tax_tag_85'), ref('tax_tag_63'), ref('tax_tag_59')])]"/>
|
||||
</record>
|
||||
<record id="attn_VAT-IN-V82-21-S" model="account.tax.template">
|
||||
<field name="sequence">210</field>
|
||||
|
||||
Reference in New Issue
Block a user