[IMP] account,analytic: UI/UX improvements
Miscellaneous improvements: 1. In analytic tags, the percentage is now a prefix. 2. In the widget, 0% accounts are now hidden. 3. In the analytic items list/pivot views, it is now possible to search by: - Financial Account. - Cross by. 4. By default, the pivot view is now grouped by plans and then analytic accounts. 5. An "Analytic Reporting" menuitem that opens the pivot view is added in Reporting > Management. task-3446504 closes odoo/odoo#130971 X-original-commit: adb8ec875c9b4e299147c46dc60a87fd26fff91f Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com> Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
<data>
|
||||
<xpath expr="//field[@name='date']" position="after">
|
||||
<field name="product_id"/>
|
||||
<field name="general_account_id"/>
|
||||
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
</xpath>
|
||||
<xpath expr="//group[@name='groupby']" position="after">
|
||||
@@ -64,7 +65,7 @@
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_line_pivot"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="account_id" position="after">
|
||||
<field name="partner_id" type="row"/>
|
||||
<field name="partner_id" type="row" invisible="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -79,5 +80,12 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_analytic_reporting" model="ir.actions.act_window">
|
||||
<field name="name">Analytic Reporting</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="view_mode">pivot</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<menuitem id="menu_finance_reports" name="Reporting" sequence="20" groups="account.group_account_readonly,account.group_account_invoice">
|
||||
<menuitem id="account_reports_management_menu" name="Management" sequence="4">
|
||||
<menuitem id="menu_action_account_invoice_report_all" name="Invoice Analysis" action="action_account_invoice_report_all" sequence="1"/>
|
||||
<menuitem id="menu_action_analytic_reporting" action="action_analytic_reporting"/>
|
||||
</menuitem>
|
||||
<menuitem id="account_reports_legal_statements_menu" name="Statement Reports" sequence="1" groups="account.group_account_readonly"/>
|
||||
</menuitem>
|
||||
|
||||
+1
-1
@@ -366,7 +366,7 @@ export class AnalyticDistribution extends Component {
|
||||
get tags() {
|
||||
return this.listReady.map((dist_tag) => ({
|
||||
id: dist_tag.id,
|
||||
text: `${dist_tag.analytic_account_name}${dist_tag.percentage > 99.99 && dist_tag.percentage < 100.01 ? "" : " " + this.formatPercentage(dist_tag.percentage)}`,
|
||||
text: `${dist_tag.percentage > 99.99 && dist_tag.percentage < 100.01 ? "" : this.formatPercentage(dist_tag.percentage) + " "}${dist_tag.analytic_account_name}`,
|
||||
colorIndex: dist_tag.color,
|
||||
group_id: dist_tag.group_id,
|
||||
onClick: (ev) => this.tagClicked(ev, dist_tag.id),
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@
|
||||
class="o_input"
|
||||
inputmode="numeric"
|
||||
type="text"
|
||||
t-att-value="formatPercentage(dist_tag.percentage)"
|
||||
t-att-value="dist_tag.analytic_account_id or dist_tag.percentage ? formatPercentage(dist_tag.percentage) : ''"
|
||||
t-on-click.stop=""
|
||||
t-on-change="(ev) => this.percentageChanged(dist_tag, ev)"/>
|
||||
</td>
|
||||
|
||||
@@ -152,11 +152,11 @@ QUnit.module("Analytic", (hooks) => {
|
||||
|
||||
assert.containsOnce(target, ".o_field_analytic_distribution", "widget should be visible");
|
||||
assert.containsN(target, ".badge", 2, "should contain 2 tags");
|
||||
assert.strictEqual(target.querySelector(".badge .o_tag_badge_text").textContent, "RD 30.3%",
|
||||
"should have rendered tag 'RD 30.3%'"
|
||||
assert.strictEqual(target.querySelector(".badge .o_tag_badge_text").textContent, "30.3% RD",
|
||||
"should have rendered tag '30.3% RD'"
|
||||
);
|
||||
assert.strictEqual(target.querySelectorAll(".badge .o_tag_badge_text")[1].textContent, "FI 69.7%",
|
||||
"should have rendered tag 'FI 69.7%'"
|
||||
assert.strictEqual(target.querySelectorAll(".badge .o_tag_badge_text")[1].textContent, "69.7% FI",
|
||||
"should have rendered tag '69.7% FI'"
|
||||
);
|
||||
|
||||
assert.containsN(target, ".o_delete", 2, "tags should contain a delete button");
|
||||
@@ -262,13 +262,13 @@ QUnit.module("Analytic", (hooks) => {
|
||||
await click(target.querySelector(".o_select_button"));
|
||||
|
||||
let percentageEls = [...popup.querySelectorAll("table#plan_5 .o_analytic_percentage input")];
|
||||
let expectedPercentages = ['100%', '0%', '0%'];
|
||||
let expectedPercentages = ['100%', '0%', ''];
|
||||
for (const [i, el] of percentageEls.entries()) {
|
||||
assert.equal(el.value, expectedPercentages[i], `1: Percentage Element ${i} should be ${expectedPercentages[i]}`);
|
||||
}
|
||||
// modify the percentage of tag 1, tag 2 is filled
|
||||
await editInput(percentageEls[0], null, "50");
|
||||
expectedPercentages = ['50%', '50%', '0%'];
|
||||
expectedPercentages = ['50%', '50%', ''];
|
||||
for (const [i, el] of percentageEls.entries()) {
|
||||
assert.equal(el.value, expectedPercentages[i], `2: Percentage Element ${i} should be ${expectedPercentages[i]}`);
|
||||
}
|
||||
@@ -290,21 +290,21 @@ QUnit.module("Analytic", (hooks) => {
|
||||
await click(target.querySelector(".o_select_button"));
|
||||
|
||||
percentageEls = [...popup.querySelectorAll("table#plan_5 .o_analytic_percentage input")];
|
||||
expectedPercentages = ['40%', '50%', '10%', '0%', '0%', '0%'];
|
||||
expectedPercentages = ['40%', '50%', '10%', '0%', '0%', ''];
|
||||
for (const [i, el] of percentageEls.entries()) {
|
||||
assert.equal(el.value, expectedPercentages[i], `4: Percentage Element ${i} should be ${expectedPercentages[i]}`);
|
||||
}
|
||||
|
||||
// modify percentage of the tag 1 (focused), balance goes to the first zero (tag 4)
|
||||
await editInput(document.activeElement, null, "10");
|
||||
expectedPercentages = ['10%', '50%', '10%', '30%', '0%', '0%'];
|
||||
expectedPercentages = ['10%', '50%', '10%', '30%', '0%', ''];
|
||||
for (const [i, el] of percentageEls.entries()) {
|
||||
assert.equal(el.value, expectedPercentages[i], `5: Percentage Element ${i} should be ${expectedPercentages[i]}`);
|
||||
}
|
||||
|
||||
// modify percentage of tag 4, balance goes to the first zero (tag 5)
|
||||
await editInput(percentageEls[3], null, "20");
|
||||
expectedPercentages = ['10%', '50%', '10%', '20%', '10%', '0%'];
|
||||
expectedPercentages = ['10%', '50%', '10%', '20%', '10%', ''];
|
||||
for (const [i, el] of percentageEls.entries()) {
|
||||
assert.equal(el.value, expectedPercentages[i], `6: Percentage Element ${i} should be ${expectedPercentages[i]}`);
|
||||
}
|
||||
@@ -326,7 +326,7 @@ QUnit.module("Analytic", (hooks) => {
|
||||
percentageEls = [...popup.querySelectorAll("table#plan_5 .o_analytic_percentage input")];
|
||||
expectedPercentages = ['10%', '50%', '10%', '30%'];
|
||||
for (const [i, el] of percentageEls.entries()) {
|
||||
assert.equal(el.value, expectedPercentages[i], `7: Percentage Element ${i} should be ${expectedPercentages[i]}`);
|
||||
assert.equal(el.value, expectedPercentages[i], `8: Percentage Element ${i} should be ${expectedPercentages[i]}`);
|
||||
}
|
||||
assert.equal(popup.querySelector("table#plan_5 tr:last-of-type .o_analytic_account_name input").value, "",
|
||||
"Last tag's account is empty");
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
<field name="account_id"/>
|
||||
<field name="account_id" string="Cross by" filter_domain="[('move_line_id.analytic_line_ids.account_id', 'ilike', self)]"/>
|
||||
<field name="plan_id"/>
|
||||
<filter string="Date" name="date" date="date"/>
|
||||
<filter string="Analytic Account" name="group_by_analytic_account" context="{'group_by': 'account_id'}"/>
|
||||
@@ -112,8 +113,9 @@
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Analytic Items" sample="1">
|
||||
<field name="plan_id" type="row"/>
|
||||
<field name="account_id" type="row"/>
|
||||
<field name="unit_amount" type="measure"/>
|
||||
<field name="date" interval="month" type="col"/>
|
||||
<field name="amount" type="measure"/>
|
||||
</pivot>
|
||||
</field>
|
||||
@@ -181,4 +183,4 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user