[IMP] account: show company name when accounting firm
Accounting firms are often connected to customer's company, so often single company database. To know easily in which company they work we think that it should be better to show the name of the company on the top for them. A systray item is therefore generated at the location of the company selector. It is visible only when there is a single company (so no company selector) and only when accounting firms mode is on, i.e. the setting field is set to either one of these values ('customer Invoices', 'Vendor Bills', 'Customer Invoices and Vendor Bills')
closes odoo/odoo#108928
Task: 3110453
Pr: 108928
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from . import sequence_mixin
|
||||
from . import partner
|
||||
from . import ir_http
|
||||
from . import res_partner_bank
|
||||
from . import account_account_tag
|
||||
from . import account_account
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models
|
||||
|
||||
|
||||
class IrHttp(models.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
|
||||
def session_info(self):
|
||||
result = super(IrHttp, self).session_info()
|
||||
result['is_quick_edit_mode_enabled'] = self.env.user._is_internal() and self.env.company.quick_edit_mode
|
||||
return result
|
||||
@@ -0,0 +1,26 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { Component } from "@odoo/owl";
|
||||
import { session } from '@web/session';
|
||||
|
||||
export class AccountSystrayItem extends Component {
|
||||
static template = "account.SystrayItem";
|
||||
static props = {};
|
||||
|
||||
setup() {
|
||||
this.currentCompany = useService("company").currentCompany;
|
||||
this.isQuickEditModeEnabled = session.is_quick_edit_mode_enabled;
|
||||
}
|
||||
}
|
||||
|
||||
export const systrayItem = {
|
||||
Component: AccountSystrayItem,
|
||||
isDisplayed : function(env) {
|
||||
const { availableCompanies } = env.services.company;
|
||||
return Object.keys(availableCompanies).length === 1;
|
||||
},
|
||||
};
|
||||
|
||||
registry.category("systray").add("AccountSystrayItem", systrayItem, { sequence: 1 });
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-name="account.SystrayItem" owl="1">
|
||||
<div t-if="isQuickEditModeEnabled">
|
||||
<a class="d-none d-md-block" t-esc="currentCompany.name"/>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user