Add field in Reconciliation (JavaScript) [Odoo 12]2019 Community Moderator ElectionCreate GUID / UUID in JavaScript?How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
How could a female member of a species produce eggs unto death?
Why do Australian milk farmers need to protest supermarkets' milk price?
Humans have energy, but not water. What happens?
Is all copper pipe pretty much the same?
How to make readers know that my work has used a hidden constraint?
Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?
If the Captain's screens are out, does he switch seats with the co-pilot?
Examples of odd-dimensional manifolds that do not admit contact structure
The three point beverage
Sword in the Stone story where the sword was held in place by electromagnets
It's a yearly task, alright
Rejected in 4th interview round citing insufficient years of experience
Time travel short story where dinosaur doesn't taste like chicken
Do Bugbears' arms literally get longer when it's their turn?
Can the druid cantrip Thorn Whip really defeat a water weird this easily?
Is a lawful good "antagonist" effective?
Force user to remove USB token
Who is our nearest neighbor
Confusion with the nameplate of an induction motor
Does Linux have system calls to access all the features of the file systems it supports?
Am I not good enough for you?
Single word request: Harming the benefactor
Extension of Splitting Fields over An Arbitrary Field
Word for a person who has no opinion about whether god exists
Add field in Reconciliation (JavaScript) [Odoo 12]
2019 Community Moderator ElectionCreate GUID / UUID in JavaScript?How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
I would like to add another field in the Reconciliation form. I just manage to add a label in the account_reconciliation.xml
but no selection just like the Account field.
account_reconciliation.xml
<div t-name="reconciliation.line.create">
<div class="quick_add">
<div class="btn-group o_reconcile_models" t-if="state.reconcileModels">
<t t-foreach="state.reconcileModels" t-as="reconcileModel">
<button class="btn btn-primary"
t-if="reconcileModel.rule_type === 'writeoff_button' && (reconcileModel.match_journal_ids.length == 0 || reconcileModel.match_journal_ids.includes(state.st_line.journal_id))"
t-att-data-reconcile-model-id="reconcileModel.id">
<t t-esc="reconcileModel.name"/>
</button>
</t>
<p t-if="!state.reconcileModels.length" style="color: #bbb;">To speed up reconciliation, define <a style="cursor: pointer;" class="reconcile_model_create">reconciliation models</a>.</p>
</div>
<div class="dropdown float-right">
<a data-toggle="dropdown" href="#"><span class="fa fa-cog" role="img" aria-label="Settings"/></a>
<div class="dropdown-menu dropdown-menu-right" role="menu" aria-label="Presets config">
<a role="menuitem" class="dropdown-item reconcile_model_create" href="#">Create model</a>
<a role="menuitem" class="dropdown-item reconcile_model_edit" href="#">Modify models</a>
</div>
</div>
</div>
<table class="float-left">
<tr class="create_account_id">
<td class="o_td_label">Account</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_tax_id">
<td class="o_td_label">Tax</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_account_id" groups="analytic.group_analytic_accounting">
<td class="o_td_label">Analytic Acc.</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_tag_ids" groups="analytic.group_analytic_tags">
<td class="o_td_label">Analytic Tags.</td>
<td class="o_td_field"></td>
<tr class="create_withholding_tax_id">
<td class="o_td_label">Withholding Tax</td>
<td class="o_td_field"></td>
</tr>
</tr>
</table>
....
I saw a .js file that inherits Reconciliation and added the new field but it was in Odoo 10 version.
odoo.define('withholding_module.withholding_tax_computation', function (require) {
"use strict";
var core = require('web.core');
var FieldMany2One = core.form_widget_registry.get('many2one');
var _t = core._t;
var accountReconciliation = require('account.reconciliation');
var abstractReconciliation = accountReconciliation.abstractReconciliation;
var abstractReconciliationLine = accountReconciliation.abstractReconciliationLine;
var manualReconciliationLine = accountReconciliation.manualReconciliationLine;
//ADD FIELDS
abstractReconciliation.include(
init: function(parent, context)
this._super(parent);
var form_fields = this.create_form_fields;
form_fields.withholding_tax_id =
id: "withholding_tax_id",
index: 25, // position in the form
corresponding_property: "withholding_tax_id", // a account.move.line field name
label: _t("Withholding Tax"),
required: false,
constructor: FieldMany2One,
field_properties:
relation: "account.tax",
string: _t("Withholding Tax"),
type: "many2one",
domain: [['amount', '<', 0.0]],
,
;
this.create_form_fields = form_fields;
);
abstractReconciliationLine.include(
prepareCreatedMoveLinesForPersisting: function(lines)
var dicts = this._super(lines);
for (var x=0; x<lines.length; x++)
for (var i=0; i<dicts.length; i++)
if (lines[x].label === dicts[i].name)
dicts[i]['withholding_tax_id'] = lines[x].withholding_tax_id;
console.log(dicts[i]['withholding_tax_id']);
;
;
;
return dicts;
);
//INHERIT ONCHANGE FUNCTION
abstractReconciliationLine.include(
formCreateInputChanged: function(elt, val)
self = this;
var mv_lines_selected = self.get("mv_lines_selected")
if (elt === self.withholding_tax_id_field && val.newValue !== false)
var withholding_tax_id = self.withholding_tax_id_field.get("value");
var mv_lines_selected = self.get("mv_lines_selected");
var withholding_account_id = self.withholding_tax_id
var line_created_being_edited = self.get("line_created_being_edited");
var mv_lines_amount = 0
self.amount_field.set("value", 0); //Reset Amount Value to Zero
_.each(mv_lines_selected, function(o) //Loop through chosen selected lines
if (o.tax_line_id.length == 0)
mv_lines_amount += o.base_amount;
//mv_lines_amount += (o.account_type === 'receivable') ? o.debit : o.credit;
;
);
self.model_tax
.call("json_friendly_compute_all", [[withholding_tax_id], mv_lines_amount, self.get("currency_id")])
.then(function(data) //compute taxes
$.each(data.taxes,function(index,tax)
var amount_value = self.amount_field.get("value") + Math.abs(tax.amount)
self.amount_field.set("value", amount_value); // set account
self.account_id_field.set("value", tax.account_id) //Set amount field
line_created_being_edited[0].amount = amount_value;
self.label_field.set("value",'Withholding Tax - ' + tax.name);
);
);
return this._super(elt,val);
);
It looks like this in a Odoo 10 Community version:
I just manage to create a label. What are the changes needed in reconciliation_model.js
file for Odoo 12 version to add the selection? I'm not quite familiar with JavaScript and saw that the .js files from Odoo 10 and Odoo 12 are different. Please help.
Tried adding the field in the view_account_reconcile_model_form
directly in the addons/account module but nothing happens.
<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>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name" placeholder="e.g. Bank Fees"/></h1>
</div>
<group>
<group>
<field name="rule_type" widget="radio"/>
</group>
<group>
<field name="auto_reconcile" attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
</group>
<group string="Conditions on Bank Statement Line">
<group>
<field name="match_journal_ids"
options="'no_create': True"
widget="many2many_tags"/>
<field name="match_nature" widget="radio"
attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<label for="match_amount"/>
<div>
<field name="match_amount" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_amount_min" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'lower'))], 'required': [('match_amount', '!=', False)]"/>
<span class="o_form_label"
attrs="'invisible': [('match_amount', '!=', 'between')]">and</span>
<field name="match_amount_max" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'greater'))], 'required': [('match_amount', '=', 'between')]"/>
</div>
<label for="match_label"/>
<div>
<field name="match_label" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_label_param" style="width: 68% !important;" class="oe_inline"
attrs="'invisible': [('match_label', '=', False)], 'required': [('match_label', '!=', False)]"/>
</div>
<field name="match_same_currency" attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_total_amount"
attrs="'invisible': ['"/>
<div attrs="'invisible': ['">
<field name="match_total_amount" class="oe_inline"/>
<field name="match_total_amount_param" class="oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]"/>
<span class="o_form_label oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]">%</span>
<div class="text-muted" attrs="', ('rule_type', '!=', 'invoice_matching'), ('match_total_amount', '=', False)]">
This parameter will be bypassed in case of a statement line communication matching exactly existing entries</div>
</div>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<field name="match_partner"
attrs="'invisible': [('rule_type', '!=', 'writeoff_suggestion')]"/>
<field name="match_partner"
string="Partner Is Set & Matches"
attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_partner_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
<label for="match_partner_category_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_category_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
</group>
</group>
<group string="Counterpart Values"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<group>
<field name="account_id" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="amount_type"/>
<field name="tax_id"
domain="[('company_id', '=', company_id)]"
options="'no_create': True"
context="'append_type_to_tax_name': True"/>
<field name="is_tax_price_included" invisible="1"/>
<field name="tax_amount_type" invisible="1"/>
<field name="force_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
<field name="withholding_tax_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group>
<field name="label"/>
<label for="amount"/>
<div>
<field name="amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="journal_id" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
<div class="oe_edit_only"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<field name="has_second_line" />
<label for="has_second_line" string="Add a second line"/>
</div>
<group attrs="'invisible':['">
<group>
<field name="second_account_id" string="Account" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="second_amount_type" string="Amount type"/>
<field name="second_tax_id"
string="Tax"
domain="[('company_id', '=', company_id)]"
widget="selection"
context="'append_type_to_tax_name': True"/>
<field name="is_second_tax_price_included" invisible="1"/>
<field name="second_tax_amount_type" invisible="1"/>
<field name="force_second_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="second_analytic_account_id" string="Analytic Account" groups="analytic.group_analytic_accounting"/>
<field name="second_analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
</group>
<group>
<field name="second_label" string="Journal Item Label"/>
<label for="second_amount" string="Amount"/>
<div>
<field name="second_amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="second_journal_id" string="Journal" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
javascript odoo odoo-10 odoo-12 odoo-accounting
add a comment |
I would like to add another field in the Reconciliation form. I just manage to add a label in the account_reconciliation.xml
but no selection just like the Account field.
account_reconciliation.xml
<div t-name="reconciliation.line.create">
<div class="quick_add">
<div class="btn-group o_reconcile_models" t-if="state.reconcileModels">
<t t-foreach="state.reconcileModels" t-as="reconcileModel">
<button class="btn btn-primary"
t-if="reconcileModel.rule_type === 'writeoff_button' && (reconcileModel.match_journal_ids.length == 0 || reconcileModel.match_journal_ids.includes(state.st_line.journal_id))"
t-att-data-reconcile-model-id="reconcileModel.id">
<t t-esc="reconcileModel.name"/>
</button>
</t>
<p t-if="!state.reconcileModels.length" style="color: #bbb;">To speed up reconciliation, define <a style="cursor: pointer;" class="reconcile_model_create">reconciliation models</a>.</p>
</div>
<div class="dropdown float-right">
<a data-toggle="dropdown" href="#"><span class="fa fa-cog" role="img" aria-label="Settings"/></a>
<div class="dropdown-menu dropdown-menu-right" role="menu" aria-label="Presets config">
<a role="menuitem" class="dropdown-item reconcile_model_create" href="#">Create model</a>
<a role="menuitem" class="dropdown-item reconcile_model_edit" href="#">Modify models</a>
</div>
</div>
</div>
<table class="float-left">
<tr class="create_account_id">
<td class="o_td_label">Account</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_tax_id">
<td class="o_td_label">Tax</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_account_id" groups="analytic.group_analytic_accounting">
<td class="o_td_label">Analytic Acc.</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_tag_ids" groups="analytic.group_analytic_tags">
<td class="o_td_label">Analytic Tags.</td>
<td class="o_td_field"></td>
<tr class="create_withholding_tax_id">
<td class="o_td_label">Withholding Tax</td>
<td class="o_td_field"></td>
</tr>
</tr>
</table>
....
I saw a .js file that inherits Reconciliation and added the new field but it was in Odoo 10 version.
odoo.define('withholding_module.withholding_tax_computation', function (require) {
"use strict";
var core = require('web.core');
var FieldMany2One = core.form_widget_registry.get('many2one');
var _t = core._t;
var accountReconciliation = require('account.reconciliation');
var abstractReconciliation = accountReconciliation.abstractReconciliation;
var abstractReconciliationLine = accountReconciliation.abstractReconciliationLine;
var manualReconciliationLine = accountReconciliation.manualReconciliationLine;
//ADD FIELDS
abstractReconciliation.include(
init: function(parent, context)
this._super(parent);
var form_fields = this.create_form_fields;
form_fields.withholding_tax_id =
id: "withholding_tax_id",
index: 25, // position in the form
corresponding_property: "withholding_tax_id", // a account.move.line field name
label: _t("Withholding Tax"),
required: false,
constructor: FieldMany2One,
field_properties:
relation: "account.tax",
string: _t("Withholding Tax"),
type: "many2one",
domain: [['amount', '<', 0.0]],
,
;
this.create_form_fields = form_fields;
);
abstractReconciliationLine.include(
prepareCreatedMoveLinesForPersisting: function(lines)
var dicts = this._super(lines);
for (var x=0; x<lines.length; x++)
for (var i=0; i<dicts.length; i++)
if (lines[x].label === dicts[i].name)
dicts[i]['withholding_tax_id'] = lines[x].withholding_tax_id;
console.log(dicts[i]['withholding_tax_id']);
;
;
;
return dicts;
);
//INHERIT ONCHANGE FUNCTION
abstractReconciliationLine.include(
formCreateInputChanged: function(elt, val)
self = this;
var mv_lines_selected = self.get("mv_lines_selected")
if (elt === self.withholding_tax_id_field && val.newValue !== false)
var withholding_tax_id = self.withholding_tax_id_field.get("value");
var mv_lines_selected = self.get("mv_lines_selected");
var withholding_account_id = self.withholding_tax_id
var line_created_being_edited = self.get("line_created_being_edited");
var mv_lines_amount = 0
self.amount_field.set("value", 0); //Reset Amount Value to Zero
_.each(mv_lines_selected, function(o) //Loop through chosen selected lines
if (o.tax_line_id.length == 0)
mv_lines_amount += o.base_amount;
//mv_lines_amount += (o.account_type === 'receivable') ? o.debit : o.credit;
;
);
self.model_tax
.call("json_friendly_compute_all", [[withholding_tax_id], mv_lines_amount, self.get("currency_id")])
.then(function(data) //compute taxes
$.each(data.taxes,function(index,tax)
var amount_value = self.amount_field.get("value") + Math.abs(tax.amount)
self.amount_field.set("value", amount_value); // set account
self.account_id_field.set("value", tax.account_id) //Set amount field
line_created_being_edited[0].amount = amount_value;
self.label_field.set("value",'Withholding Tax - ' + tax.name);
);
);
return this._super(elt,val);
);
It looks like this in a Odoo 10 Community version:
I just manage to create a label. What are the changes needed in reconciliation_model.js
file for Odoo 12 version to add the selection? I'm not quite familiar with JavaScript and saw that the .js files from Odoo 10 and Odoo 12 are different. Please help.
Tried adding the field in the view_account_reconcile_model_form
directly in the addons/account module but nothing happens.
<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>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name" placeholder="e.g. Bank Fees"/></h1>
</div>
<group>
<group>
<field name="rule_type" widget="radio"/>
</group>
<group>
<field name="auto_reconcile" attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
</group>
<group string="Conditions on Bank Statement Line">
<group>
<field name="match_journal_ids"
options="'no_create': True"
widget="many2many_tags"/>
<field name="match_nature" widget="radio"
attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<label for="match_amount"/>
<div>
<field name="match_amount" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_amount_min" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'lower'))], 'required': [('match_amount', '!=', False)]"/>
<span class="o_form_label"
attrs="'invisible': [('match_amount', '!=', 'between')]">and</span>
<field name="match_amount_max" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'greater'))], 'required': [('match_amount', '=', 'between')]"/>
</div>
<label for="match_label"/>
<div>
<field name="match_label" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_label_param" style="width: 68% !important;" class="oe_inline"
attrs="'invisible': [('match_label', '=', False)], 'required': [('match_label', '!=', False)]"/>
</div>
<field name="match_same_currency" attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_total_amount"
attrs="'invisible': ['"/>
<div attrs="'invisible': ['">
<field name="match_total_amount" class="oe_inline"/>
<field name="match_total_amount_param" class="oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]"/>
<span class="o_form_label oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]">%</span>
<div class="text-muted" attrs="', ('rule_type', '!=', 'invoice_matching'), ('match_total_amount', '=', False)]">
This parameter will be bypassed in case of a statement line communication matching exactly existing entries</div>
</div>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<field name="match_partner"
attrs="'invisible': [('rule_type', '!=', 'writeoff_suggestion')]"/>
<field name="match_partner"
string="Partner Is Set & Matches"
attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_partner_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
<label for="match_partner_category_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_category_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
</group>
</group>
<group string="Counterpart Values"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<group>
<field name="account_id" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="amount_type"/>
<field name="tax_id"
domain="[('company_id', '=', company_id)]"
options="'no_create': True"
context="'append_type_to_tax_name': True"/>
<field name="is_tax_price_included" invisible="1"/>
<field name="tax_amount_type" invisible="1"/>
<field name="force_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
<field name="withholding_tax_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group>
<field name="label"/>
<label for="amount"/>
<div>
<field name="amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="journal_id" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
<div class="oe_edit_only"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<field name="has_second_line" />
<label for="has_second_line" string="Add a second line"/>
</div>
<group attrs="'invisible':['">
<group>
<field name="second_account_id" string="Account" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="second_amount_type" string="Amount type"/>
<field name="second_tax_id"
string="Tax"
domain="[('company_id', '=', company_id)]"
widget="selection"
context="'append_type_to_tax_name': True"/>
<field name="is_second_tax_price_included" invisible="1"/>
<field name="second_tax_amount_type" invisible="1"/>
<field name="force_second_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="second_analytic_account_id" string="Analytic Account" groups="analytic.group_analytic_accounting"/>
<field name="second_analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
</group>
<group>
<field name="second_label" string="Journal Item Label"/>
<label for="second_amount" string="Amount"/>
<div>
<field name="second_amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="second_journal_id" string="Journal" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
javascript odoo odoo-10 odoo-12 odoo-accounting
Are you sure you need to be doing anything with JavaScript in the first place? It looks like you should be able to just inherit the view,view_account_reconcile_model_form
, to add your field.
– travisw
Mar 7 at 19:23
Hi @travisw I tried to add the filed in the 'view_account_reconcile_model_form' but the field is not added. I added the label in the 'account_reconciliation.xml' (under static folder) for the new field in '<div t-name="reconciliation.line.create">'.
– 7Eleven
Mar 8 at 5:37
Can you update your question with some more information? Use thetree
command to show your module structure? Also, include your view XML and your__manifest__.py
file for your module.
– travisw
Mar 8 at 5:41
@travisw I didn't modify it from a custom module but directly to the 'account' module to test it first. I'll update the question on how I added the field in the 'view_account_reconcile_model_form' and the added label. Please check.
– 7Eleven
Mar 8 at 6:08
@travisw Hi, did you check it Sir?
– 7Eleven
2 days ago
add a comment |
I would like to add another field in the Reconciliation form. I just manage to add a label in the account_reconciliation.xml
but no selection just like the Account field.
account_reconciliation.xml
<div t-name="reconciliation.line.create">
<div class="quick_add">
<div class="btn-group o_reconcile_models" t-if="state.reconcileModels">
<t t-foreach="state.reconcileModels" t-as="reconcileModel">
<button class="btn btn-primary"
t-if="reconcileModel.rule_type === 'writeoff_button' && (reconcileModel.match_journal_ids.length == 0 || reconcileModel.match_journal_ids.includes(state.st_line.journal_id))"
t-att-data-reconcile-model-id="reconcileModel.id">
<t t-esc="reconcileModel.name"/>
</button>
</t>
<p t-if="!state.reconcileModels.length" style="color: #bbb;">To speed up reconciliation, define <a style="cursor: pointer;" class="reconcile_model_create">reconciliation models</a>.</p>
</div>
<div class="dropdown float-right">
<a data-toggle="dropdown" href="#"><span class="fa fa-cog" role="img" aria-label="Settings"/></a>
<div class="dropdown-menu dropdown-menu-right" role="menu" aria-label="Presets config">
<a role="menuitem" class="dropdown-item reconcile_model_create" href="#">Create model</a>
<a role="menuitem" class="dropdown-item reconcile_model_edit" href="#">Modify models</a>
</div>
</div>
</div>
<table class="float-left">
<tr class="create_account_id">
<td class="o_td_label">Account</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_tax_id">
<td class="o_td_label">Tax</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_account_id" groups="analytic.group_analytic_accounting">
<td class="o_td_label">Analytic Acc.</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_tag_ids" groups="analytic.group_analytic_tags">
<td class="o_td_label">Analytic Tags.</td>
<td class="o_td_field"></td>
<tr class="create_withholding_tax_id">
<td class="o_td_label">Withholding Tax</td>
<td class="o_td_field"></td>
</tr>
</tr>
</table>
....
I saw a .js file that inherits Reconciliation and added the new field but it was in Odoo 10 version.
odoo.define('withholding_module.withholding_tax_computation', function (require) {
"use strict";
var core = require('web.core');
var FieldMany2One = core.form_widget_registry.get('many2one');
var _t = core._t;
var accountReconciliation = require('account.reconciliation');
var abstractReconciliation = accountReconciliation.abstractReconciliation;
var abstractReconciliationLine = accountReconciliation.abstractReconciliationLine;
var manualReconciliationLine = accountReconciliation.manualReconciliationLine;
//ADD FIELDS
abstractReconciliation.include(
init: function(parent, context)
this._super(parent);
var form_fields = this.create_form_fields;
form_fields.withholding_tax_id =
id: "withholding_tax_id",
index: 25, // position in the form
corresponding_property: "withholding_tax_id", // a account.move.line field name
label: _t("Withholding Tax"),
required: false,
constructor: FieldMany2One,
field_properties:
relation: "account.tax",
string: _t("Withholding Tax"),
type: "many2one",
domain: [['amount', '<', 0.0]],
,
;
this.create_form_fields = form_fields;
);
abstractReconciliationLine.include(
prepareCreatedMoveLinesForPersisting: function(lines)
var dicts = this._super(lines);
for (var x=0; x<lines.length; x++)
for (var i=0; i<dicts.length; i++)
if (lines[x].label === dicts[i].name)
dicts[i]['withholding_tax_id'] = lines[x].withholding_tax_id;
console.log(dicts[i]['withholding_tax_id']);
;
;
;
return dicts;
);
//INHERIT ONCHANGE FUNCTION
abstractReconciliationLine.include(
formCreateInputChanged: function(elt, val)
self = this;
var mv_lines_selected = self.get("mv_lines_selected")
if (elt === self.withholding_tax_id_field && val.newValue !== false)
var withholding_tax_id = self.withholding_tax_id_field.get("value");
var mv_lines_selected = self.get("mv_lines_selected");
var withholding_account_id = self.withholding_tax_id
var line_created_being_edited = self.get("line_created_being_edited");
var mv_lines_amount = 0
self.amount_field.set("value", 0); //Reset Amount Value to Zero
_.each(mv_lines_selected, function(o) //Loop through chosen selected lines
if (o.tax_line_id.length == 0)
mv_lines_amount += o.base_amount;
//mv_lines_amount += (o.account_type === 'receivable') ? o.debit : o.credit;
;
);
self.model_tax
.call("json_friendly_compute_all", [[withholding_tax_id], mv_lines_amount, self.get("currency_id")])
.then(function(data) //compute taxes
$.each(data.taxes,function(index,tax)
var amount_value = self.amount_field.get("value") + Math.abs(tax.amount)
self.amount_field.set("value", amount_value); // set account
self.account_id_field.set("value", tax.account_id) //Set amount field
line_created_being_edited[0].amount = amount_value;
self.label_field.set("value",'Withholding Tax - ' + tax.name);
);
);
return this._super(elt,val);
);
It looks like this in a Odoo 10 Community version:
I just manage to create a label. What are the changes needed in reconciliation_model.js
file for Odoo 12 version to add the selection? I'm not quite familiar with JavaScript and saw that the .js files from Odoo 10 and Odoo 12 are different. Please help.
Tried adding the field in the view_account_reconcile_model_form
directly in the addons/account module but nothing happens.
<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>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name" placeholder="e.g. Bank Fees"/></h1>
</div>
<group>
<group>
<field name="rule_type" widget="radio"/>
</group>
<group>
<field name="auto_reconcile" attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
</group>
<group string="Conditions on Bank Statement Line">
<group>
<field name="match_journal_ids"
options="'no_create': True"
widget="many2many_tags"/>
<field name="match_nature" widget="radio"
attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<label for="match_amount"/>
<div>
<field name="match_amount" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_amount_min" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'lower'))], 'required': [('match_amount', '!=', False)]"/>
<span class="o_form_label"
attrs="'invisible': [('match_amount', '!=', 'between')]">and</span>
<field name="match_amount_max" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'greater'))], 'required': [('match_amount', '=', 'between')]"/>
</div>
<label for="match_label"/>
<div>
<field name="match_label" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_label_param" style="width: 68% !important;" class="oe_inline"
attrs="'invisible': [('match_label', '=', False)], 'required': [('match_label', '!=', False)]"/>
</div>
<field name="match_same_currency" attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_total_amount"
attrs="'invisible': ['"/>
<div attrs="'invisible': ['">
<field name="match_total_amount" class="oe_inline"/>
<field name="match_total_amount_param" class="oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]"/>
<span class="o_form_label oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]">%</span>
<div class="text-muted" attrs="', ('rule_type', '!=', 'invoice_matching'), ('match_total_amount', '=', False)]">
This parameter will be bypassed in case of a statement line communication matching exactly existing entries</div>
</div>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<field name="match_partner"
attrs="'invisible': [('rule_type', '!=', 'writeoff_suggestion')]"/>
<field name="match_partner"
string="Partner Is Set & Matches"
attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_partner_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
<label for="match_partner_category_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_category_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
</group>
</group>
<group string="Counterpart Values"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<group>
<field name="account_id" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="amount_type"/>
<field name="tax_id"
domain="[('company_id', '=', company_id)]"
options="'no_create': True"
context="'append_type_to_tax_name': True"/>
<field name="is_tax_price_included" invisible="1"/>
<field name="tax_amount_type" invisible="1"/>
<field name="force_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
<field name="withholding_tax_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group>
<field name="label"/>
<label for="amount"/>
<div>
<field name="amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="journal_id" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
<div class="oe_edit_only"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<field name="has_second_line" />
<label for="has_second_line" string="Add a second line"/>
</div>
<group attrs="'invisible':['">
<group>
<field name="second_account_id" string="Account" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="second_amount_type" string="Amount type"/>
<field name="second_tax_id"
string="Tax"
domain="[('company_id', '=', company_id)]"
widget="selection"
context="'append_type_to_tax_name': True"/>
<field name="is_second_tax_price_included" invisible="1"/>
<field name="second_tax_amount_type" invisible="1"/>
<field name="force_second_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="second_analytic_account_id" string="Analytic Account" groups="analytic.group_analytic_accounting"/>
<field name="second_analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
</group>
<group>
<field name="second_label" string="Journal Item Label"/>
<label for="second_amount" string="Amount"/>
<div>
<field name="second_amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="second_journal_id" string="Journal" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
javascript odoo odoo-10 odoo-12 odoo-accounting
I would like to add another field in the Reconciliation form. I just manage to add a label in the account_reconciliation.xml
but no selection just like the Account field.
account_reconciliation.xml
<div t-name="reconciliation.line.create">
<div class="quick_add">
<div class="btn-group o_reconcile_models" t-if="state.reconcileModels">
<t t-foreach="state.reconcileModels" t-as="reconcileModel">
<button class="btn btn-primary"
t-if="reconcileModel.rule_type === 'writeoff_button' && (reconcileModel.match_journal_ids.length == 0 || reconcileModel.match_journal_ids.includes(state.st_line.journal_id))"
t-att-data-reconcile-model-id="reconcileModel.id">
<t t-esc="reconcileModel.name"/>
</button>
</t>
<p t-if="!state.reconcileModels.length" style="color: #bbb;">To speed up reconciliation, define <a style="cursor: pointer;" class="reconcile_model_create">reconciliation models</a>.</p>
</div>
<div class="dropdown float-right">
<a data-toggle="dropdown" href="#"><span class="fa fa-cog" role="img" aria-label="Settings"/></a>
<div class="dropdown-menu dropdown-menu-right" role="menu" aria-label="Presets config">
<a role="menuitem" class="dropdown-item reconcile_model_create" href="#">Create model</a>
<a role="menuitem" class="dropdown-item reconcile_model_edit" href="#">Modify models</a>
</div>
</div>
</div>
<table class="float-left">
<tr class="create_account_id">
<td class="o_td_label">Account</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_tax_id">
<td class="o_td_label">Tax</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_account_id" groups="analytic.group_analytic_accounting">
<td class="o_td_label">Analytic Acc.</td>
<td class="o_td_field"></td>
</tr>
<tr class="create_analytic_tag_ids" groups="analytic.group_analytic_tags">
<td class="o_td_label">Analytic Tags.</td>
<td class="o_td_field"></td>
<tr class="create_withholding_tax_id">
<td class="o_td_label">Withholding Tax</td>
<td class="o_td_field"></td>
</tr>
</tr>
</table>
....
I saw a .js file that inherits Reconciliation and added the new field but it was in Odoo 10 version.
odoo.define('withholding_module.withholding_tax_computation', function (require) {
"use strict";
var core = require('web.core');
var FieldMany2One = core.form_widget_registry.get('many2one');
var _t = core._t;
var accountReconciliation = require('account.reconciliation');
var abstractReconciliation = accountReconciliation.abstractReconciliation;
var abstractReconciliationLine = accountReconciliation.abstractReconciliationLine;
var manualReconciliationLine = accountReconciliation.manualReconciliationLine;
//ADD FIELDS
abstractReconciliation.include(
init: function(parent, context)
this._super(parent);
var form_fields = this.create_form_fields;
form_fields.withholding_tax_id =
id: "withholding_tax_id",
index: 25, // position in the form
corresponding_property: "withholding_tax_id", // a account.move.line field name
label: _t("Withholding Tax"),
required: false,
constructor: FieldMany2One,
field_properties:
relation: "account.tax",
string: _t("Withholding Tax"),
type: "many2one",
domain: [['amount', '<', 0.0]],
,
;
this.create_form_fields = form_fields;
);
abstractReconciliationLine.include(
prepareCreatedMoveLinesForPersisting: function(lines)
var dicts = this._super(lines);
for (var x=0; x<lines.length; x++)
for (var i=0; i<dicts.length; i++)
if (lines[x].label === dicts[i].name)
dicts[i]['withholding_tax_id'] = lines[x].withholding_tax_id;
console.log(dicts[i]['withholding_tax_id']);
;
;
;
return dicts;
);
//INHERIT ONCHANGE FUNCTION
abstractReconciliationLine.include(
formCreateInputChanged: function(elt, val)
self = this;
var mv_lines_selected = self.get("mv_lines_selected")
if (elt === self.withholding_tax_id_field && val.newValue !== false)
var withholding_tax_id = self.withholding_tax_id_field.get("value");
var mv_lines_selected = self.get("mv_lines_selected");
var withholding_account_id = self.withholding_tax_id
var line_created_being_edited = self.get("line_created_being_edited");
var mv_lines_amount = 0
self.amount_field.set("value", 0); //Reset Amount Value to Zero
_.each(mv_lines_selected, function(o) //Loop through chosen selected lines
if (o.tax_line_id.length == 0)
mv_lines_amount += o.base_amount;
//mv_lines_amount += (o.account_type === 'receivable') ? o.debit : o.credit;
;
);
self.model_tax
.call("json_friendly_compute_all", [[withholding_tax_id], mv_lines_amount, self.get("currency_id")])
.then(function(data) //compute taxes
$.each(data.taxes,function(index,tax)
var amount_value = self.amount_field.get("value") + Math.abs(tax.amount)
self.amount_field.set("value", amount_value); // set account
self.account_id_field.set("value", tax.account_id) //Set amount field
line_created_being_edited[0].amount = amount_value;
self.label_field.set("value",'Withholding Tax - ' + tax.name);
);
);
return this._super(elt,val);
);
It looks like this in a Odoo 10 Community version:
I just manage to create a label. What are the changes needed in reconciliation_model.js
file for Odoo 12 version to add the selection? I'm not quite familiar with JavaScript and saw that the .js files from Odoo 10 and Odoo 12 are different. Please help.
Tried adding the field in the view_account_reconcile_model_form
directly in the addons/account module but nothing happens.
<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>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name" placeholder="e.g. Bank Fees"/></h1>
</div>
<group>
<group>
<field name="rule_type" widget="radio"/>
</group>
<group>
<field name="auto_reconcile" attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
</group>
<group string="Conditions on Bank Statement Line">
<group>
<field name="match_journal_ids"
options="'no_create': True"
widget="many2many_tags"/>
<field name="match_nature" widget="radio"
attrs="'invisible': [('rule_type', '=', 'writeoff_button')]"/>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<label for="match_amount"/>
<div>
<field name="match_amount" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_amount_min" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'lower'))], 'required': [('match_amount', '!=', False)]"/>
<span class="o_form_label"
attrs="'invisible': [('match_amount', '!=', 'between')]">and</span>
<field name="match_amount_max" style="width: 30% !important;" class="oe_inline"
attrs="'invisible': [('match_amount', 'in', (False, 'greater'))], 'required': [('match_amount', '=', 'between')]"/>
</div>
<label for="match_label"/>
<div>
<field name="match_label" style="width: 30% !important" class="oe_inline"/>
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
<field name="match_label_param" style="width: 68% !important;" class="oe_inline"
attrs="'invisible': [('match_label', '=', False)], 'required': [('match_label', '!=', False)]"/>
</div>
<field name="match_same_currency" attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_total_amount"
attrs="'invisible': ['"/>
<div attrs="'invisible': ['">
<field name="match_total_amount" class="oe_inline"/>
<field name="match_total_amount_param" class="oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]"/>
<span class="o_form_label oe_inline"
attrs="'invisible': [('match_total_amount', '=', False)]">%</span>
<div class="text-muted" attrs="', ('rule_type', '!=', 'invoice_matching'), ('match_total_amount', '=', False)]">
This parameter will be bypassed in case of a statement line communication matching exactly existing entries</div>
</div>
</group>
<group attrs="'invisible': [('rule_type', '=', 'writeoff_button')]">
<field name="match_partner"
attrs="'invisible': [('rule_type', '!=', 'writeoff_suggestion')]"/>
<field name="match_partner"
string="Partner Is Set & Matches"
attrs="'invisible': [('rule_type', '!=', 'invoice_matching')]"/>
<label for="match_partner_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
<label for="match_partner_category_ids" class="ml16"
attrs="'invisible': [('match_partner', '=', False)]"/>
<field name="match_partner_category_ids" nolabel="1"
widget="many2many_tags"
attrs="'invisible': [('match_partner', '=', False)]"/>
</group>
</group>
<group string="Counterpart Values"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<group>
<field name="account_id" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="amount_type"/>
<field name="tax_id"
domain="[('company_id', '=', company_id)]"
options="'no_create': True"
context="'append_type_to_tax_name': True"/>
<field name="is_tax_price_included" invisible="1"/>
<field name="tax_amount_type" invisible="1"/>
<field name="force_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
<field name="withholding_tax_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group>
<field name="label"/>
<label for="amount"/>
<div>
<field name="amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="journal_id" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
<div class="oe_edit_only"
attrs="'invisible': [('rule_type', '=', 'invoice_matching'), '">
<field name="has_second_line" />
<label for="has_second_line" string="Add a second line"/>
</div>
<group attrs="'invisible':['">
<group>
<field name="second_account_id" string="Account" domain="[('company_id', '=', company_id)]"
attrs="', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]"/>
<field name="second_amount_type" string="Amount type"/>
<field name="second_tax_id"
string="Tax"
domain="[('company_id', '=', company_id)]"
widget="selection"
context="'append_type_to_tax_name': True"/>
<field name="is_second_tax_price_included" invisible="1"/>
<field name="second_tax_amount_type" invisible="1"/>
<field name="force_second_tax_included"
attrs="'invisible': ['" force_save="1"/>
<field name="second_analytic_account_id" string="Analytic Account" groups="analytic.group_analytic_accounting"/>
<field name="second_analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
</group>
<group>
<field name="second_label" string="Journal Item Label"/>
<label for="second_amount" string="Amount"/>
<div>
<field name="second_amount" class="oe_inline"/>
<span class="o_form_label oe_inline" attrs="'invisible':[('amount_type','!=','percentage')]">%</span>
</div>
<field name="second_journal_id" string="Journal" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"
attrs="'invisible': [('rule_type', '!=', 'writeoff_button')]"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
javascript odoo odoo-10 odoo-12 odoo-accounting
javascript odoo odoo-10 odoo-12 odoo-accounting
edited Mar 8 at 6:12
7Eleven
asked Mar 7 at 10:55
7Eleven7Eleven
35
35
Are you sure you need to be doing anything with JavaScript in the first place? It looks like you should be able to just inherit the view,view_account_reconcile_model_form
, to add your field.
– travisw
Mar 7 at 19:23
Hi @travisw I tried to add the filed in the 'view_account_reconcile_model_form' but the field is not added. I added the label in the 'account_reconciliation.xml' (under static folder) for the new field in '<div t-name="reconciliation.line.create">'.
– 7Eleven
Mar 8 at 5:37
Can you update your question with some more information? Use thetree
command to show your module structure? Also, include your view XML and your__manifest__.py
file for your module.
– travisw
Mar 8 at 5:41
@travisw I didn't modify it from a custom module but directly to the 'account' module to test it first. I'll update the question on how I added the field in the 'view_account_reconcile_model_form' and the added label. Please check.
– 7Eleven
Mar 8 at 6:08
@travisw Hi, did you check it Sir?
– 7Eleven
2 days ago
add a comment |
Are you sure you need to be doing anything with JavaScript in the first place? It looks like you should be able to just inherit the view,view_account_reconcile_model_form
, to add your field.
– travisw
Mar 7 at 19:23
Hi @travisw I tried to add the filed in the 'view_account_reconcile_model_form' but the field is not added. I added the label in the 'account_reconciliation.xml' (under static folder) for the new field in '<div t-name="reconciliation.line.create">'.
– 7Eleven
Mar 8 at 5:37
Can you update your question with some more information? Use thetree
command to show your module structure? Also, include your view XML and your__manifest__.py
file for your module.
– travisw
Mar 8 at 5:41
@travisw I didn't modify it from a custom module but directly to the 'account' module to test it first. I'll update the question on how I added the field in the 'view_account_reconcile_model_form' and the added label. Please check.
– 7Eleven
Mar 8 at 6:08
@travisw Hi, did you check it Sir?
– 7Eleven
2 days ago
Are you sure you need to be doing anything with JavaScript in the first place? It looks like you should be able to just inherit the view,
view_account_reconcile_model_form
, to add your field.– travisw
Mar 7 at 19:23
Are you sure you need to be doing anything with JavaScript in the first place? It looks like you should be able to just inherit the view,
view_account_reconcile_model_form
, to add your field.– travisw
Mar 7 at 19:23
Hi @travisw I tried to add the filed in the 'view_account_reconcile_model_form' but the field is not added. I added the label in the 'account_reconciliation.xml' (under static folder) for the new field in '<div t-name="reconciliation.line.create">'.
– 7Eleven
Mar 8 at 5:37
Hi @travisw I tried to add the filed in the 'view_account_reconcile_model_form' but the field is not added. I added the label in the 'account_reconciliation.xml' (under static folder) for the new field in '<div t-name="reconciliation.line.create">'.
– 7Eleven
Mar 8 at 5:37
Can you update your question with some more information? Use the
tree
command to show your module structure? Also, include your view XML and your __manifest__.py
file for your module.– travisw
Mar 8 at 5:41
Can you update your question with some more information? Use the
tree
command to show your module structure? Also, include your view XML and your __manifest__.py
file for your module.– travisw
Mar 8 at 5:41
@travisw I didn't modify it from a custom module but directly to the 'account' module to test it first. I'll update the question on how I added the field in the 'view_account_reconcile_model_form' and the added label. Please check.
– 7Eleven
Mar 8 at 6:08
@travisw I didn't modify it from a custom module but directly to the 'account' module to test it first. I'll update the question on how I added the field in the 'view_account_reconcile_model_form' and the added label. Please check.
– 7Eleven
Mar 8 at 6:08
@travisw Hi, did you check it Sir?
– 7Eleven
2 days ago
@travisw Hi, did you check it Sir?
– 7Eleven
2 days ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55042114%2fadd-field-in-reconciliation-javascript-odoo-12%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55042114%2fadd-field-in-reconciliation-javascript-odoo-12%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you sure you need to be doing anything with JavaScript in the first place? It looks like you should be able to just inherit the view,
view_account_reconcile_model_form
, to add your field.– travisw
Mar 7 at 19:23
Hi @travisw I tried to add the filed in the 'view_account_reconcile_model_form' but the field is not added. I added the label in the 'account_reconciliation.xml' (under static folder) for the new field in '<div t-name="reconciliation.line.create">'.
– 7Eleven
Mar 8 at 5:37
Can you update your question with some more information? Use the
tree
command to show your module structure? Also, include your view XML and your__manifest__.py
file for your module.– travisw
Mar 8 at 5:41
@travisw I didn't modify it from a custom module but directly to the 'account' module to test it first. I'll update the question on how I added the field in the 'view_account_reconcile_model_form' and the added label. Please check.
– 7Eleven
Mar 8 at 6:08
@travisw Hi, did you check it Sir?
– 7Eleven
2 days ago