初始提交

This commit is contained in:
2026-11-04 19:58:07 +08:00
commit 53b7d22429
829 changed files with 469986 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { AttachmentView } from "@mail/core/common/attachment_view";
import { onMounted, t, useProps } from "@odoo/owl";
import { useBus } from "@web/core/utils/hooks";
export class AccountAttachmentView extends AttachmentView {
static components = { AttachmentView };
openInPopout = useProps.static("openInPopout", t.boolean());
setPopout = useProps.static("setPopout", t.function());
setup() {
super.setup();
if (this.openInPopout) {
onMounted(this.onClickPopout);
}
// In the mail_popout_service.js the function pollClosedWindow will trigger a resize event on the main window
// when the external window is closed. It allow us to know when to hide the preview for small screens.
useBus(this.uiService.bus, "resize", () => this.setPopout(false));
}
}

View File

@@ -0,0 +1,105 @@
import { computed, proxy, t, useProps } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { SIZES } from "@web/core/ui/ui_utils";
import { useService } from "@web/core/utils/hooks";
import { ListController } from "@web/views/list/list_controller";
import { ListRenderer, listRendererProps } from "@web/views/list/list_renderer";
import { listView } from "@web/views/list/list_view";
import { AccountAttachmentView } from "./account_attachment_view";
export class AttachmentPreviewListController extends ListController {
static template = "account_accountant.AttachmentPreviewListView";
static components = {
...ListController.components,
AccountAttachmentView,
};
setup() {
super.setup();
/** @type {import("@mail/core/common/store_service").Store} */
this.store = useService("mail.store");
this.ui = useService("ui");
this.mailPopoutService = useService("mail.popout");
this.attachmentPreviewState = proxy({
displayAttachment: localStorage.getItem(this.previewerStorageKey) !== "false",
selectedRecord: false,
thread: null,
});
this.thread = computed(() => this.attachmentPreviewState.thread);
this.popout = proxy({ active: false });
}
get previewEnabled() {
return (
!this.env.searchModel.context.disable_preview &&
(this.ui.size >= SIZES.XXL || this.mailPopoutService.externalWindow)
);
}
togglePreview() {
this.attachmentPreviewState.displayAttachment =
!this.attachmentPreviewState.displayAttachment;
localStorage.setItem(
this.previewerStorageKey,
this.attachmentPreviewState.displayAttachment
);
}
setPopout(value) {
/**
* This function will set the popout value to false or true depending on the situation.
* We set popout to True when clicking on a line that has an attachment and then clicking on the popout button.
* Once the external page is closed, the popout is set to false again.
*/
if (this.attachmentPreviewState.thread?.attachmentsInWebClientView.length) {
this.popout.active = value;
}
}
async setThread(lineData, attachmentField, modelField) {
const attachments = lineData?.data[attachmentField]?.records || [];
if (!lineData || !attachments.length) {
this.attachmentPreviewState.thread = null;
return;
}
const thread = this.store["mail.thread"].insert({
attachments: attachments.map((attachment) => ({
id: attachment.resId,
mimetype: attachment.data.mimetype,
})),
id: lineData.data[modelField].id,
model: lineData.fields[modelField].relation,
});
if (!thread.message_main_attachment_id && thread.attachmentsInWebClientView.length > 0) {
thread.update({ message_main_attachment_id: thread.attachmentsInWebClientView[0] });
}
this.attachmentPreviewState.thread = thread;
}
}
export class AttachmentPreviewListRenderer extends ListRenderer {
props = useProps({
...listRendererProps,
setSelectedRecord: t.any(),
});
async onCellClicked(record, column, ev) {
this.props.setSelectedRecord(record);
await super.onCellClicked(record, column, ev);
}
findFocusFutureCell(cell, cellIsInGroupRow, direction) {
const futureCell = super.findFocusFutureCell(cell, cellIsInGroupRow, direction);
if (futureCell) {
const dataPointId = futureCell.closest("tr").dataset.id;
const record = this.props.list.records.filter((x) => x.id === dataPointId)[0];
this.props.setSelectedRecord(record);
}
return futureCell;
}
}
export const AccountAttachmentListView = {
...listView,
Renderer: AttachmentPreviewListRenderer,
Controller: AttachmentPreviewListController,
};
registry.category("views").add("account_attachment_list", AccountAttachmentListView);

View File

@@ -0,0 +1,67 @@
.o_move_line_list_view {
&.o_view_controller > .o_content {
overflow: hidden;
display: flex;
.o_list_renderer {
@include media-only(screen) {
overflow: auto;
height: 100%;
flex: 1 1 100%;
}
}
}
.o_attachment_preview {
height: 100%;
width: 40%;
.o_attachment_control.toggle {
border-radius: 0 30px 30px 0;
padding: 15px 15px 15px 5px;
&::after {
color: white;
content: '>>';
}
}
&.hidden {
width: 0;
.o_attachment_control.toggle {
right: 0;
border-radius: 30px 0 0 30px;
padding: 15px 0 15px 15px;
&::after {
content: '<';
}
&:hover {
padding-right: 5px;
::after {
content: '<<';
}
}
}
}
}
.o_popout_icon {
position: absolute;
top: 8%;
background-color: black;
opacity: 0.3;
margin-top: -15px;
transition: all 0.3s;
z-index: $zindex-dropdown; // due to the absolute position in o-mail-Attachment-imgContainer
right: 0;
border-radius: 30px 0 0 30px;
padding: 15px 0 15px 15px;
&:hover {
padding-right: 15px;
}
}
@include media-only(print) {
.o_search_panel {
display: none;
}
}
}

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="account_accountant.AttachmentPreviewListView" t-inherit="web.ListView">
<xpath expr="//div[@t-ref='this.rootRef']" position="attributes" type="add">
<attribute name="class" add="o_move_line_list_view" separator=" "/>
</xpath>
<xpath expr="//t[@t-component='this.props.Renderer']" position="attributes">
<attribute name="setSelectedRecord.bind">this.setSelectedRecord</attribute>
</xpath>
<xpath expr="//Layout" position="inside">
<t t-call="account_accountant.AttachmentPreview"/>
</xpath>
</t>
<t t-name="account_accountant.AttachmentPreview">
<div t-if="this.previewEnabled" class="o_attachment_preview d-print-none" t-att-class="{'hidden': !this.attachmentPreviewState.displayAttachment}">
<t t-if="this.attachmentPreviewState.displayAttachment">
<t t-if="this.attachmentPreviewState.thread and this.attachmentPreviewState.thread.attachmentsInWebClientView.length > 0">
<AccountAttachmentView thread="this.thread" openInPopout="false" setPopout.bind="this.setPopout"/>
</t>
<t t-elif="!this.attachmentPreviewState.selectedRecord">
<p class="text-center">Choose a line to preview its attachments.</p>
</t>
<t t-else="">
<p class="text-center">No attachments linked.</p>
</t>
</t>
<div class="o_attachment_control toggle d-none d-md-block ms-n3" t-on-click="this.togglePreview"/>
</div>
<t t-else="">
<div class="o_popout_icon d-none d-md-block" t-on-click="() => this.setPopout(true)">
<i class="oi" data-icon="fullscreen_exit" title="Open attachment in pop out"/>
</div>
<t t-if="this.popout.active">
<div class="o_attachment_preview d-print-none"
t-if="this.attachmentPreviewState.thread?.attachmentsInWebClientView.length"
>
<AccountAttachmentView thread="this.thread" openInPopout="true" setPopout.bind="this.setPopout"/>
</div>
</t>
</t>
</t>
</templates>

View File

@@ -0,0 +1,42 @@
import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
export const switchPartnerAccount = {
dependencies: ["bus_service", "notification", "orm"],
start(env, { bus_service, notification, orm }) {
bus_service.subscribe(
"switch_partner_account_notification",
({
current_partner_name,
potential_partner_name,
account_number,
partner_bank_id,
potential_partner_id,
}) => {
const closeNotification = notification.add(
_t(
"The bank account %(account_number)s is actually set to partner %(current_partner_name)s, click here to move it to partner %(potential_partner_name)s",
{ account_number, current_partner_name, potential_partner_name }
),
{
type: "info",
buttons: [
{
name: _t("Switch"),
onClick: async () => {
await orm.write("res.partner.bank", [partner_bank_id], {
partner_id: potential_partner_id,
});
closeNotification();
},
},
],
}
);
}
);
bus_service.start();
},
};
registry.category("services").add("switch_partner_account_notification", switchPartnerAccount);

View File

@@ -0,0 +1,80 @@
import { Component, useProps } from "@odoo/owl";
import { standardFieldProps } from "@web/views/fields/standard_field_props";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
class BankRecWidgetApplyAmountHtmlField extends Component {
props = useProps(standardFieldProps);
static template = "account_accountant.BankRecWidgetApplyAmountHtmlField";
setup() {
this.action = useService("action");
this.orm = useService("orm");
}
get value() {
return this.props.record.data[this.props.name];
}
async switchApplyAmount(ev) {
const root = this.env.model.root;
const fetchReconciledLines = async (fields = []) =>
await this.orm.searchRead(
"account.move.line",
[
[
"id",
"in",
...root.data.reconciled_lines_excluding_exchange_diff_ids._currentIds,
],
],
fields
);
const fetchStatementLines = async (fields = []) =>
await this.orm.searchRead(
"account.move.line",
[["move_id", "=", root.data.move_id.id]],
fields
);
if (ev.target.attributes.name?.value === "action_redirect_to_move") {
const [line] = await fetchReconciledLines([
"amount_residual",
"amount_residual_currency",
"move_id",
]);
await this.openMove(line.move_id[0]);
} else if (ev.target.attributes.name?.value === "apply_full_amount") {
const [line] = await fetchReconciledLines([
"amount_residual",
"amount_residual_currency",
]);
await root.update({
balance: root.data.balance - line.amount_residual,
amount_currency: root.data.amount_currency - line.amount_residual_currency,
});
} else if (ev.target.attributes.name?.value === "apply_partial_amount") {
const lines = await fetchStatementLines(["balance", "amount_currency"]);
// We have all the lines of the entry, we want the amount of the suspense line
await root.update({
balance: lines.at(-1).balance,
amount_currency: lines.at(-1).amount_currency,
});
}
}
openMove(moveId) {
this.action.doAction({
type: "ir.actions.act_window",
res_model: "account.move",
res_id: moveId,
views: [[false, "form"]],
target: "current",
});
}
}
const bankRecWidgetApplyAmountHtmlField = { component: BankRecWidgetApplyAmountHtmlField };
registry.category("fields").add("apply_amount_html", bankRecWidgetApplyAmountHtmlField);

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="account_accountant.BankRecWidgetApplyAmountHtmlField">
<div t-out="this.value" t-on-click="this.switchApplyAmount"/>
</t>
</templates>

View File

@@ -0,0 +1,68 @@
import { Component } from "@odoo/owl";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
const cogMenuRegistry = registry.category("cogMenu");
/**
* 'Run Auto Reconciliation' cog menu entry.
*
* Opens a wizard letting the user pick a journal and a starting date, then runs
* the auto reconciliation on the unreconciled bank statement lines in that range.
* Only displayed in the bank reconciliation widget views.
*/
export class AutoReconcileCogMenu extends Component {
static template = "account_accountant.AutoReconcileCogMenu";
static components = { DropdownItem };
setup() {
this.action = useService("action");
}
async openAutoReconcileWizard() {
const { context } = this.env.searchModel;
let journalId = false;
if (context.active_model === "account.journal") {
journalId = context.active_id;
} else if (context.default_journal_id) {
journalId = context.default_journal_id;
}
// clicking a cog menu item unmounts this component before
// the RPC resolves, and OWL's service protection would
// cancel the promise, preventing doAction from ever running.
// Accessing the orm service directly via this.env.services skips that
// lifecycle guard so the call completes even after unmount.
const action = await this.env.services.orm.call(
"account.journal",
"action_open_auto_reconcile_wizard",
[journalId]
);
return this.action.doAction(action);
}
}
export const autoReconcileCogMenuItem = {
Component: AutoReconcileCogMenu,
groupNumber: 5,
isDisplayed: ({ config }) => {
const ui = useService("ui");
return (
!ui.isSmall &&
config.actionType === "ir.actions.act_window" &&
["kanban", "list"].includes(config.viewType) &&
["bank_rec_widget_kanban", "bank_rec_list"].includes(config.viewSubType)
);
},
};
cogMenuRegistry.add("auto-reconcile-menu", autoReconcileCogMenuItem, { sequence: 5 });
registry.category("actions").add("bank_rec_reload_reconciled_lines", async (env, actionDescr) => {
const action = useService("action");
const bankReconciliation = useService("bankReconciliation");
await action.doAction({ type: "ir.actions.act_window_close" });
const { reconciled_ids } = actionDescr.params;
await bankReconciliation.reloadRecordsByIds(reconciled_ids);
});

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<templates id="template" xml:space="preserve">
<t t-name="account_accountant.AutoReconcileCogMenu">
<DropdownItem class="'o_auto_reconcile_menu'" onSelected.bind="this.openAutoReconcileWizard">
Run Auto Reconciliation
</DropdownItem>
</t>
</templates>

View File

@@ -0,0 +1,251 @@
.o_link_color {
background-color: $btn-link-color;
color: var(--o-navbar-badge-color, $o-navbar-badge-color);
}
.o_bank_reconciliation_container {
padding: 0;
font-size: $o-font-size-base;
// To show the chatter below the page.
@include media-breakpoint-between(md, xl) {
flex-direction: column;
height: 100dvh;
overflow: auto;
}
.user-select-text {
user-select: text;
}
.o_bank_rec_widget_chatter_container {
overflow: auto;
@include media-breakpoint-between(md, xl) {
height: 50%;
width: 100%;
}
}
.o_bank_reconciliation_kanban_renderer_mobile {
@include media-breakpoint-between(md, xl) {
min-height: 50%;
}
}
.o_bank_reconciliation_kanban_renderer {
--Kanban-padding: 0;
--Kanban-gap: 0;
height: 100%;
overflow: auto;
.o_statement_line {
border-left: calc(#{$border-width} * 4) solid transparent;
.o_grid_container {
display: grid;
grid-template-columns: 130px minmax(70px, auto) 110px;
gap: map-get($spacers, 1);
.o_row {
display: contents;
.activity-container {
position: relative;
}
.activity-badge {
margin-right: -.5em;
padding: ($o-navbar-badge-padding * .5) $o-navbar-badge-padding;
background-color: var(--o-navbar-badge-bg, #{$o-navbar-badge-bg});
font-size: $o-navbar-badge-size;
color: var(--o-navbar-badge-color, $o-navbar-badge-color);
text-shadow: var(--o-navbar-badge-text-shadow, #{$o-navbar-badge-text-shadow});
transform: translate(-0.6em, -30%);
}
.suggestion-dot {
position: absolute;
margin-right: -.5em;
padding: ($o-navbar-badge-padding * .5) $o-navbar-badge-padding;
text-shadow: var(--o-navbar-badge-text-shadow, #{$o-navbar-badge-text-shadow});
transform: translate(-0.6em, -30%);
height: 12px;
}
.o_payment_ref {
grid-column: 1 / 4;
span > span:last-child {
font-size: 13px;
}
.oi[data-icon="close_small"] {
font-size: 0.85em;
}
}
.o_line_name {
grid-column: 1 / 3;
}
.o_line_amount {
grid-column: 3 / 4;
}
.o_bg-black-10 {
background-color: RGBA(0, 0, 0, 0.1) !important;
}
}
}
.o_button_line {
grid-column: 1 / 3;
button {
min-width: 0;
max-width: 200px;
}
}
.o_chatter_icon {
visibility: hidden;
}
&:hover .o_chatter_icon {
visibility: visible;
}
&.o_selected_statement_line {
border-color: $primary;
}
}
.o_bank_reconciliation_quick_create .o_quick_create {
--columns: 1;
--gap: #{map-get($spacers, 3)};
@include media-breakpoint-up(md) {
grid-template-columns: 7rem 2fr 1fr 1fr 1fr;
}
}
}
}
.o_bank_reconciliation_container {
.o_kanban_record:not(.o_kanban_ghost) {
--Card-padding-v: 0;
--Card-padding-h: 0;
}
@include media-breakpoint-up(md) {
.o_bank_reconciliation_kanban_renderer {
.o_statement_line .o_grid_container {
grid-template-columns: 90px 3fr minmax(200px, 1fr) 1fr 40px;
column-gap: map-get($spacers, 3);
row-gap: map-get($spacers, 2);
line-height: 24px;
.o_row {
.o_line_name {
grid-column: 2 / 3;
}
.o_payment_ref {
grid-column: 2 / 3;
min-width: 0;
}
.o_line_amount {
grid-column: 4 / 5;
}
.o_line_to_reconcile_button {
grid-column: 5 / 6;
}
.o_button_line {
gap: map-get($spacers, 1);
align-items: center;
grid-column: 3 / 4;
button {
max-width: 100%;
}
}
}
}
.o_statement_btn {
transform: translate(map-get($spacers, 3) * -1, -50%);
padding: map-get($spacers, 1) * 0.5 map-get($spacers, 2);
opacity: 0;
}
.o_kanban_record:not(.o_kanban_ghost) {
border: 0;
border-bottom: $border-width solid $border-color;
margin: 0;
width: 100%;
@media (hover: hover) {
&:hover {
.o_statement_btn {
opacity: 1;
}
}
}
@media (hover: none) {
&:focus-within {
.o_statement_btn {
opacity: 1;
}
}
}
}
}
}
&:where(:has(.o_bank_rec_widget_chatter_container)) {
.o_kanban_record:focus, .o_kanban_record:has(.o_selected_statement_line) {
outline: none;
box-shadow: inset 0 0 0 $border-width $primary;
}
}
}
.o_bank_rec_dialog_list_view {
> .o_content {
overflow: hidden;
}
.o_bank_rec_list_renderer {
> table > thead {
position: sticky;
top: 54px;
z-index: 2;
}
}
}
.o_bank_rec_info_header {
position: sticky;
top: 0;
z-index: 3;
background-color: $o-view-background-color;
}
.o_bank_rec_statement_line_date {
margin-left: 27px;
}
.o_bank_rec_statement_line_remaining_amount {
margin-left: auto;
margin-right: 95px;
}
.o_bank_rec_ref {
min-height: 60px;
}

View File

@@ -0,0 +1,239 @@
import { EventBus, proxy } from "@odoo/owl";
import { browser } from "@web/core/browser/browser";
import { useService } from "@web/core/utils/hooks";
import { registry } from "@web/core/registry";
import { Domain } from "@web/core/domain";
export class BankReconciliationService {
constructor(env, services) {
this.env = env;
this.setup(env, services);
}
setup(env, services) {
this.bus = new EventBus();
this.orm = services["orm"];
this.batchedOrm = services["batchedOrm"];
this.chatterState = proxy({
visible:
JSON.parse(
browser.sessionStorage.getItem("isBankReconciliationWidgetChatterOpened")
) ?? false,
statementLine: null,
});
this.reconcileCountPerPartnerId = proxy({});
this.reconcileModelPerStatementLineId = proxy({});
this.availableReconcileLines = proxy({});
this.availableAnalyticAccounts = proxy({});
this.modelRootRecords = null;
}
toggleChatter() {
this.chatterState.visible = !this.chatterState.visible;
browser.sessionStorage.setItem(
"isBankReconciliationWidgetChatterOpened",
this.chatterState.visible
);
}
/**
* Specific function to open the chatter.
* For a particular case, where the customer clicks on
* the chatter icon directly on the bank statement line,
* we want to open the chatter but not close it.
*/
openChatter() {
this.chatterState.visible = true;
}
selectStatementLine(statementLine) {
this.chatterState.statementLine = statementLine;
}
reloadChatter() {
this.bus.trigger("MAIL:RELOAD-THREAD", {
model: "account.bank.statement.line",
id: this.statementLineId,
});
}
async computeAvailableReconcileLines(records) {
this.availableReconcileLines = await this.orm.searchRead(
"account.move.line",
this.getAvailableReconciledLinesDomain(records),
["id", "amount_currency", "date"],
{ limit: 100, order: "date desc" }
);
}
getAvailableReconciledLinesDomain(records) {
return [
["parent_state", "in", ["draft", "posted"]],
["company_id", "child_of", records.map((record) => record.data.company_id.id)],
["search_account_id.reconcile", "=", true],
["display_type", "not in", ["line_section", "line_note"]],
["reconciled", "=", false],
"|",
["search_account_id.account_type", "not in", ["asset_receivable", "liability_payable"]],
["payment_id", "=", false],
["statement_line_id", "not in", records.map((record) => record.resId)],
];
}
async computeReconcileLineCountPerPartnerId(records) {
const domain = this.getAvailableReconciledLinesDomain(records);
const partnerIds = records
.filter((record) => !!record.data.partner_id?.id)
.map((record) => record.data.partner_id.id);
const finalDomain = Domain.and([[["partner_id", "in", partnerIds]], domain]).toList();
const groups = await this.orm.formattedReadGroup(
"account.move.line",
finalDomain,
["partner_id"],
["id:count"]
);
this.reconcileCountPerPartnerId = {};
groups.forEach((group) => {
this.reconcileCountPerPartnerId[group.partner_id[0]] = group["id:count"];
});
}
async computeAvailableReconcileModels(records) {
this.reconcileModelPerStatementLineId =
Object.keys(records).length === 0
? {}
: await this.orm.call(
"account.reconcile.model",
"get_available_reconcile_model_per_statement_line",
[records.map((record) => record.resId)]
);
}
async updateAvailableReconcileModels(recordId) {
const result = await this.orm.call(
"account.reconcile.model",
"get_available_reconcile_model_per_statement_line",
[[recordId]]
);
this.reconcileModelPerStatementLineId[recordId] = result[recordId];
}
async checkAnalyticAccounts(analyticAccounts) {
const analyticAccountIds = analyticAccounts
? Object.keys(analyticAccounts)
.filter((key) => key != "__update__")
.map((key) => key.split(","))
.flat()
.map((id) => parseInt(id))
: [];
const missingIds = analyticAccountIds.filter((id) => !this.availableAnalyticAccounts[id]);
if (missingIds.length > 0) {
const newlyFetchedAccounts = await this.fetchAnalyticAccounts([
["id", "in", missingIds],
]);
this.availableAnalyticAccounts = {
...this.availableAnalyticAccounts,
...newlyFetchedAccounts,
};
}
}
async computeAvailableAnalyticAccounts(records) {
const allDistributions = records
.flatMap((record) => record.data.line_ids.records)
.filter((line) => line.data.analytic_distribution)
.map((line) => line.data.analytic_distribution);
const analyticAccountIds = [
...new Set(
allDistributions.flatMap((dist) =>
Object.keys(dist)
.filter((key) => key !== "__update__")
.flatMap((key) => key.split(","))
.map((id) => parseInt(id))
)
),
];
this.availableAnalyticAccounts = analyticAccountIds.length
? await this.fetchAnalyticAccounts([["id", "in", analyticAccountIds]])
: [];
}
async fetchAnalyticAccounts(domain) {
const args = {
domain: domain,
fields: ["id", "display_name", "root_plan_id", "color"],
context: [],
};
// batched call
const records = await this.batchedOrm.read(
"account.analytic.account",
domain[0][2],
args.fields,
{}
);
return Object.assign(
{},
...records.map((r) => {
const { id, ...rest } = r;
return { [id]: rest };
})
);
}
async reloadRecords(records) {
if (!records.length) {
return;
}
const { model, config } = records[0];
const resIds = records.map((r) => r.resId);
const results = await model._loadRecords({ ...config, resId: null, resIds });
for (const record of records) {
const data = results.find((r) => r.id === record.resId);
if (data) {
record._setData(data);
}
}
}
async reloadRecordsByIds(ids) {
if (!this.modelRootRecords || !ids.length) {
return;
}
const records = this.modelRootRecords.filter((r) => ids.includes(r.resId));
await this.reloadRecords(records);
}
get statementLineMove() {
return this.chatterState.statementLine?.data.move_id;
}
get statementLineMoveId() {
return this.statementLineMove?.id;
}
get statementLine() {
return this.chatterState.statementLine;
}
get statementLineId() {
return this.statementLine?.data?.id;
}
}
const bankReconciliationService = {
dependencies: ["orm", "batchedOrm"],
start(env, services) {
return new BankReconciliationService(env, services);
},
};
registry.category("services").add("bankReconciliation", bankReconciliationService);
export function useBankReconciliation() {
return proxy(useService("bankReconciliation"));
}

View File

@@ -0,0 +1,40 @@
import { FormController } from "@web/views/form/form_controller";
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog";
import { formView } from "@web/views/form/form_view";
import { onWillStart } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { user } from "@web/core/user";
export class BankRecFormDialog extends FormViewDialog {
setup() {
super.setup();
Object.assign(this.viewProps, {
buttonDialogTemplate: "accountant.BankRecFormDialog.buttons",
});
}
}
export class BankRecEditLineFormController extends FormController {
setup() {
super.setup();
this.isReviewed = this.props.context.is_reviewed;
onWillStart(async () => {
this.userCanReview = await user.hasGroup("account.group_account_user");
});
}
async toReviewButtonClicked(params = {}) {
await this.orm.call("account.move", "set_moves_checked", [
this.model.root.data.move_id.id,
false,
]);
return this.saveButtonClicked(params);
}
}
export const bankRecEditLineFormController = {
...formView,
Controller: BankRecEditLineFormController,
};
registry.category("views").add("bankrec_edit_line", bankRecEditLineFormController);

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="accountant.BankRecFormDialog.buttons" t-inherit="web.FormViewDialog.ToOne.buttons" t-inherit-mode="primary">
<xpath expr="//button[hasclass('o_form_button_save')]" position="attributes">
<attribute name="t-att-disabled">this.model.root.data.has_invalid_analytics</attribute>
</xpath>
<xpath expr="//button[hasclass('o_form_button_save')]" position="after">
<button
t-if="this.userCanReview and this.isReviewed"
class="btn btn-info"
t-on-click.stop="() => this.toReviewButtonClicked({closable: true})"
data-hotkey="q">
<span>To Review</span>
</button>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,20 @@
import { Component, useProps, t } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
export class BankRecButton extends Component {
static template = "account_accountant.BankRecButton";
props = useProps({
label: t.string().optional(),
action: t.function().optional(),
count: t.or([t.number(), t.literal(null)]).optional(),
primary: t.boolean().optional(false),
toReview: t.boolean().optional(),
classes: t.string().optional(""),
isLarge: t.boolean().optional(),
suggestion: t.number().optional(),
});
setup() {
this.ui = useService("ui");
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.BankRecButton">
<button
t-attf-class="d-flex gap-1 btn text-nowrap {{ this.props.classes }}"
t-att-class="{'btn-sm': !this.ui.isSmall and !this.props.isLarge, 'btn-primary': this.props.primary, 'btn-info': this.props.toReview, 'btn-secondary': !this.props.primary}"
t-on-click.stop="() => this.props?.action()"
>
<span t-out="this.props?.label" class="m-auto text-truncate"/>
<span class="rounded-pill px-2 o_bg-black-10" t-if="this.props?.count">
<t t-out="this.props.count"/>
</span>
</button>
</t>
</templates>

View File

@@ -0,0 +1,758 @@
import { BankRecButton } from "../button/button";
import { BankRecFileUploader } from "../file_uploader/file_uploader";
import { Component, useProps, t } from "@odoo/owl";
import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
import { Dropdown } from "@web/core/dropdown/dropdown";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { SelectCreateDialog } from "@web/views/view_dialogs/select_create_dialog";
import { BankRecSelectCreateDialog } from "../search_dialog/search_dialog";
import { MEDIAS_BREAKPOINTS, SIZES } from "@web/core/ui/ui_utils";
import { _t } from "@web/core/l10n/translation";
import { useOwnedDialogs, useService } from "@web/core/utils/hooks";
import { useBankReconciliation } from "../bank_reconciliation_service";
import { useHotkey } from "@web/core/hotkeys/hotkey_hook";
import { floatIsZero } from "@web/core/utils/numbers";
const mediaBreakpointLarge = MEDIAS_BREAKPOINTS[SIZES.LG];
export const bankRecButtonListProps = {
statementLineRootRef: t.function(),
statementLine: t.object(),
suspenseAccountLine: t.or([t.object(), t.boolean()]).optional(),
reconcileLineCount: t.or([t.number(), t.literal(null)]).optional(0),
reconcileModels: t.array(),
preSelectedReconciliationModel: t.object().optional(),
};
export class BankRecButtonList extends Component {
static template = "account_accountant.BankRecButtonList";
static components = {
Dropdown,
DropdownItem,
BankRecButton,
BankRecFileUploader,
};
props = useProps(bankRecButtonListProps);
setup() {
this.action = useService("action");
this.ui = useService("ui");
this.orm = useService("orm");
this.notificationService = useService("notification");
this.addDialog = useOwnedDialogs();
this.bankReconciliation = useBankReconciliation();
this.registerHotkeys();
}
restoreFocus() {
if (this.isLineSelected) {
this.props.statementLineRootRef().focus();
}
}
async _setPartnerOnReconcileLine(partner_id) {
await this.orm.call("account.bank.statement.line", "set_partner_bank_statement_line", [
this.statementLineData.id,
partner_id,
]);
const recordsToLoad = [];
if (this.statementLineData.partner_name) {
// Reload all impacted statement lines if we have a partner_name
recordsToLoad.push(
...this.env.model.root.records.filter(
(record) => record.data.partner_name === this.statementLineData.partner_name
)
);
} else {
recordsToLoad.push(this.props.statementLine);
}
await this.bankReconciliation.reloadRecords(recordsToLoad);
await this.bankReconciliation.computeReconcileLineCountPerPartnerId(
this.env.model.root.records
);
this.bankReconciliation.reloadChatter();
this.restoreFocus();
}
/**
* Displays a search dialog (no create option) for selecting a `res.partner` record.
*/
setPartnerOnReconcileLine() {
this.addDialog(
SelectCreateDialog,
{
title: _t("Search: Partner"),
noCreate: false,
multiSelect: false,
resModel: "res.partner",
context: { default_name: this.statementLineData.partner_name },
domain: [
"|",
["company_id", "in", [false, this.statementLineData.company_id.id]],
["company_id", "parent_of", this.statementLineData.company_id.id],
"|",
["parent_id", "=", false],
["is_company", "=", true],
],
onSelected: async (partner) => await this._setPartnerOnReconcileLine(partner[0]),
},
{
onClose: () => {
this.restoreFocus();
},
}
);
}
/**
* Opens a dialog to select an account and assigns it to the current reconcile line.
*/
setAccountOnReconcileLine() {
const context = {
list_view_ref: "account_accountant.view_account_list_bank_rec_widget",
search_view_ref: "account_accountant.view_account_search_bank_rec_widget",
...(this.statementLineData.amount > 0
? { preferred_account_type: "income" }
: { preferred_account_type: "expense" }),
};
this.addDialog(
SelectCreateDialog,
{
title: _t("Search: Account"),
noCreate: true,
multiSelect: false,
domain: [
[
"id",
"not in",
[
this.statementLineData.journal_id.suspense_account_id.id,
this.statementLineData.journal_id.default_account_id.id,
],
],
],
context: context,
resModel: "account.account",
onSelected: async (account) => {
// After setting an account on a line, a new reconciliation model may be automatically created. If so,
// we need to reload the records that will use this model to make sure the new model is displayed.
const linesToLoad = await this._setAccountOnReconcileLine(
this.lastAccountMoveLine.data.id,
account[0],
{ context: { account_default_taxes: true } }
);
const recordsToLoad = [
...this.env.model.root.records.filter((record) =>
linesToLoad.includes(record.data.id)
),
this.props.statementLine,
];
await this.bankReconciliation.reloadRecords(recordsToLoad);
this.bankReconciliation.reloadChatter();
this.restoreFocus();
},
},
{
onClose: () => {
this.restoreFocus();
},
}
);
}
/**
* Assigns the given account to a specific account move line within the current bank statement line.
*
* @param {number} amlId - ID of the account move line to update.
* @param {number} accountId - ID of the selected account to assign.
* @param {Object} context - the context to use for adding default tax of account
*
* @returns {Promise<list>} - The list of IDs of lines to reload in case of auto-rule creation.
*/
async _setAccountOnReconcileLine(amlId, accountId, context = {}) {
return await this.orm.call(
"account.bank.statement.line",
"set_account_bank_statement_line",
[this.statementLineData.id, amlId, accountId],
context
);
}
/**
* Sets the account receivable on the current reconcile line.
*/
async setAccountReceivableOnReconcileLine() {
let accountId;
if (this.statementLineData.partner_id.property_account_receivable_id.id) {
accountId = this.statementLineData.partner_id.property_account_receivable_id.id;
} else {
const account = await this.orm.webSearchRead(
"account.account",
[
["company_ids", "=", this.statementLineData.company_id.id],
["account_type", "=", "asset_receivable"],
],
{ specification: {}, limit: 1 }
);
accountId = account.records[0].id;
}
await this._setAccountOnReconcileLine(this.lastAccountMoveLine.data.id, accountId);
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
}
/**
* Sets the account payable on the current reconcile line.
*/
async setAccountPayableOnReconcileLine() {
let accountId;
if (this.statementLineData.partner_id.property_account_payable_id.id) {
accountId = this.statementLineData.partner_id.property_account_payable_id.id;
} else {
const account = await this.orm.webSearchRead(
"account.account",
[
["company_ids", "=", this.statementLineData.company_id.id],
["account_type", "=", "liability_payable"],
],
{ specification: {}, limit: 1 }
);
accountId = account.records[0].id;
}
await this._setAccountOnReconcileLine(this.lastAccountMoveLine.data.id, accountId);
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
}
get bankRecSelectCreateDialogContext() {
return {
statement_line_id: this.statementLineData.id,
kanban_view_ref: "account_accountant.view_account_move_line_kanban_bank_rec_widget",
list_view_ref: "account_accountant.view_account_move_line_list_bank_rec_widget",
search_view_ref: "account_accountant.view_account_move_line_search_bank_rec_widget",
preferred_aml_value: -this.props.suspenseAccountLine.amount_currency,
preferred_aml_currency_id: this.props.suspenseAccountLine.currency_id.id,
...(this.statementLineData.partner_id
? { search_default_partner_id: this.statementLineData.partner_id.id }
: {}),
};
}
/**
* Opens a dialog to search and select journal items to reconcile with the current bank statement line.
*/
reconcileOnReconcileLine() {
this.addDialog(
BankRecSelectCreateDialog,
{
title: _t("Search: Journal Items to Match"),
noCreate: true,
domain: this.bankReconciliation.getAvailableReconciledLinesDomain(
Array(this.props.statementLine)
),
resModel: "account.move.line",
size: "xl",
context: this.bankRecSelectCreateDialogContext,
onSelected: async (moveLines) => {
await this.orm.call(
"account.bank.statement.line",
"set_line_bank_statement_line",
[this.statementLineData.id, moveLines]
);
await this.bankReconciliation.computeReconcileLineCountPerPartnerId(
this.env.model.root.records
);
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
this.restoreFocus();
},
suspenseAccountLine: this.props.suspenseAccountLine,
reference: this.statementLineData.payment_ref,
date: this.statementLineData.date,
},
{
onClose: () => {
this.restoreFocus();
},
}
);
}
get availableReconcileLines() {
// No need to compute the number of lines that could be reconciled with the statement line
// because having a partner will trigger the try_auto_reconcile function and it should be reconciled
if (this.statementLineData.partner_id) {
return [];
}
const statementLineAmount =
this.statementLineData.amount_currency || this.statementLineData.amount;
const decimalPlaces =
this.statementLineData.foreign_currency_id?.decimal_places ||
this.statementLineData.currency_id?.decimal_places;
return this.bankReconciliation.availableReconcileLines.filter((line) =>
floatIsZero(line.amount_currency - statementLineAmount, decimalPlaces)
);
}
/**
* Deletes the current bank statement line.
*/
async deleteTransaction() {
this.addDialog(ConfirmationDialog, {
body: _t("Are you sure you want to delete this statement line?"),
confirm: async () => {
await this.orm.call("account.bank.statement.line", "delete_statement_line", [
this.statementLineData.id,
]);
this.env.model.load();
},
cancel: () => {},
});
}
/**
* Set the move of the statement line as to check
*/
async setStatementLineAsReviewed() {
await this.orm.call("account.move", "set_moves_checked", [
this.statementLineData.move_id.id,
]);
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
}
// -----------------------------------------------------------------------------
// Reconciliation Model
// -----------------------------------------------------------------------------
/**
* Applies a reconciliation model to the current bank statement line.
*
* @param {Object} reconciliationModel - The reconciliation model to apply.
*/
async triggerReconciliationModel(reconciliationModel) {
if (
reconciliationModel.use_count >= 2 &&
reconciliationModel.is_asking_for_autopost &&
reconciliationModel.created_automatically
) {
const closeNotification = this.notificationService.add(
_t(
"You have successfully reconciled 3 transactions with %s, what about automate this reconciliation ?",
reconciliationModel.display_name
),
{
type: "info",
buttons: [
{
name: _t("Automate"),
onClick: async () => {
await this.env.services.orm.write(
"account.reconcile.model",
[reconciliationModel.id],
{
trigger: "auto_reconcile",
created_automatically: false,
is_asking_for_autopost: false,
}
);
this.env.model.load();
closeNotification();
},
},
{
name: _t("Never"),
onClick: async () => {
await this.env.services.orm.write(
"account.reconcile.model",
[reconciliationModel.id],
{
is_asking_for_autopost: false,
}
);
this.env.model.load();
closeNotification();
},
},
],
}
);
}
await this._trigger_reconciliation_model(reconciliationModel);
}
async _trigger_reconciliation_model(reconciliationModel) {
await this.orm.call("account.reconcile.model", "trigger_reconciliation_model", [
reconciliationModel.id,
this.statementLineData.id,
]);
await this.bankReconciliation.computeReconcileLineCountPerPartnerId(
this.env.model.root.records
);
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
}
/**
* Retrieves the corresponding action, condition, and button element for a given key.
* This function is part of a keydown event handler that maps specific key presses to actions
* on the reconciliation line, such as setting a partner or reconciling an account.
* It checks if a line is selected and if the relevant button exists before returning the action details.
*
* @param {string|number} key - The key pressed.
* @returns {Object|undefined} An object containing the action, condition, and button element, or undefined if no action is found.
*/
getKeyAction(key) {
const keyActions = {
1: {
condition:
this.props.statementLineRootRef().querySelector(".set-partner-btn") &&
this.isLineSelected,
action: async () => this.setPartnerOnReconcileLine(),
buttonElement: this.props.statementLineRootRef().querySelector(".set-partner-btn"),
},
2: {
condition:
this.props.statementLineRootRef().querySelector(".reconcile-btn") &&
this.isLineSelected,
action: async () => this.reconcileOnReconcileLine(),
buttonElement: this.props.statementLineRootRef().querySelector(".reconcile-btn"),
},
3: {
condition:
this.props.statementLineRootRef().querySelector(".set-account-btn") &&
this.isLineSelected,
action: () => this.setAccountOnReconcileLine(),
buttonElement: this.props.statementLineRootRef().querySelector(".set-account-btn"),
},
4: {
condition:
this.props.statementLineRootRef().querySelector(".set-payable-btn") &&
this.isLineSelected,
action: () => this.setAccountPayableOnReconcileLine(),
buttonElement: this.props.statementLineRootRef().querySelector(".set-payable-btn"),
},
5: {
condition:
this.props.statementLineRootRef().querySelector(".set-receivable-btn") &&
this.isLineSelected,
action: () => this.setAccountReceivableOnReconcileLine(),
buttonElement: this.props
.statementLineRootRef()
.querySelector(".set-receivable-btn"),
},
6: {
condition:
this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-0") && this.isLineSelected,
action: () => {
const buttonElement = this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-0");
if (buttonElement) {
buttonElement.click();
}
},
buttonElement: this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-0"),
},
7: {
condition:
this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-1") && this.isLineSelected,
action: () => {
const buttonElement = this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-1");
if (buttonElement) {
buttonElement.click();
}
},
buttonElement: this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-1"),
},
8: {
condition:
this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-2") && this.isLineSelected,
action: () => {
const buttonElement = this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-2");
if (buttonElement) {
buttonElement.click();
}
},
buttonElement: this.props
.statementLineRootRef()
.querySelector(".reconciliation-model-btn-2"),
},
Enter: {
condition:
this.props.statementLineRootRef().querySelector(".btn-primary") &&
this.isLineSelected,
action: () => {
const primaryButtons = this.props
.statementLineRootRef()
.querySelectorAll(".btn-primary");
if (primaryButtons.length > 0) {
primaryButtons[0].click();
}
},
buttonElement: this.props.statementLineRootRef().querySelector(".btn-primary"),
},
};
return keyActions[key];
}
/**
* Registers hotkeys for the reconciliation buttons.
*/
registerHotkeys() {
const hotkeyConfigs = [
{ key: "1", trigger: "alt+shift+1" },
{ key: "2", trigger: "alt+shift+2" },
{ key: "3", trigger: "alt+shift+3" },
{ key: "4", trigger: "alt+shift+4" },
{ key: "5", trigger: "alt+shift+5" },
{ key: "6", trigger: "alt+shift+6" },
{ key: "7", trigger: "alt+shift+7" },
{ key: "8", trigger: "alt+shift+8" },
{ key: "Enter", trigger: "alt+shift+enter" },
];
hotkeyConfigs.forEach(({ key, trigger }) => {
useHotkey(
trigger,
({ target }) => {
const { condition, action } = this.getKeyAction(key);
if (condition) {
action();
}
},
{
area: () => this.props.statementLineRootRef().parentElement,
withOverlay: () => {
const { buttonElement, condition } = this.getKeyAction(key);
return condition ? buttonElement : null;
},
isAvailable: () => {
const { condition } = this.getKeyAction(key);
return condition;
},
}
);
});
}
// -----------------------------------------------------------------------------
// File Uploader
// -----------------------------------------------------------------------------
get bankRecFileUploaderRecord() {
return {
statementLineId: this.statementLineData.id,
type: this.statementLineData.amount > 0 ? "in_refund" : "in_invoice",
};
}
// -----------------------------------------------------------------------------
// ACTION
// -----------------------------------------------------------------------------
actionViewRecoModels() {
return this.action.doAction({
name: _t("Reconciliation Models"),
type: "ir.actions.act_window",
res_model: "account.reconcile.model",
views: [
[false, "list"],
[false, "form"],
],
view_mode: "list,form",
domain: [
"|",
["match_journal_ids", "=", this.statementLineData.journal_id.id],
["match_journal_ids", "=", false],
["rule_type", "=", "reco_model"],
],
context: {
search_default_created_by_user: 1,
},
target: "current",
});
}
// -----------------------------------------------------------------------------
// GETTER
// -----------------------------------------------------------------------------
get statementLineData() {
return this.props.statementLine.data;
}
get isLineSelected() {
return this.statementLineData.id === this.bankReconciliation.statementLine?.data.id;
}
get lastAccountMoveLine() {
return this.statementLineData.line_ids.records.at(-1);
}
get isCustomerRankHigher() {
return (
this.statementLineData.partner_id.customer_rank >
this.statementLineData.partner_id.supplier_rank
);
}
get isSetPartnerButtonShown() {
return !this.statementLineData.partner_id;
}
get isSetAccountButtonShown() {
return !this.statementLineData.account_id;
}
get isSetReceivableButtonShown() {
return (
!this.isSetPartnerButtonShown &&
((this.statementLineData.partner_id.customer_rank && this.isCustomerRankHigher) ||
this.statementLineData.amount > 0)
);
}
get isSetPayableButtonShown() {
return (
!this.isSetPartnerButtonShown &&
((this.statementLineData.partner_id.supplier_rank && !this.isCustomerRankHigher) ||
this.statementLineData.amount < 0)
);
}
get isReconcileButtonShown() {
// Show the button if we have more than one reconciliable line
// or if we didn't compute it yet
return this.props.reconcileLineCount === null || this.props.reconcileLineCount;
}
get reconcileModelsInDropdown() {
if (this.ui.isSmall || screen.width <= mediaBreakpointLarge.maxWidth) {
return this.props.reconcileModels;
}
return this.props.reconcileModels.filter(
(model) => model.id !== this.props?.preSelectedReconciliationModel?.id
);
}
/**
* Dynamically builds the list of action buttons to be shown in the reconciliation interface.
*
* @returns {Object} buttonsToDisplay - A dictionary of buttons to render in the UI.
*/
get buttons() {
const buttonsToDisplay = {};
const isMediumScreen = screen.width <= mediaBreakpointLarge.maxWidth;
if (this.isSetPartnerButtonShown) {
buttonsToDisplay.partner = {
label: isMediumScreen ? _t("Partner") : _t("Set Partner"),
action: this.setPartnerOnReconcileLine.bind(this),
classes: "set-partner-btn",
};
} else {
buttonsToDisplay.receivable = {
label: _t("Receivable"),
action: this.setAccountReceivableOnReconcileLine.bind(this),
classes: "set-receivable-btn",
};
buttonsToDisplay.payable = {
label: _t("Payable"),
action: this.setAccountPayableOnReconcileLine.bind(this),
classes: "set-payable-btn",
};
}
if (this.isReconcileButtonShown) {
buttonsToDisplay.reconcile = {
label: _t("Reconcile"),
action: this.reconcileOnReconcileLine.bind(this),
count: this.props.reconcileLineCount,
classes: "reconcile-btn",
suggestion: this.availableReconcileLines.length,
};
}
if (this.isSetAccountButtonShown) {
buttonsToDisplay.account = {
label: isMediumScreen ? _t("Account") : _t("Set Account"),
action: this.setAccountOnReconcileLine.bind(this),
classes: "set-account-btn",
};
}
if (
this.statementLineData.is_reconciled &&
["todo", "anomaly"].includes(this.statementLineData.review_state)
) {
buttonsToDisplay.toReview = {
label: _t("Review"),
action: this.setStatementLineAsReviewed.bind(this),
toReview: true,
};
}
return buttonsToDisplay;
}
/**
* Prioritizing which buttons are shown and which one is marked as "primary".
*
* @returns {Array<Object>} An array of button objects, each with label, action, and optionally `primary`.
*/
get buttonsToDisplay() {
const buttons = this.buttons || {};
let primaryButtonKeys = [];
let secondaryButtonKeys = [];
if (buttons?.partner && buttons?.account) {
primaryButtonKeys = ["partner", "account"];
} else if (buttons?.reconcile && !!buttons.reconcile?.count) {
primaryButtonKeys = ["reconcile"];
if (this.isSetReceivableButtonShown) {
secondaryButtonKeys = ["receivable"];
} else {
secondaryButtonKeys = ["payable"];
}
} else if (this.isSetReceivableButtonShown) {
primaryButtonKeys = ["receivable"];
} else if (this.isSetPayableButtonShown) {
primaryButtonKeys = ["payable"];
}
return [
...primaryButtonKeys.map((key) => ({ ...buttons[key], primary: true })),
...secondaryButtonKeys.map((key) => ({ ...buttons[key] })),
];
}
get buttonsInDropdown() {
const buttons = this.buttons || {};
if (this.props.preSelectedReconciliationModel) {
return Object.values(buttons);
}
const buttonToDisplayClasses = this.buttonsToDisplay.map((button) => button.classes) || [];
// Get all other buttons excluding primary ones
return Object.values(buttons).filter(
(button) => !buttonToDisplayClasses.includes(button.classes)
);
}
get displaySuggestionPill() {
// Override that function to display the suggestion pill on the dropdown
return this.availableReconcileLines.length;
}
}

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.BankRecButtonListDropdown">
<Dropdown t-if="!this.statementLineData.is_reconciled">
<div class="activity-container position-relative">
<button class="btn btn-secondary" t-att-class="{'btn-sm': !this.ui.isSmall}">
<i class="oi" data-icon="more_vert"/>
</button>
<span t-if="this.displaySuggestionPill" class="suggestion-dot o_link_color rounded-pill"/>
</div>
<t t-set-slot="content">
<t t-foreach="this.buttonsInDropdown" t-as="button" t-key="button_index">
<DropdownItem class="'btn btn-link'" onSelected.bind="button.action">
<div class="d-flex justify-content-between gap-2 align-items-center">
<t t-out="button.label"/>
<div t-if="button?.suggestion"
class="align-items-center d-flex badge rounded-pill o_link_color">
<span>Suggestions</span>
</div>
</div>
</DropdownItem>
</t>
<BankRecFileUploader record="this.bankRecFileUploaderRecord">
<t t-set-slot="toggler">
<span class="dropdown-item o-navigable btn btn-link">
<t t-if="this.statementLineData.amount > 0">
Upload Refunds
</t>
<t t-else="">
Upload Bills
</t>
</span>
</t>
</BankRecFileUploader>
<div class="dropdown-divider"/>
<t t-foreach="this.reconcileModelsInDropdown" t-as="model" t-key="model.id">
<DropdownItem class="'btn btn-link'" onSelected.bind="() => this.triggerReconciliationModel(model)">
<t t-out="model.display_name"/>
</DropdownItem>
</t>
<div t-if="this.reconcileModelsInDropdown.length" class="dropdown-divider"/>
<DropdownItem class="'btn btn-link'" onSelected.bind="this.actionViewRecoModels">
Manage Models
</DropdownItem>
<DropdownItem class="'btn btn-link'" onSelected.bind="this.deleteTransaction">
Delete Transaction
</DropdownItem>
</t>
</Dropdown>
</t>
<t t-name="account_accountant.BankRecButtonList">
<div class="d-flex flex-wrap gap-1">
<t t-if="this.props.preSelectedReconciliationModel and !this.statementLineData.is_reconciled">
<div class="d-flex gap-1">
<BankRecButton
label="this.props.preSelectedReconciliationModel.display_name"
primary="true"
action.bind="() => this.triggerReconciliationModel(this.props.preSelectedReconciliationModel)"
/>
<t t-call="account_accountant.BankRecButtonListDropdown"/>
</div>
</t>
<t t-elif="this.buttons?.toReview">
<div class="d-flex gap-1">
<BankRecButton t-props="this.buttons.toReview"/>
<t t-call="account_accountant.BankRecButtonListDropdown"/>
</div>
</t>
<t t-elif="!this.statementLineData.is_reconciled">
<t t-foreach="this.buttonsToDisplay" t-as="button" t-key="button_index">
<t t-if="!button_last">
<BankRecButton t-props="button"/>
</t>
<t t-else="">
<div class="d-flex gap-1">
<BankRecButton t-props="button"/>
<t t-call="account_accountant.BankRecButtonListDropdown"/>
</div>
</t>
</t>
</t>
</div>
</t>
</templates>

View File

@@ -0,0 +1,419 @@
import { ActionMenus } from "@web/search/action_menus/action_menus";
import { BankRecButton } from "../button/button";
import { SelectCreateDialog } from "@web/views/view_dialogs/select_create_dialog";
import { ControlPanel } from "@web/search/control_panel/control_panel";
import { Dropdown } from "@web/core/dropdown/dropdown";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { useOwnedDialogs, useService } from "@web/core/utils/hooks";
import { useBankReconciliation } from "../bank_reconciliation_service";
import { _t } from "@web/core/l10n/translation";
export class BankRecControlPanel extends ControlPanel {
static template = "account_accountant.BankRecControlPanel";
static components = {
...ControlPanel.components,
ActionMenus,
BankRecButton,
Dropdown,
DropdownItem,
};
setup() {
super.setup();
this.ui = useService("ui");
this.orm = useService("orm");
this.notification = useService("notification");
this.addDialog = useOwnedDialogs();
this.bankReconciliation = useBankReconciliation();
}
/*
* When selecting lines, you could have either both reconciled and unreconciled lines.
* For reconciled lines: We send a notification to warn the user that the lines will stay untouched.
* */
sendAlreadyReconciledNotification() {
if (this.selectedReconciledStatementLines.length) {
this.notification.add(
_t("Some lines cannot be processed because they have already been reconciled."),
{ type: "info" }
);
}
}
/*
* When selecting lines, you could have either both validated and unvalidated lines.
* For validated lines: We send a notification to warn the user that the lines will stay untouched.
* */
sendAlreadyValidatedNotification() {
if (this.selectedUnvalidatedStatementLines.length != this.selectedStatementLines.length) {
this.notification.add(
_t(
"Some lines cannot be processed because they are already reconciled or cannot be validated."
),
{ type: "info" }
);
}
}
setPartnerOnReconcileLine() {
// Send a notification for reconciled lines present in all the selected lines
this.sendAlreadyReconciledNotification();
const selectedLinesIds = this.selectedUnreconciledStatementLinesIds;
if (!selectedLinesIds.length) {
return;
}
const companyIds = [
...new Set(
this.selectedUnreconciledStatementLines.map((st_line) => st_line.data.company_id.id)
),
];
this.addDialog(SelectCreateDialog, {
title: _t("Search: Partner"),
noCreate: false,
multiSelect: false,
resModel: "res.partner",
domain: [
"|",
["company_id", "in", [false, ...companyIds]],
["company_id", "parent_of", companyIds],
],
onSelected: async (partner) => {
await this.orm.call(
"account.bank.statement.line",
"set_partner_bank_statement_line",
[selectedLinesIds, partner[0]]
);
let recordsToLoad = [];
const partnerNames = this.selectedStatementLinesPartnerName;
if (partnerNames) {
// Reload all impacted statement lines if we have a partner_name
recordsToLoad.push(
...this.env.model.root.records.filter(
(record) =>
partnerNames.includes(record.data.partner_name) || record.selected
)
);
} else {
recordsToLoad = this.recordsToReload;
}
await this.bankReconciliation.reloadRecords(recordsToLoad);
await this.bankReconciliation.computeReconcileLineCountPerPartnerId(
this.env.model.root.records
);
this.bankReconciliation.reloadChatter();
},
});
}
setAccountOnReconcileLine() {
// Send a notification for reconciled lines present in all the selected lines
this.sendAlreadyReconciledNotification();
const selectedLinesIds = this.selectedUnreconciledStatementLinesIds;
if (!selectedLinesIds.length) {
return;
}
const suspenseLineIds = this.selectedUnreconciledStatementLines
.map((st_line) => st_line.data.line_ids.records.at(-1))
.map((line) => line.resId);
const suspenseAccountIds = [
...new Set(
this.selectedUnreconciledStatementLines.map(
(st_line) => st_line.data.journal_id.suspense_account_id.id
)
),
];
const defaultAccountIds = [
...new Set(
this.selectedUnreconciledStatementLines.map(
(st_line) => st_line.data.journal_id.default_account_id.id
)
),
];
const context = {
list_view_ref: "account_accountant.view_account_list_bank_rec_widget",
search_view_ref: "account_accountant.view_account_search_bank_rec_widget",
};
this.addDialog(SelectCreateDialog, {
title: _t("Search: Account"),
noCreate: true,
multiSelect: false,
context: context,
domain: [["id", "not in", [...suspenseAccountIds, ...defaultAccountIds]]],
resModel: "account.account",
onSelected: async (account) => {
const linesToLoad = await this.orm.call(
"account.bank.statement.line",
"set_account_bank_statement_line",
[selectedLinesIds, suspenseLineIds, account[0]],
{ context: { account_default_taxes: true } }
);
await this.bankReconciliation.reloadRecords(
this.env.model.root.records.filter((record) =>
linesToLoad.includes(record.resId)
)
);
this.bankReconciliation.reloadChatter();
},
});
}
/**
* Sets the account receivable on the current reconcile line.
*/
async setAccountReceivableOnReconcileLines() {
// Send a notification for reconciled lines present in all the selected lines
this.sendAlreadyReconciledNotification();
const selectedLines = this.selectedUnreconciledStatementLines;
if (!selectedLines.length) {
return;
}
let linesToLoad = [];
for (const selectedLine of selectedLines) {
const lines = await this.orm.call(
"account.bank.statement.line",
"set_account_bank_statement_line",
[
selectedLine.resId,
selectedLine.data.line_ids.records.at(-1).resId,
await this.accountReconcileLine(selectedLine, "asset_receivable"),
]
);
linesToLoad.push(lines);
}
linesToLoad = linesToLoad.flat();
await this.bankReconciliation.reloadRecords(
this.env.model.root.records.filter((record) => linesToLoad.includes(record.resId))
);
this.bankReconciliation.reloadChatter();
}
/**
* Sets the account payable on the current reconcile line..
*/
async setAccountPayableOnReconcileLines() {
// Send a notification for reconciled lines present in all the selected lines
this.sendAlreadyReconciledNotification();
const selectedLines = this.selectedUnreconciledStatementLines;
if (!selectedLines.length) {
return;
}
let linesToLoad = [];
for (const selectedLine of selectedLines) {
const lines = await this.orm.call(
"account.bank.statement.line",
"set_account_bank_statement_line",
[
selectedLine.resId,
selectedLine.data.line_ids.records.at(-1).resId,
await this.accountReconcileLine(selectedLine, "liability_payable"),
]
);
linesToLoad.push(lines);
}
linesToLoad = linesToLoad.flat();
await this.bankReconciliation.reloadRecords(
this.env.model.root.records.filter((record) => linesToLoad.includes(record.resId))
);
this.bankReconciliation.reloadChatter();
}
async validateBankLines() {
// Send a notification for validated lines present in all the selected lines
this.sendAlreadyValidatedNotification();
const selectedLines = this.selectedUnvalidatedStatementLines;
if (!selectedLines.length) {
return;
}
let linesToLoad = [];
for (const selectedLine of selectedLines) {
const recoModelId = selectedLine.data.line_ids.records
.filter((record) => record.data.reconcile_model_id)
.map((record) => record.data.reconcile_model_id.id)?.[0];
if (recoModelId) {
await this.orm.call("account.reconcile.model", "trigger_reconciliation_model", [
recoModelId,
selectedLine.resId,
]);
selectedLine.load();
continue;
}
await this.bankReconciliation.computeReconcileLineCountPerPartnerId(selectedLines);
const reconcileCount =
this.bankReconciliation.reconcileCountPerPartnerId[
selectedLine.data.partner_id.id
] ?? null;
if (!selectedLine.data.partner_id || reconcileCount !== null) {
continue;
}
const lines = await this.orm.call(
"account.bank.statement.line",
"set_account_bank_statement_line",
[
selectedLine.resId,
selectedLine.data.line_ids.records.at(-1).resId,
await this.accountReconcileLine(
selectedLine,
selectedLine.data.amount < 0 ? "liability_payable" : "asset_receivable"
),
]
);
linesToLoad.push(lines);
}
linesToLoad = linesToLoad.flat();
await this.bankReconciliation.reloadRecords(
this.env.model.root.records.filter((record) => linesToLoad.includes(record.resId))
);
this.bankReconciliation.reloadChatter();
}
async accountReconcileLine(selectedLine, account_type = "liability_payable") {
let accountId;
const propertyAccountId =
account_type == "liability_payable"
? selectedLine.data.partner_id?.property_account_payable_id?.id
: selectedLine.data.partner_id?.property_account_receivable_id?.id;
if (propertyAccountId) {
accountId = propertyAccountId;
} else {
const account = await this.orm.webSearchRead(
"account.account",
[
["company_ids", "=", selectedLine.data.company_id.id],
["account_type", "=", account_type],
],
{ specification: {}, limit: 1 }
);
accountId = account.records[0].id;
}
return accountId;
}
async triggerReconciliationModel(reconciliationModelId) {
// Send a notification for reconciled lines present in all the selected lines
this.sendAlreadyReconciledNotification();
const selectedLinesIds = this.selectedUnreconciledStatementLinesIds;
if (!selectedLinesIds.length) {
return;
}
await this.orm.call("account.reconcile.model", "trigger_reconciliation_model", [
reconciliationModelId,
selectedLinesIds,
]);
await this.bankReconciliation.computeReconcileLineCountPerPartnerId(
this.env.model.root.records
);
await this.bankReconciliation.reloadRecords(this.selectedUnreconciledStatementLines);
this.bankReconciliation.reloadChatter();
}
get buttonsToDisplay() {
return this.selectedUnreconciledStatementLines.length
? [
...(this.selectedUnvalidatedStatementLines.length
? [
{
label: _t("Validate"),
action: this.validateBankLines.bind(this),
isLarge: true,
primary: true,
},
]
: []),
{
label: _t("Set Partner"),
action: this.setPartnerOnReconcileLine.bind(this),
isLarge: true,
},
{
label: _t("Set Account"),
action: this.setAccountOnReconcileLine.bind(this),
isLarge: true,
},
]
: [];
}
get selectedUnvalidatedStatementLines() {
return this.selectedUnreconciledStatementLines.filter((line) => {
const hasReconcileModel = line.data.line_ids?.records?.some(
(record) => record.data.reconcile_model_id
);
const partnerId = line.data.partner_id?.id;
const isReconcileCountNull =
this.bankReconciliation.reconcileCountPerPartnerId[partnerId] == null;
return hasReconcileModel || (isReconcileCountNull && partnerId);
});
}
get selectedUnreconciledStatementLines() {
return this.selectedStatementLines.filter((line) => !line.data.is_reconciled);
}
get selectedReconciledStatementLines() {
return this.selectedStatementLines.filter((line) => line.data.is_reconciled);
}
get selectedUnreconciledStatementLinesIds() {
return this.selectedUnreconciledStatementLines.map((line) => line.resId);
}
get selectedStatementLinesPartnerName() {
return this.selectedStatementLines
.filter((line) => !line.data.is_reconciled && line.data.partner_name)
.map((line) => line.data.partner_name);
}
get selectedStatementLines() {
return this.env.model.root.selection;
}
get reconcileModelsToDisplay() {
if (this.selectedUnreconciledStatementLinesIds.length === 1) {
return this.bankReconciliation.reconcileModelPerStatementLineId[
this.selectedUnreconciledStatementLinesIds[0]
];
}
const allReconcileModels = [];
for (const statementLineId of this.selectedUnreconciledStatementLinesIds) {
const reconcileModels =
this.bankReconciliation.reconcileModelPerStatementLineId[statementLineId] ?? [];
allReconcileModels.push(reconcileModels);
}
if (!allReconcileModels.length) {
return [];
}
const intersection = allReconcileModels.pop();
const remainingRecoModels = allReconcileModels.flat().map((recoModel) => recoModel.id);
return intersection.filter((item) => remainingRecoModels.includes(item.id));
}
get extraButtonToDisplay() {
const buttonsToDisplay = {};
if (this.selectedUnreconciledStatementLines.length) {
buttonsToDisplay.receivable = {
label: _t("Receivable"),
action: this.setAccountReceivableOnReconcileLines.bind(this),
};
buttonsToDisplay.payable = {
label: _t("Payable"),
action: this.setAccountPayableOnReconcileLines.bind(this),
};
}
return Object.values(buttonsToDisplay);
}
}

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="account_accountant.BankRecControlPanel" t-inherit="web.ControlPanel" t-inherit-mode="primary">
<xpath expr="//div[hasclass('o_control_panel_actions')]" position="inside">
<div t-if="this.selectedStatementLines.length and !this.ui.isSmall and (this.extraButtonToDisplay.length or this.buttonsToDisplay.length)" class="d-flex w-100 gap-1">
<t t-foreach="this.buttonsToDisplay" t-as="button" t-key="button_index">
<BankRecButton t-props="button"/>
</t>
<Dropdown t-if="this.extraButtonToDisplay.length">
<button class="btn btn-secondary">
<i class="oi" data-icon="more_vert"/>
</button>
<t t-set-slot="content">
<t t-foreach="this.reconcileModelsToDisplay" t-as="model" t-key="model.id">
<DropdownItem class="'btn btn-link'" onSelected.bind="() => this.triggerReconciliationModel(model.id)">
<t t-out="model.display_name"/>
</DropdownItem>
</t>
<t t-foreach="this.extraButtonToDisplay" t-as="button" t-key="button_index">
<DropdownItem class="'btn btn-link'" onSelected.bind="button.action">
<t t-out="button.label"/>
</DropdownItem>
</t>
</t>
</Dropdown>
</div>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,23 @@
import { DocumentFileUploader } from "@account/components/document_file_uploader/document_file_uploader";
export class BankRecFileUploader extends DocumentFileUploader {
/**
* This method extends the DocumentFileUploader `getExtraContext` to add the `statement_line_id` to the context,
* which is useful for passing the current statement line ID to other components or services. This will be useful
* for the 'create_document_from_attachment' method (in account_bank_statement.py).
*
* @returns {Object} The extended context object with the `statement_line_id`.
*/
getExtraContext() {
const extraContext = super.getExtraContext();
return {
...extraContext,
statement_line_id: this.props.record.statementLineId,
type: this.props.record.type,
};
}
getResModel() {
return "account.bank.statement.line";
}
}

View File

@@ -0,0 +1,301 @@
import { onWillDestroy } from "@odoo/owl";
import { KanbanController } from "@web/views/kanban/kanban_controller";
import { makeActiveField } from "@web/model/relational_model/utils";
import { useService } from "@web/core/utils/hooks";
import { useBankReconciliation } from "./bank_reconciliation_service";
import { useHotkey } from "@web/core/hotkeys/hotkey_hook";
import { user } from "@web/core/user";
export class BankRecKanbanController extends KanbanController {
static template = "account_accountant.BankRecoKanbanController";
async setup() {
super.setup();
this.orm = useService("orm");
this.bankReconciliation = useBankReconciliation();
useHotkey("alt+shift+c", () => this.bankReconciliation.toggleChatter(), {
bypassEditableProtection: true,
withOverlay: () => this.rootRef().querySelector(".bank-chatter-btn"),
});
user.updateContext({ from_bank_reco: true, auto_statement_processing: true });
onWillDestroy(() => {
user.updateContext({ from_bank_reco: false, auto_statement_processing: false });
});
}
async createRecord() {
this.quickCreateState.openQuickCreate();
}
get modelParams() {
const params = super.modelParams;
params.config.activeFields.move_id = makeActiveField();
params.config.activeFields.move_id.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
review_state: { name: "review_state", type: "char" },
inalterable_hash: { name: "inalterable_hash", type: "char" },
},
activeFields: {
review_state: makeActiveField(),
inalterable_hash: makeActiveField(),
},
};
params.config.activeFields.partner_id = makeActiveField();
params.config.activeFields.statement_line_attachment_ids = makeActiveField();
params.config.activeFields.partner_id.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
property_account_receivable_id: {
name: "property_account_receivable_id",
type: "many2one",
},
property_account_payable_id: {
name: "property_account_payable_id",
type: "many2one",
},
customer_rank: { name: "customer_rank", type: "int" },
supplier_rank: { name: "supplier_rank", type: "int" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
property_account_receivable_id: makeActiveField(),
property_account_payable_id: makeActiveField(),
customer_rank: makeActiveField(),
supplier_rank: makeActiveField(),
},
};
params.config.activeFields.currency_id = makeActiveField();
params.config.activeFields.currency_id.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
decimal_places: { name: "decimal_places", type: "int" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
decimal_places: makeActiveField(),
},
};
params.config.activeFields.foreign_currency_id.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
decimal_places: { name: "decimal_places", type: "int" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
decimal_places: makeActiveField(),
},
};
params.config.activeFields.line_ids = makeActiveField();
params.config.activeFields.line_ids.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
name: { name: "name", type: "char" },
balance: { name: "balance", type: "monetary" },
amount_currency: { name: "amount_currency", type: "monetary" },
currency_id: { name: "currency_id", type: "many2one" },
currency_rate: { name: "currency_rate", type: "float" },
is_same_currency: { name: "is_same_currency", type: "boolean" },
company_currency_id: { name: "company_currency_id", type: "many2one" },
account_id: { name: "account_id", type: "many2one" },
partner_id: { name: "partner_id", type: "many2one" },
move_id: { name: "move_id", type: "many2one" },
first_reconciled_lines_id: { name: "first_reconciled_lines_id", type: "many2one" },
count_reconciled_lines: { name: "count_reconciled_lines", type: "int" },
first_reconciled_lines_excluding_exchange_diff_id: {
name: "first_reconciled_lines_excluding_exchange_diff_id",
type: "many2one",
},
count_reconciled_lines_excluding_exchange_diff: {
name: "count_reconciled_lines_excluding_exchange_diff",
type: "int",
},
exchange_move_ids: { name: "exchange_move_ids", type: "many2many" },
reconcile_model_id: { name: "reconcile_model_id", type: "many2one" },
has_invalid_analytics: { name: "has_invalid_analytics", type: "boolean" },
analytic_distribution: { name: "analytic_distribution", type: "jsonb" },
tax_line_id: { name: "tax_line_id", type: "many2one" },
tax_ids: { name: "tax_ids", type: "many2many" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
name: makeActiveField(),
balance: makeActiveField(),
amount_currency: makeActiveField(),
currency_id: makeActiveField(),
currency_rate: makeActiveField(),
is_same_currency: makeActiveField(),
company_currency_id: makeActiveField(),
account_id: makeActiveField(),
partner_id: makeActiveField(),
move_id: makeActiveField(),
first_reconciled_lines_id: makeActiveField(),
count_reconciled_lines: makeActiveField(),
first_reconciled_lines_excluding_exchange_diff_id: makeActiveField(),
count_reconciled_lines_excluding_exchange_diff: makeActiveField(),
exchange_move_ids: makeActiveField(),
reconcile_model_id: makeActiveField(),
has_invalid_analytics: makeActiveField(),
analytic_distribution: makeActiveField(),
tax_line_id: makeActiveField(),
tax_ids: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.reconcile_model_id.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
is_asking_for_autopost: { name: "is_asking_for_autopost", type: "boolean" },
use_count: { name: "use_count", type: "integer" },
created_automatically: { name: "created_automatically", type: "boolean" },
rule_type: { name: "rule_type", type: "char" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
is_asking_for_autopost: makeActiveField(),
use_count: makeActiveField(),
created_automatically: makeActiveField(),
rule_type: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.exchange_move_ids.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
amount_total_signed: { name: "amount_total_signed", type: "float" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
amount_total_signed: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.first_reconciled_lines_id.related =
{
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
move_name: { name: "move_name", type: "char" },
move_id: { name: "move_id", type: "many2one" },
full_reconcile_id: { name: "full_reconcile_id", type: "many2one" },
amount_currency: { name: "amount_currency", type: "monetary" },
currency_id: { name: "currency_id", type: "many2one" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
move_name: makeActiveField(),
move_id: makeActiveField(),
full_reconcile_id: makeActiveField(),
amount_currency: makeActiveField(),
currency_id: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.first_reconciled_lines_excluding_exchange_diff_id.related =
{
fields: {
id: { name: "id", type: "int" },
move_name: { name: "move_name", type: "char" },
move_id: { name: "move_id", type: "many2one" },
},
activeFields: {
id: makeActiveField(),
move_name: makeActiveField(),
move_id: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.move_id.related = {
fields: {
review_state: { name: "review_state", type: "char" },
},
activeFields: {
review_state: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.tax_ids.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.partner_id.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
property_account_receivable_id: {
name: "property_account_receivable_id",
type: "many2one",
},
property_account_payable_id: {
name: "property_account_payable_id",
type: "many2one",
},
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
property_account_receivable_id: makeActiveField(),
property_account_payable_id: makeActiveField(),
},
};
params.config.activeFields.line_ids.related.activeFields.account_id.related = {
fields: {
id: { name: "id", type: "int" },
display_name: { name: "display_name", type: "char" },
account_type: { name: "account_type", type: "char" },
reconcile: { name: "reconcile", type: "boolean" },
},
activeFields: {
id: makeActiveField(),
display_name: makeActiveField(),
account_type: makeActiveField(),
reconcile: makeActiveField(),
},
};
params.config.activeFields.journal_id = makeActiveField();
params.config.activeFields.journal_id.related = {
fields: {
id: { name: "id", type: "int" },
suspense_account_id: { name: "suspense_account_id", type: "many2one" },
default_account_id: { name: "default_account_id", type: "many2one" },
currency_id: { name: "currency_id", type: "many2one" },
},
activeFields: {
id: makeActiveField(),
suspense_account_id: makeActiveField(),
default_account_id: makeActiveField(),
currency_id: makeActiveField(),
},
};
params.config.activeFields.company_id = makeActiveField();
params.config.activeFields.company_id.related = {
fields: {
id: { name: "id", type: "int" },
currency_id: { name: "currency_id", type: "many2one" },
},
activeFields: {
id: makeActiveField(),
currency_id: makeActiveField(),
},
};
params.config.activeFields.has_attachments = makeActiveField();
params.config.activeFields.has_invalid_analytics = makeActiveField();
params.config.activeFields.reconciled_lines_name = makeActiveField();
params.limit = 40;
return params;
}
}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="account_accountant.BankRecoKanbanController" t-inherit="web.KanbanView" t-inherit-mode="primary">
<xpath expr="//Layout" position="attributes">
<attribute name="className">'o_bank_reconciliation_container d-flex'</attribute>
</xpath>
<xpath expr="//Layout" position="inside">
<t t-set-slot="control-panel-navigation-additional">
<button
t-on-click="() => this.bankReconciliation.toggleChatter()"
data-tooltip="Chatter"
class="btn btn-secondary o_switch_view o_kanban d-none d-md-inline bank-chatter-btn"
t-att-class="{'active': this.bankReconciliation.chatterState.visible}">
<i class="oi oi-fw mt-1" t-attf-data-icon="{{ this.bankReconciliation.chatterState.visible ? 'close' : 'forum' }}"/>
</button>
</t>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,244 @@
import { Chatter } from "@mail/chatter/web_portal_project/chatter";
import { BankRecQuickCreate } from "./quick_create/quick_create";
import { BankRecKanbanController } from "./kanban_controller";
import { BankRecStatementLine } from "./statement_line/statement_line";
import { BankRecStatementSummary } from "./statement_summary/statement_summary";
import { browser } from "@web/core/browser/browser";
import { KanbanRenderer } from "@web/views/kanban/kanban_renderer";
import { RelationalModel } from "@web/model/relational_model/relational_model";
import { kanbanView } from "@web/views/kanban/kanban_view";
import { _t } from "@web/core/l10n/translation";
import { formatMonetary } from "@web/views/fields/formatters";
import { onWillStart, onWillDestroy, proxy } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { useBankReconciliation } from "./bank_reconciliation_service";
import { BankRecControlPanel } from "./control_action/control_action";
import { user } from "@web/core/user";
export class BankRecKanbanRenderer extends KanbanRenderer {
static template = "account_accountant.BankRecKanbanRenderer";
static components = {
...KanbanRenderer.components,
BankRecQuickCreate,
BankRecStatementSummary,
BankRecStatementLine,
Chatter,
};
setup() {
super.setup();
this.action = useService("action");
this.orm = useService("orm");
this.ui = useService("ui");
this.bankReconciliation = useBankReconciliation();
this.globalState = proxy({
resModel: this.env.model.config.resModel,
context: this.env.model.config.context,
journalId:
this.env.model.config.context.default_journal_id ||
this.env.model.config.context.active_id,
totalJournalAmount: "",
});
this.env.model.hooks.onRootLoaded = async (newRoot) => {
await this.prepareInitialState(newRoot.records);
};
onWillStart(async () => {
await this.prepareInitialState(this.env.model.root.records);
});
onWillDestroy(() => {
browser.sessionStorage.setItem(
"isBankReconciliationWidgetChatterOpened",
this.bankReconciliation.chatterState.visible
);
browser.sessionStorage.setItem(
"bankReconciliationStatementLineId",
this.bankReconciliation.statementLineId
);
this.bankReconciliation.chatterState.statementLine = null;
});
}
/**
* Prepare the initial bank reconciliation widget info on load or when records changes
*
* @param {Array<Object>} records - Bank statement line records
* @returns {Promise<void>} Resolves when all computations are done
*/
async prepareInitialState(records) {
this.bankReconciliation.modelRootRecords = records;
await Promise.all([
this.getJournalTotalAmount(),
this.bankReconciliation.computeReconcileLineCountPerPartnerId(records),
this.bankReconciliation.computeAvailableReconcileModels(records),
this.bankReconciliation.computeAvailableReconcileLines(records),
this.bankReconciliation.computeAvailableAnalyticAccounts(records),
]);
const statementLineId =
parseInt(browser.sessionStorage.getItem("bankReconciliationStatementLineId")) ||
records[0]?.data.id;
const statementLine =
records.find((record) => record.data.id === statementLineId) ?? records[0];
this.bankReconciliation.selectStatementLine(statementLine);
}
/**
Override.
**/
async validateQuickCreate(recordId) {
// When adding a record, some information needs to be recomputed
await this.bankReconciliation.updateAvailableReconcileModels(recordId);
await this.env.model.load();
await this.getJournalTotalAmount();
await this.bankReconciliation.computeReconcileLineCountPerPartnerId(
this.env.model.root.records
);
}
async getJournalTotalAmount() {
const value = await this.orm.call("account.journal", "get_total_journal_amount", [
this.globalState.journalId,
]);
this.globalState.totalJournalAmount = value.balance_amount;
this.globalState.totalIsInvalid = value.has_invalid_statements;
return value;
}
// -----------------------------------------------------------------------------
// ACTION
// -----------------------------------------------------------------------------
async actionOpenBankGL() {
const actionData = await this.orm.call(
"account.journal",
"action_open_bank_balance_in_gl",
[
this.env.model.config.context.default_journal_id ||
this.env.model.config.context.active_id,
]
);
this.action.doAction(actionData);
}
actionOpenStatement(statementId) {
const action = {
type: "ir.actions.act_window",
res_model: "account.bank.statement",
res_id: statementId,
views: [[false, "form"]],
target: "current",
context: {
form_view_ref: "account_accountant.view_bank_statement_form_bank_rec_widget",
from_bank_reco: false,
from_statement_view: true,
default_journal_id: this.globalState.journalId,
},
};
this.action.doAction(action);
}
async actionReviewStatement(statementId) {
const action = await this.orm.call(
"account.bank.statement",
"action_open_statements_to_review",
[statementId],
{ context: this.globalState.context }
);
this.action.doAction(action);
}
// -----------------------------------------------------------------------------
// GETTER
// -----------------------------------------------------------------------------
get quickCreateContext() {
// This is needed because you could end up with inconsistent between the model context
// and the user context, since the kanban controller directly modifies the user context,
// we put priority on the user context.
return {
...this.globalState.context,
...user.context,
};
}
get numberOfStatementLines() {
return this.env.model.root.count;
}
get totalJournalLabel() {
return _t("Current Balance");
}
// hide no content helper if quick create is visible and there is no data either isGrouped or not
get showNoContentHelper() {
return !this.props.quickCreateState?.isOpen && !this.props.list.model.hasData();
}
/**
Prepares a list of statements based on the statement_id of the bank statement line records.
Statements are only displayed above the first line of the statement (all lines might not be visible in the kanban)
**/
get statementGroups() {
const statementGroups = {};
let lastStatementId = null;
for (const record of this.env.model.root.records) {
const statementId = record.data.statement_id?.id;
if (statementId && statementId !== lastStatementId) {
// Add the statement group information to the statementGroups object
statementGroups[record.data.id] = {
statementId: statementId,
name: record.data.statement_name,
balance: formatMonetary(record.data.statement_balance_end_real, {
currencyId: record.data.currency_id.id,
}),
isValid: record.data.statement_complete && record.data.statement_valid,
problemDescription: record.data.statement_problem_description,
};
lastStatementId = statementId;
} else {
if (
Object.keys(statementGroups).length &&
!statementId &&
typeof lastStatementId !== "string"
) {
statementGroups[record.data.id] = {
name: _t("No Bank Statement"),
isValid: true,
};
lastStatementId = "no_bank_statement";
}
}
}
return statementGroups;
}
get isReviewFilterActive() {
const reviewFilter = Object.values(this.env.searchModel.searchItems).find(
({ name }) => name === "statement_to_review"
);
return this.env.searchModel.facets.some(
(facet) =>
facet.groupId === reviewFilter?.groupId &&
facet.values.includes(reviewFilter.description)
);
}
}
export class BankRecModel extends RelationalModel {
static withCache = false;
}
export const BankRecKanbanView = {
...kanbanView,
ControlPanel: BankRecControlPanel,
Controller: BankRecKanbanController,
Renderer: BankRecKanbanRenderer,
Model: BankRecModel,
searchMenuTypes: ["filter", "favorite"],
};
registry.category("views").add("bank_rec_widget_kanban", BankRecKanbanView);

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="account_accountant.BankRecKanbanRenderer" t-inherit="web.KanbanRenderer" t-inherit-mode="primary">
<xpath expr="//div[@t-ref='this.rootRef']" position="attributes">
<attribute name="class" add="o_bank_reconciliation_kanban_renderer" separator=" "/>
</xpath>
<xpath expr="//div[@t-ref='this.rootRef']" position="attributes">
<attribute name="t-attf-class" add="{{ this.bankReconciliation.chatterState.visible and !this.ui.isSmall ? 'o_bank_reconciliation_kanban_renderer_mobile' : ''}}" separator=" "/>
</xpath>
<xpath expr="//t[@t-as='groupOrRecord']" position="before">
<BankRecStatementSummary
t-if="this.numberOfStatementLines > 1"
label="this.totalJournalLabel"
amount="this.globalState.totalJournalAmount"
action="() => this.actionOpenBankGL()"
journalId="this.globalState.journalId"
journalIsInvalid="this.globalState.totalIsInvalid"
/>
<BankRecQuickCreate
t-if="this.props.quickCreateState.isOpen"
resModel="this.globalState.resModel"
context="this.quickCreateContext"
quickCreateState="this.props.quickCreateState"
onValidate="(record, mode) => this.validateQuickCreate(record, mode)"
/>
</xpath>
<xpath expr="//t[@t-else='']/KanbanRecord" position="replace">
<BankRecStatementLine
archInfo="this.props.archInfo"
Compiler="this.props.Compiler"
canResequence="!this.isProcessing(groupOrRecord.record.id) and this.canResequenceRecords"
forceGlobalClick="this.props.forceGlobalClick"
groupByField="this.props.list.groupByField"
getSelection.bind="this.getSelection"
toggleSelection.bind="this.toggleSelection"
deleteRecord="this.props.deleteRecord"
archiveRecord="(record, active) => this.archiveRecord(record, active)"
openRecord="this.props.openRecord"
readonly="this.props.readonly"
record="groupOrRecord.record"
selectionAvailable="false"
/>
</xpath>
<xpath expr="//t[@t-else='']/BankRecStatementLine" position="before">
<t t-set="recordData" t-value="this.statementGroups?.[groupOrRecord.record.data.id]"/>
<t t-if="recordData">
<BankRecStatementSummary
record="recordData"
label="recordData.name"
amount="recordData.balance"
action="() => this.actionOpenStatement(recordData.statementId)"
actionReview="() => this.actionReviewStatement(recordData.statementId)"
isValid="recordData.isValid"
problemDescription="recordData.problemDescription"
isReviewFilterActive="this.isReviewFilterActive"
/>
</t>
</xpath>
<xpath expr="//div[hasclass('o_kanban_renderer')]" position="after">
<div t-if="this.bankReconciliation.chatterState.visible and !this.ui.isSmall"
class="o_bank_rec_widget_chatter_container o-mail-ChatterContainer o-aside d-flex flex-column border-start"
>
<Chatter
record="this.bankReconciliation.statementLine"
threadId="this.bankReconciliation.statementLineId"
threadModel="'account.bank.statement.line'"
isChatterAside="!this.ui.isSmall"
hasParentReloadOnActivityChanged="true"
hasParentReloadOnAttachmentsChanged="true"
hasParentReloadOnMessagePosted="true"
isAttachmentBoxVisibleInitially="true"
/>
</div>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,72 @@
import { Component, useProps, t } from "@odoo/owl";
import { formatMonetary } from "@web/views/fields/formatters";
import { useService } from "@web/core/utils/hooks";
export class BankRecLineInfoPopOver extends Component {
static template = "account_accountant.BankRecLineInfoPopOver";
props = useProps({
lineData: t.object().optional(),
statementLineData: t.object().optional(),
exchangeMove: t.object().optional(),
isPartiallyReconciled: t.boolean().optional(),
close: t.function().optional(),
});
setup() {
this.action = useService("action");
}
openExchangeMove() {
this.action.doAction({
type: "ir.actions.act_window",
res_model: "account.move",
res_id: this.props.exchangeMove.id,
views: [[false, "form"]],
target: "current",
});
}
openReconciledMove() {
this.action.doAction({
type: "ir.actions.act_window",
res_model: "account.move",
res_id: this.reconciledLineData.move_id.id,
views: [[false, "form"]],
target: "current",
});
}
get reconciledMoveName() {
return this.reconciledLineData.move_name;
}
get formattedReconciledMoveAmountCurrency() {
return formatMonetary(this.reconciledLineData.amount_currency, {
currencyId: this.reconciledLineData.currency_id.id,
});
}
get reconciledLineData() {
return this.props.lineData.first_reconciled_lines_id;
}
get formattedLineDataAmountCurrency() {
return formatMonetary(this.props.lineData.amount_currency, {
currencyId: this.props.lineData.currency_id.id,
});
}
get exchangeDiffMoveName() {
return this.props.exchangeMove.display_name;
}
get exchangeMoveBalance() {
return this.props.exchangeMove.amount_total_signed;
}
get formattedExchangeMoveBalance() {
return formatMonetary(this.exchangeMoveBalance, {
currencyId: this.props.statementLineData.company_id.currency_id?.id,
});
}
}

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.BankRecLineInfoPopOver">
<table class="table table-hover m-0">
<tbody>
<tr t-if="this.props.exchangeMove">
<td t-on-click="this.openExchangeMove" class="cursor-pointer">
<span class="btn btn-link p-0" t-out="this.exchangeDiffMoveName"/>
</td>
<td class="align-middle text-end" t-out="this.formattedExchangeMoveBalance"/>
</tr>
<tr t-if="this.props.isPartiallyReconciled">
<td t-on-click="this.openReconciledMove" class="cursor-pointer">
<span class="btn btn-link p-0" t-out="this.reconciledMoveName"/>
</td>
<td class="align-middle">
<span class="text-decoration-line-through me-2" t-out="this.formattedReconciledMoveAmountCurrency"/>
<span t-out="this.formattedLineDataAmountCurrency"/>
</td>
</tr>
</tbody>
</table>
</t>
</templates>

View File

@@ -0,0 +1,339 @@
import { Component, useProps, t, signal } from "@odoo/owl";
import { _t } from "@web/core/l10n/translation";
import { formatMonetary, formatPercentage } from "@web/views/fields/formatters";
import { useService } from "@web/core/utils/hooks";
import { useBankReconciliation } from "../bank_reconciliation_service";
import { usePopover } from "@web/core/popover/popover_hook";
import { BankRecFormDialog } from "../bankrec_form_dialog/bankrec_form_dialog";
import { BankRecLineInfoPopOver } from "../line_info_pop_over/line_info_pop_over";
import { x2ManyCommands } from "@web/core/orm_plugin";
import { roundDecimals } from "@web/core/utils/numbers";
import { BadgeTag } from "@web/core/tags_list/badge_tag";
export class BankRecLineToReconcile extends Component {
static template = "account_accountant.BankRecLineToReconcile";
static components = {
BadgeTag,
};
props = useProps({
line: t.object(),
statementLine: t.object(),
});
lineInfoRef = signal.ref();
setup() {
this.action = useService("action");
this.orm = useService("orm");
this.dialogService = useService("dialog");
this.ui = useService("ui");
this.bankReconciliation = useBankReconciliation();
this.lineInfoPopOver = usePopover(BankRecLineInfoPopOver, {
position: "left",
closeOnClickAway: true,
});
}
onClickLine() {
if (this.ui.isSmall) {
this.toggleEditLine();
}
}
/**
* Opens a dialog to edit a bank statement line and saves any changes.
*
* This method:
* - Opens a dialog (`FormViewDialog`) to allow the user to edit the current `account.move.line`.
* - On saving, the dialog triggers the `onRecordSave` callback, which:
* - Calls `edit_bank_statement_line` on the ORM to update the bank statement line.
* - Reloads the statement line data.
* - Updates the chatter on the related journal entry.
*/
toggleEditLine() {
this.dialogService.add(BankRecFormDialog, {
title: _t("Edit Line"),
resModel: "account.move.line",
resId: this.lineData.id,
context: {
skip_analytic_sync: true,
form_view_ref: "account_accountant.view_bank_rec_edit_line",
is_reviewed: ["reviewed", "supervised"].includes(
this.lineData.move_id.review_state
),
},
onRecordSave: async (record) => {
const changes = await record.getChanges();
await this.orm.call("account.bank.statement.line", "edit_reconcile_line", [
this.statementLineData.id,
this.lineData.id,
changes,
]);
if (Object.keys(changes?.analytic_distribution || {}).length) {
await this.bankReconciliation.checkAnalyticAccounts(
changes?.analytic_distribution
);
}
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
return true;
},
});
}
/**
* Deletes a line to reconcile.
*
* This method:
* - Calls `delete_reconciled_line` on the ORM to delete the line.
* - Reloads the statement line data after deletion.
* - Updates the chatter on the related journal entry.
*/
async deleteLine() {
await this.orm.call("account.bank.statement.line", "delete_reconciled_line", [
this.statementLineData.id,
this.lineData.id,
]);
if (this.lineData.first_reconciled_lines_id) {
// Only update the line count per partner if we delete
// a line which is reconciled to another move line
// We don't use await here as it could be reloaded asynchronously.
this.bankReconciliation.computeReconcileLineCountPerPartnerId(
this.env.model.root.records
);
}
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
}
get jsonToData() {
const jsonFieldValue = this.lineData.analytic_distribution;
const analyticAccountIds = jsonFieldValue
? Object.keys(jsonFieldValue)
.filter((key) => key !== "__update__")
.map((key) => key.split(","))
.flat()
.map((id) => parseInt(id))
: [];
const fetchedAnalyticAccounts = new Map(
analyticAccountIds.map((id) => [
id,
this.bankReconciliation.availableAnalyticAccounts?.[id],
])
);
return this.buildDistribution(jsonFieldValue, fetchedAnalyticAccounts);
}
buildDistribution(jsonFieldValue, analyticAccount) {
const distribution = [];
let id = 1;
for (const [accountIds, percentage] of Object.entries(jsonFieldValue)) {
if (accountIds === "__update__") {
continue;
}
const defaultVals = []; // empty if the popup was not opened
const ids = accountIds.split(",");
for (const id of ids) {
const account = analyticAccount.get(parseInt(id));
if (!account) {
continue;
}
// since tags are displayed even though plans might not be retrieved (ie defaultVals is empty)
// push the accounts anyway, as order doesn't matter
// once the popup is opened, plans are fetched and the analyticAccounts list will be ordered
Object.assign(
defaultVals.find((plan) => plan.planId === account.root_plan_id[0]) ||
(defaultVals.push({}) && defaultVals[defaultVals.length - 1]),
{
accountId: parseInt(id),
accountDisplayName: account.display_name,
accountColor: account.color,
accountRootPlanId: account.root_plan_id[0],
}
);
}
distribution.push({
analyticAccounts: defaultVals,
percentage: percentage / 100,
id: id++,
});
}
return distribution;
}
planIsComplete(total) {
return roundDecimals(total, 2) === 1;
}
/**
* Computes the totals for each account, grouped by plan (primarily used in tags)
* @returns {Object}
*/
accountTotalsByPlan() {
const accountTotals = {};
this.jsonToData.map((line) => {
line.analyticAccounts.map((column) => {
if (column.accountId) {
let {
accId = column.accountId,
accName = column.accountDisplayName,
total = 0.0,
planId = column.accountRootPlanId,
planColor = column.accountColor,
} = accountTotals[column.accountRootPlanId]?.[column.accountId] || {};
total += roundDecimals(line.percentage, 2);
accountTotals[planId] = accountTotals[planId] || {};
accountTotals[planId][accId] = { accId, accName, planId, total, planColor };
}
});
});
return accountTotals;
}
planSummaryTags() {
const accountTotals = this.accountTotalsByPlan();
return Object.values(accountTotals).map((planSummary) => {
const accs = Object.values(planSummary);
return {
id: accs[0].planId,
text: accs.reduce(
(p, n) =>
p +
(p.length ? " | " : "") +
(this.planIsComplete(n.total)
? n.accName
: `${formatPercentage(n.total)} ${n.accName}`),
""
),
color: accs[0].planColor,
};
});
}
// -----------------------------------------------------------------------------
// ACTION
// -----------------------------------------------------------------------------
openMove() {
this.action.doAction({
type: "ir.actions.act_window",
res_model: "account.move",
res_id: this.moveData.id,
views: [[false, "form"]],
target: "current",
});
}
openPartner() {
this.action.doAction({
type: "ir.actions.act_window",
res_model: "res.partner",
res_id: this.lineData.partner_id.id,
views: [[false, "form"]],
target: "current",
});
}
hoverLineInfoPopOver() {
const popoverConfig = {
statementLineData: this.statementLineData,
lineData: this.lineData,
isPartiallyReconciled: this.isPartiallyReconciled,
};
if (this.exchangeMove) {
popoverConfig.exchangeMove = this.exchangeMove;
}
if (!this.lineInfoPopOver.isOpen && this.showLineInfo) {
this.lineInfoPopOver.open(this.lineInfoRef(), popoverConfig);
}
}
async deleteTax(taxIndex) {
const taxChanged = this.lineDataTaxIds[taxIndex];
await this.orm.call("account.bank.statement.line", "edit_reconcile_line", [
this.statementLineData.id,
this.lineData.id,
{ tax_ids: [[x2ManyCommands.UNLINK, taxChanged.data.id]] },
]);
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
}
// -----------------------------------------------------------------------------
// GETTER
// -----------------------------------------------------------------------------
get statementLineData() {
return this.props.statementLine.data;
}
get lineData() {
return this.props.line;
}
get reconciledLineId() {
return this.lineData.count_reconciled_lines === 1
? this.lineData.first_reconciled_lines_id
: null;
}
get reconciledLineExcludingExchangeDiffId() {
return this.lineData.count_reconciled_lines_excluding_exchange_diff === 1
? this.lineData.first_reconciled_lines_excluding_exchange_diff_id
: null;
}
get moveData() {
return (
this.reconciledLineId?.move_id ||
this.reconciledLineExcludingExchangeDiffId?.move_id ||
this.lineData.move_id
);
}
get isPartiallyReconciled() {
if (!this.reconciledLineId) {
return false;
}
return !this.reconciledLineId.full_reconcile_id?.id;
}
get hasDifferentCurrencies() {
return this.lineData.currency_id.id !== this.statementLineData.currency_id.id;
}
get formattedAmountCurrencyOfLine() {
return formatMonetary(this.lineData.amount_currency, {
currencyId: this.lineData.currency_id.id,
});
}
get formattedAmountCurrencyOfStatementLine() {
return formatMonetary(this.lineData.amount_currency, {
currencyId: this.statementLineData.currency_id.id,
});
}
get exchangeMove() {
return this.lineData.exchange_move_ids.records.length === 1
? this.lineData.exchange_move_ids.records[0].data
: null;
}
get showLineInfo() {
return this.isPartiallyReconciled || this.exchangeMove?.id;
}
get isTaxLine() {
return this.lineData.tax_line_id && !this.lineData.account_id.reconcile;
}
get lineDataTaxIds() {
return this.lineData.tax_ids.records;
}
}

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.BankRecLineToReconcile">
<div class="o_row" t-on-click.stop="this.onClickLine">
<div class="o_line_name d-flex align-items-center gap-1 text-truncate">
<a href="#" class="text-truncate fw-bold" t-out="this.lineData.partner_id.display_name" t-on-click.stop="this.openPartner" role="button" t-att-title="this.lineData.partner_id.display_name" t-if="this.lineData.partner_id"/>
<span t-out="this.lineData.account_id.display_name" class="text-truncate" t-att-class="this.lineData.partner_id ? 'ms-1' : undefined"/>
<div class="d-flex gap-2" t-if="this.lineDataTaxIds">
<t t-foreach="this.lineDataTaxIds" t-as="tax_id" t-key="tax_id_index">
<div class="o_tag d-inline-flex align-items-center badge rounded-pill o_tag_color_0 flex-shrink-0">
<span class="o_tag_badge_text text-truncate" t-out="tax_id.data.display_name"/>
<i t-on-click.stop="() => this.deleteTax(tax_id_index)" class="oi ps-1 opacity-100-hover opacity-75" data-icon="close_small"/>
</div>
</t>
</div>
<div t-if="this.lineData.analytic_distribution" class="o_field_tags flex-column gap-1 d-inline-flex flex-wrap mw-100">
<t t-foreach="this.planSummaryTags()" t-as="tag" t-key="tag.id">
<BadgeTag color="tag.color" text="tag.text"/>
</t>
</div>
</div>
<span t-if="!!this.moveData.display_name and this.moveData.id !== this.statementLineData.move_id.id" class="d-none d-md-inline">
<a t-on-click.stop="this.openMove" href="#">
<t t-out="this.moveData.display_name"/>
</a>
</span>
<div class="o_line_amount d-flex align-items-center justify-content-between">
<span class="text-muted w-50 text-end" t-if="this.hasDifferentCurrencies">
<span t-att-class="{'btn btn-link p-0' : this.showLineInfo}" t-ref="this.lineInfoRef" t-on-mouseover.stop="this.hoverLineInfoPopOver">
<i t-if="this.showLineInfo" class="oi me-2" data-icon="info"/>
<t t-out="this.formattedAmountCurrencyOfLine"/>
</span>
</span>
<span class="text-end w-100" t-if="!this.hasDifferentCurrencies">
<span t-att-class="{'btn btn-link p-0' : this.showLineInfo}" t-ref="this.lineInfoRef" t-on-mouseover.stop="this.hoverLineInfoPopOver">
<i t-if="this.showLineInfo" class="oi me-2" data-icon="info"/>
<t t-out="this.formattedAmountCurrencyOfStatementLine"/>
</span>
</span>
</div>
<div class="o_line_to_reconcile_button d-none d-md-flex justify-content-end align-items-center gap-2" t-if="!this.statementLineData.move_id.inalterable_hash">
<button t-if="this.lineData.has_invalid_analytics" class="btn btn-link p-0 text-600" t-on-click.stop="this.toggleEditLine">
<i class="oi text-warning" data-icon="warning" data-tooltip="This line has invalid analytic distribution"/>
</button>
<button t-if="!this.lineData.has_invalid_analytics" class="btn btn-link p-0 text-600" t-on-click.stop="this.toggleEditLine">
<i class="oi oi-filled" data-icon="edit"/>
</button>
<button class="btn btn-link btn-close p-0 text-600" t-on-click.stop="this.deleteLine" t-if="!this.isTaxLine"/>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,112 @@
import { registry } from "@web/core/registry";
import { makeActiveField } from "@web/model/relational_model/utils";
import { listView } from "@web/views/list/list_view";
import {
AttachmentPreviewListController,
AttachmentPreviewListRenderer,
} from "../../attachment_preview_list_view/attachment_preview_list_view";
import { BankRecControlPanel } from "../control_action/control_action";
import { BankRecModel } from "../kanban_renderer";
export class BankRecListController extends AttachmentPreviewListController {
get previewerStorageKey() {
return "account.statement_line_pdf_previewer_hidden";
}
get modelParams() {
const params = super.modelParams;
params.config.activeFields.bank_statement_attachment_ids = makeActiveField();
params.config.activeFields.bank_statement_attachment_ids.related = {
fields: {
mimetype: { name: "mimetype", type: "char" },
},
activeFields: {
mimetype: makeActiveField(),
},
};
params.config.activeFields.attachment_ids = makeActiveField();
params.config.activeFields.attachment_ids.related = {
fields: {
mimetype: { name: "mimetype", type: "char" },
},
activeFields: {
mimetype: makeActiveField(),
},
};
params.config.activeFields.partner_id = makeActiveField();
params.config.activeFields.partner_id.related = {
fields: {
id: { name: "id", type: "int" },
property_account_receivable_id: {
name: "property_account_receivable_id",
type: "many2one",
},
property_account_payable_id: {
name: "property_account_payable_id",
type: "many2one",
},
},
activeFields: {
id: makeActiveField(),
property_account_receivable_id: makeActiveField(),
property_account_payable_id: makeActiveField(),
},
};
params.config.activeFields.line_ids = makeActiveField();
params.config.activeFields.line_ids.readonly = true;
params.config.activeFields.line_ids.related = {
fields: {
reconcile_model_id: { name: "reconcile_model_id", type: "many2one" },
},
activeFields: {
reconcile_model_id: makeActiveField(),
},
};
params.config.activeFields.journal_id = makeActiveField();
params.config.activeFields.journal_id.related = {
fields: {
suspense_account_id: { name: "suspense_account_id", type: "many2one" },
default_account_id: { name: "default_account_id", type: "many2one" },
},
activeFields: {
suspense_account_id: makeActiveField(),
default_account_id: makeActiveField(),
},
};
params.config.activeFields.company_id = makeActiveField();
params.config.activeFields.company_id.related = {
fields: {
id: { name: "id", type: "int" },
},
activeFields: {
id: makeActiveField(),
},
};
return params;
}
async setSelectedRecord(accountBankStatementLineData) {
this.attachmentPreviewState.selectedRecord = accountBankStatementLineData;
if (accountBankStatementLineData.data?.attachment_ids.count) {
await this.setThread(accountBankStatementLineData, "attachment_ids", "move_id");
} else {
await this.setThread(
accountBankStatementLineData,
"bank_statement_attachment_ids",
"statement_id"
);
}
}
}
export class BankRecListRenderer extends AttachmentPreviewListRenderer {}
export const bankRecListView = {
...listView,
ControlPanel: BankRecControlPanel,
Controller: BankRecListController,
Renderer: BankRecListRenderer,
Model: BankRecModel,
};
registry.category("views").add("bank_rec_list", bankRecListView);

View File

@@ -0,0 +1,25 @@
import { Component, useProps } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { computeM2OProps, Many2One } from "@web/views/fields/many2one/many2one";
import {
buildM2OFieldDescription,
many2OneFieldProps,
} from "@web/views/fields/many2one/many2one_field";
export class BankRecMany2OneMultiID extends Component {
static template = "account_accountant.BankRecMany2OneMultiID";
static components = { Many2One };
props = useProps({ ...many2OneFieldProps });
get m2oProps() {
const props = computeM2OProps(this.props);
if (this.env.model && this.props.record.selected && this.props.record.model.multiEdit) {
props.context.active_ids = this.props.record.model.root.selection.map((r) => r.resId);
}
return props;
}
}
registry.category("fields").add("bank_rec_list_many2one_multi_id", {
...buildM2OFieldDescription(BankRecMany2OneMultiID),
});

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="account_accountant.BankRecMany2OneMultiID">
<Many2One t-props="this.m2oProps"/>
</t>
</templates>

View File

@@ -0,0 +1,19 @@
import {
KanbanRecordQuickCreate,
KanbanQuickCreateController,
} from "@web/views/kanban/kanban_record_quick_create";
export class BankRecQuickCreateController extends KanbanQuickCreateController {
static template = "account_accountant.BankRecQuickCreateController";
showFormDialogInError(e) {
// Override because in the case of the bank rec widget, we do not want the bank statement line form view to be
// opened when an error occurs. Instead, we close the quick create and display the error.
this.props.quickCreateState.closeQuickCreate();
throw e;
}
}
export class BankRecQuickCreate extends KanbanRecordQuickCreate {
static components = { KanbanQuickCreateController: BankRecQuickCreateController };
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="account_accountant.BankRecQuickCreateController">
<div class="o_bank_reconciliation_quick_create o_kanban_record" t-ref="this.rootRef">
<t t-component="this.props.Renderer" record="this.model.root" Compiler="this.props.Compiler" archInfo="this.props.archInfo"/>
<div class="d-flex gap-1 button_group p-2">
<button class="btn btn-primary o_kanban_add" t-on-click="() => this.validate('add')" data-hotkey="s">
Add &amp; New
</button>
<button class="btn btn-secondary o_kanban_edit" t-on-click="() => this.validate('close')" data-hotkey="shift+s">
Add &amp; Close
</button>
<button class="btn btn-secondary o_kanban_cancel" t-on-click="() => this.cancel(true)" data-hotkey="d">
Discard
</button>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,32 @@
import { Component, useProps, t } from "@odoo/owl";
import { useBankReconciliation } from "../bank_reconciliation_service";
import { useService } from "@web/core/utils/hooks";
import { x2ManyCommands } from "@web/core/orm_plugin";
export class BankRecReconciledLineName extends Component {
static template = "account_accountant.BankRecReconciledLineName";
props = useProps({
statementLine: t.object(),
linesToReconcile: t.array(),
moveLineId: t.string(),
valueToDisplay: t.object(),
});
setup() {
this.orm = useService("orm");
this.bankReconciliation = useBankReconciliation();
}
async deleteTax(lineId, taxChanged) {
const lineData = this.props.linesToReconcile.filter(
(line) => line.id === parseInt(lineId)
)[0];
await this.orm.call("account.bank.statement.line", "edit_reconcile_line", [
this.props.statementLine.data.id,
lineData.id,
{ tax_ids: [[x2ManyCommands.UNLINK, taxChanged.data.id]] },
]);
this.props.statementLine.load();
this.bankReconciliation.reloadChatter();
}
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.BankRecReconciledLineName">
<t t-if="this.props.valueToDisplay?.tax">
<t t-foreach="this.props.valueToDisplay.tax" t-as="tax_id" t-key="tax_id_index">
<div class="o_tag d-inline-flex align-items-center badge rounded-pill o_tag_color_0 flex-shrink-0" t-att-class="!tax_id_last ? 'me-1': ''">
<span class="o_tag_badge_text text-truncate" t-out="tax_id.data.display_name"/>
</div>
</t>
</t>
<t t-else="" t-out="this.props.valueToDisplay.move or this.props.valueToDisplay.account"/>
</t>
</templates>

View File

@@ -0,0 +1,130 @@
import {
SelectCreateDialog,
selectCreateDialogProps,
} from "@web/views/view_dialogs/select_create_dialog";
import { formatMonetary } from "@web/views/fields/formatters";
import { useService } from "@web/core/utils/hooks";
import { useProps, t } from "@odoo/owl";
const { DateTime } = luxon;
export class BankRecSelectCreateDialog extends SelectCreateDialog {
static template = "account_accountant.BankRecSelectCreateDialog";
props = useProps({
...selectCreateDialogProps,
suspenseAccountLine: t.object(),
reference: t.string(),
date: t.instanceOf(DateTime),
size: t.string().optional("lg"),
});
setup() {
super.setup();
this.orm = useService("orm");
this.ui = useService("ui");
this.state.remainingAmount = this.suspenseAccountLine.amount_currency;
this.state.remainingAmountFormatted = this.remainingAmountFormatted;
this.state.hideRemainingAmount = false;
this.baseViewProps.onSelectionChanged = (resIds, selectedLines) => {
this.state.resIds = resIds;
this.changeInSelectedMoveLine(selectedLines);
};
this.baseViewProps.bankRecInfo = {
date: this.formattedStatementLineDate,
reference: this.props.reference,
state: this.state,
currencyId: this.suspenseAccountLine.currency_id.id,
onSelectionChanged: (controller) => this.onSelectionChanged(controller),
};
}
async changeInSelectedMoveLine(selectedLines) {
this.state.hideRemainingAmount = false;
if (!selectedLines?.length) {
this.state.remainingAmount = this.suspenseAccountLine.amount_currency;
this.state.remainingAmountFormatted = this.remainingAmountFormatted;
return;
}
let selectedLinesSum = 0;
// When the suspense currency is different from the company one, we cannot compute the remaining amount correctly
// due to the currency rates. So in this case, when the user select multiple currencies we add the remaining amount
if (
this.suspenseAccountLine.currency_id.id !==
this.suspenseAccountLine.company_currency_id.id
) {
const selectedLineCurrencies = [
...new Set(selectedLines.map((line) => line.currency_id)),
];
if (
selectedLineCurrencies.length !== 1 ||
(selectedLineCurrencies.length === 1 &&
selectedLineCurrencies[0] !== this.suspenseAccountLine.currency_id.id)
) {
this.state.hideRemainingAmount = true;
return;
} else {
selectedLinesSum = selectedLines.reduce(
(sum, line) => sum + line.amount_residual_currency,
0
);
}
} else {
selectedLinesSum = selectedLines.reduce((sum, line) => sum + line.amount_residual, 0);
}
this.state.remainingAmount = this.suspenseAccountLine.amount_currency + selectedLinesSum;
this.state.remainingAmountFormatted = this.remainingAmountFormatted;
}
async onSelectionChanged(controller) {
const resIds = await controller.model.root.getResIds(true);
if (!resIds.length) {
this.baseViewProps.onSelectionChanged(resIds, []);
}
let selectedLines;
// When being in the list view with more element than the limit and doing a select all, the user has the
// possibility to select more element than the limit. In this case the isDomainSelected is True
if (controller.isDomainSelected) {
const { resModel, context } = controller.model.root._config;
selectedLines = await this.orm.read(
resModel,
resIds,
["amount_residual", "amount_residual_currency", "currency_id"],
{ context }
);
} else {
selectedLines = Object.values(controller.model.root.records)
.filter((record) => resIds.includes(record._config.resId))
.map((record) => {
const data = record.data;
return {
amount_residual: data.amount_residual,
amount_residual_currency: data.amount_residual_currency,
currency_id: data.currency_id.id,
};
});
}
this.baseViewProps.onSelectionChanged(resIds, selectedLines);
}
get suspenseAccountLine() {
return this.props?.suspenseAccountLine;
}
get remainingAmountFormatted() {
return formatMonetary(this.state.remainingAmount, {
currencyId: this.suspenseAccountLine.currency_id.id,
});
}
get formattedStatementLineDate() {
return this.props.date?.toLocaleString({
month: "short",
day: "2-digit",
});
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="account_accountant.BankRecSelectCreateDialog" t-inherit="web.SelectCreateDialog" t-inherit-mode="primary">
<xpath expr="//Dialog" position="attributes">
<attribute name="size">this.props.size</attribute>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,57 @@
import { proxy, useProps, t } from "@odoo/owl";
import { KanbanController } from "@web/views/kanban/kanban_controller";
import { KanbanRenderer, kanbanRendererProps } from "@web/views/kanban/kanban_renderer";
import { kanbanView } from "@web/views/kanban/kanban_view";
import { registry } from "@web/core/registry";
import { standardViewProps } from "@web/views/standard_view_props";
export class BankRecReconcileDialogKanbanController extends KanbanController {
static template = "account_accountant.BankRecReconcileDialogKanbanView";
props = useProps({
...standardViewProps,
readonly: t.boolean().optional(),
allowSelectors: t.boolean().optional(true),
Compiler: t.function(),
Model: t.function(),
Renderer: t.function(),
buttonTemplate: t.string(),
archInfo: t.object(),
createRecord: t.function().optional(() => () => {}),
selectRecord: t.function().optional(() => () => {}),
bankRecInfo: t.object().optional(),
});
async onSelectionChanged() {
this.props.bankRecInfo.onSelectionChanged(this);
}
}
export class BankRecReconcileDialogKanbanRenderer extends KanbanRenderer {
static template = "account_accountant.BankRecReconcileDialogKanbanRenderer";
props = useProps({
...kanbanRendererProps,
bankRecInfo: t.any().optional(),
});
setup() {
super.setup();
if (this.props.bankRecInfo?.state) {
this.bankRecState = proxy(this.props.bankRecInfo.state);
}
}
}
export const bankRecReconcileDialogKanbanRenderer = {
...kanbanView,
Renderer: BankRecReconcileDialogKanbanRenderer,
Controller: BankRecReconcileDialogKanbanController,
props: (genericProps, view) => {
const baseProps = kanbanView.props(genericProps, view);
return {
...baseProps,
bankRecInfo: genericProps.bankRecInfo,
};
},
};
registry.category("views").add("bank_rec_dialog_kanban", bankRecReconcileDialogKanbanRenderer);

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="account_accountant.BankRecReconcileDialogKanbanRenderer" t-inherit="web.KanbanRenderer" t-inherit-mode="primary">
<xpath expr="//t[@t-foreach='this.getGroupsOrRecords()']" position="before">
<div t-if="this.props.bankRecInfo and this.uiService.isSmall" class="o_bank_rec_info_header border-top border-bottom d-flex align-items-center gap-2 w-100 p-3" name="bank_reconciliation_info">
<span class="text-nowrap min-w-2" t-out="this.props.bankRecInfo.date"/> -
<div class="text-truncate" t-out="this.props.bankRecInfo.reference"/>
<div class="text-nowrap text-end ms-auto" name="remaining_amount">
<span class="text-muted">Balance: </span>
<t t-if="!this.bankRecState.hideRemainingAmount" t-out="this.bankRecState.remainingAmountFormatted"/>
<t t-else=""> / </t>
</div>
</div>
</xpath>
</t>
<t t-name="account_accountant.BankRecReconcileDialogKanbanView" t-inherit="web.KanbanView" t-inherit-mode="primary">
<xpath expr="//t[@t-component='this.props.Renderer']" position="attributes">
<attribute name="bankRecInfo">this.props.bankRecInfo</attribute>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,70 @@
import { useProps, proxy, t } from "@odoo/owl";
import { ListController } from "@web/views/list/list_controller";
import { ListRenderer, listRendererProps } from "@web/views/list/list_renderer";
import { listView } from "@web/views/list/list_view";
import { registry } from "@web/core/registry";
import { standardViewProps } from "@web/views/standard_view_props";
export class BankRecReconcileDialogListController extends ListController {
static template = "account_accountant.BankRecReconcileDialogListView";
// Inline copy of ListController's props schema (no exported const upstream)
props = useProps({
...standardViewProps,
allowSelectors: t.boolean().optional(true),
onSelectionChanged: t.function().optional(),
readonly: t.boolean().optional(),
allowOpenAction: t.boolean().optional(true),
Model: t.function(),
Renderer: t.function(),
buttonTemplate: t.string(),
archInfo: t.object(),
createRecord: t.function().optional(() => () => {}),
selectRecord: t.function().optional(() => () => {}),
bankRecInfo: t.object().optional(),
});
async onSelectionChanged() {
this.props.bankRecInfo.onSelectionChanged(this);
}
}
export class BankRecReconcileDialogListRenderer extends ListRenderer {
static template = "account_accountant.BankRecReconcileDialogListRenderer";
static recordRowTemplate = "account_accountant.BankRecReconcileDialogListRenderer.RecordRow";
props = useProps({
...listRendererProps,
bankRecInfo: t.any().optional(),
});
setup() {
super.setup();
if (this.props.bankRecInfo?.state) {
this.bankRecState = proxy(this.props.bankRecInfo.state);
}
}
async openMoveView(record) {
this.env.services.action.doAction({
type: "ir.actions.act_window",
res_model: "account.move",
res_id: record.data.move_id.id,
views: [[false, "form"]],
target: "current",
});
}
}
export const bankRecReconcileDialogListRenderer = {
...listView,
Renderer: BankRecReconcileDialogListRenderer,
Controller: BankRecReconcileDialogListController,
props: (genericProps, view) => {
const baseProps = listView.props(genericProps, view);
return {
...baseProps,
bankRecInfo: genericProps.bankRecInfo,
};
},
};
registry.category("views").add("bank_rec_dialog_list", bankRecReconcileDialogListRenderer);

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="account_accountant.BankRecReconcileDialogListRenderer" t-inherit="web.ListRenderer" t-inherit-mode="primary">
<xpath expr="//th[@t-if='this.hasOpenFormViewColumn']" position="replace">
<th class="o_list_open_form_view w-print-0 p-print-0"/>
</xpath>
<xpath expr="//div[hasclass('o_list_renderer')]" position="attributes">
<attribute name="class" add="o_bank_rec_list_renderer" separator=" "/>
</xpath>
<xpath expr="//table" position="before">
<div t-if="this.props.bankRecInfo and !this.uiService.isSmall" class="o_bank_rec_info_header p-3 d-flex gap-2 min-w-0 border-bottom" name="bank_reconciliation_info">
<span class="text-nowrap min-w-2 o_bank_rec_statement_line_date" t-out="this.props.bankRecInfo.date"/> -
<div t-out="this.props.bankRecInfo.reference"/>
<div class="text-nowrap text-end o_bank_rec_statement_line_remaining_amount ms-auto" name="remaining_amount">
<span class="text-muted">Balance: </span>
<t t-if="!this.bankRecState.hideRemainingAmount" t-out="this.bankRecState.remainingAmountFormatted"/>
<t t-else=""> / </t>
</div>
</div>
</xpath>
</t>
<t t-name="account_accountant.BankRecReconcileDialogListView" t-inherit="web.ListView" t-inherit-mode="primary">
<xpath expr="//t[@t-component='this.props.Renderer']" position="attributes">
<attribute name="bankRecInfo">this.props.bankRecInfo</attribute>
</xpath>
</t>
<t t-name="account_accountant.BankRecReconcileDialogListRenderer.RecordRow" t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="primary">
<xpath expr="//t[@t-if='this.hasOpenFormViewColumn']" position="replace">
<td class="o_list_record_open_form_view w-print-0 p-print-0 text-center"
t-custom-click.stop="() => this.openMoveView(record)"
>
<button class="btn btn-link align-top text-end"
name="Open in form view"
aria-label="Open in form view"
>View</button>
</td>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,266 @@
import { BankRecButtonList } from "../button_list/button_list";
import { BankRecLineToReconcile } from "../line_to_reconcile/line_to_reconcile";
import { BankRecReconciledLineName } from "../reconciled_line_name/reconciled_line_name";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { formatMonetary } from "@web/views/fields/formatters";
import { KanbanRecord } from "@web/views/kanban/kanban_record";
import { user } from "@web/core/user";
import { useService } from "@web/core/utils/hooks";
import { onWillStart, signal, computed } from "@odoo/owl";
import { useBankReconciliation } from "../bank_reconciliation_service";
import { floatIsZero } from "@web/core/utils/numbers";
export class BankRecStatementLine extends KanbanRecord {
static template = "account_accountant.BankRecStatementLine";
static components = {
BankRecLineToReconcile,
BankRecButtonList,
DropdownItem,
BankRecReconciledLineName,
};
allLinesInSameForeignCurrency = computed(() => this._computeAllLinesInSameForeignCurrency());
accountMoveLines = computed(() => this.recordData.line_ids.records.map((line) => line.data));
hasAttachment = computed(() => this._computeHasAttachment());
hasInvalidAnalytics = computed(() =>
this.linesToReconcile().some((line) => line.has_invalid_analytics)
);
isUnfolded = signal(false);
linesToReconcile = computed(() => this._computeLinesToReconcile());
suspenseAccountLine = computed(() => {
const suspenseId = this.recordData.journal_id?.suspense_account_id.id;
return this.accountMoveLines().find((line) => line.account_id.id === suspenseId);
});
setup() {
super.setup();
this.orm = useService("orm");
this.ui = useService("ui");
this.bankReconciliation = useBankReconciliation();
if (this.env.model.config.context?.default_st_line_id === this.props.record.resId) {
this.isUnfolded.set(true);
this.bankReconciliation.selectStatementLine(this.props.record);
}
onWillStart(async () => {
this.userCanReview = await user.hasGroup("account.group_account_user");
});
}
getCardClasses() {
let classes = super.getCardClasses();
classes += " mb-0";
if (this.numberOfStatementLines === 1) {
classes += " mt-3";
}
return classes;
}
// -----------------------------------------------------------------------------
// ACTION
// -----------------------------------------------------------------------------
openStatementCreate() {
this.action.doAction("account_accountant.action_bank_statement_form_bank_rec_widget", {
additionalContext: {
split_line_id: this.recordData.id,
default_journal_id: this.recordData.journal_id.id,
},
onClose: async () => {
this.env.model.load();
},
});
}
openPartner() {
this.action.doAction({
type: "ir.actions.act_window",
res_model: "res.partner",
res_id: this.partner.id,
views: [[false, "form"]],
target: "current",
});
}
async removePartner() {
await this.orm.write("account.bank.statement.line", [this.recordData.id], {
partner_id: false,
});
this.record.load();
}
async undoReconciliation() {
await this.orm.call(
"account.bank.statement.line",
"action_undo_reconciliation",
[this.recordData.id],
{
context: {
skip_account_move_synchronization: true,
},
}
);
this.record.load();
}
// -----------------------------------------------------------------------------
// HELPER
// -----------------------------------------------------------------------------
_computeLinesToReconcile() {
const suspenseId = this.recordData.journal_id?.suspense_account_id.id;
const defaultId = this.recordData.journal_id?.default_account_id.id;
return this.accountMoveLines().filter(
(line) => line.account_id.id !== suspenseId && line.account_id.id !== defaultId
);
}
_computeAllLinesInSameForeignCurrency() {
return (
this.recordData.foreign_currency_id &&
this.linesToReconcile().length > 0 &&
this.linesToReconcile().every(
(line) => line.currency_id.id === this.recordData.foreign_currency_id.id
)
);
}
/**
* Checks if there is at least one attachment associated with the bank statement line or its related records.
*
* This getter aggregates attachment counts from attachment_ids field which is a compute for:
* - The bank statement line record itself or the related move since attachment_ids is a related to move_id.attachment_ids.
* - The related move lines themselves, if they have attachments directly associated (`line.move_attachment_ids`)
* except the attachments link to the statement.
* - The lines reconciled with the related move lines, specifically checking for attachments on the
* move associated with those reconciled lines.
*
* This check ensures that all attachments from associated invoices, bills, and other related documents are considered.
*
* @returns {number} The total number of attachments found. A return value greater than 0 indicates the presence of attachments.
*/
_computeHasAttachment() {
return this.recordData.has_attachments;
}
get record() {
return this.props.record;
}
get recordData() {
return this.props.record.data;
}
toggleUnfold(event) {
if (event?.pointerType === "mouse") {
this.isUnfolded.set(!this.isUnfolded());
}
this.selectStatementLine(event);
}
selectStatementLine(event) {
// In case we are on a mobile device, we want to keep the old onClick behaviour
if (this.recordData.is_reconciled && event?.pointerType !== "mouse") {
this.isUnfolded.set(!this.isUnfolded());
}
// Update the chatter with the last selected element
this.bankReconciliation.selectStatementLine(this.record);
}
openChatter() {
this.bankReconciliation.selectStatementLine(this.record);
this.bankReconciliation.openChatter();
}
get numberOfStatementLines() {
return this.env.model.root.count;
}
get formattedAmount() {
return formatMonetary(this.recordData.amount, {
currencyId: this.recordData.currency_id.id,
});
}
get formattedDate() {
return this.recordData.date.toLocaleString({
month: "short",
day: "2-digit",
});
}
get formattedFullDate() {
return this.recordData.date.toLocaleString({
month: "long",
day: "numeric",
year: "numeric",
});
}
get partner() {
return this.recordData.partner_id;
}
get suspenseAccountLineFormattedAmount() {
return formatMonetary(this.suspenseAccountLine().amount_currency, {
currencyId: this.suspenseAccountLine()?.currency_id.id,
});
}
get activityNumber() {
return this.recordData.activity_ids.count;
}
get amountClasses() {
const { foreign_currency_id: foreignCurrencyId, amount } = this.recordData;
const classes = foreignCurrencyId ? "w-50" : "w-100";
if (this.isDraft && !floatIsZero(amount)) {
return `${classes} text-info`;
}
if (amount > 0) {
return `${classes} fw-bold`;
}
if (amount < 0) {
return `${classes} text-danger fw-bold`;
}
return `${classes} text-secondary`;
}
get buttonListProps() {
return {
statementLineRootRef: this.rootRef,
statementLine: this.record,
reconcileLineCount:
this.bankReconciliation.reconcileCountPerPartnerId[this.recordData.partner_id.id] ??
null,
reconcileModels:
this.bankReconciliation.reconcileModelPerStatementLineId[this.recordData.id] ?? [],
preSelectedReconciliationModel: this.accountMoveLines()
.filter(
(line) =>
line.reconcile_model_id.id &&
// We don't want to show the button for matching rules as they are only automatic.
line.reconcile_model_id.rule_type === "reco_model"
)
.map((line) => line.reconcile_model_id)?.[0],
};
}
get formattedAmountCurrencyInForeign() {
return formatMonetary(this.recordData.amount_currency, {
currencyId: this.recordData.foreign_currency_id.id,
});
}
get isSelected() {
return this.recordData.id === this.bankReconciliation.statementLineId;
}
get isChatterOpen() {
return this.bankReconciliation.chatterState.visible;
}
get isDraft() {
return this.recordData.state === "draft";
}
}

View File

@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.BankRecStatementLine" t-inherit="web.KanbanRecord" t-inherit-mode="primary">
<xpath expr="//article" position="replace">
<article
t-att-class="this.getCardClasses()"
t-att-data-id="this.record.id"
t-att-tabindex="this.record.model.useSampleModel ? -1 : 0"
t-custom-click="this.onGlobalClick"
t-on-touchstart="this.onTouchStart"
t-on-touchmove="this.onTouchMoveOrCancel"
t-on-touchcancel="this.onTouchMoveOrCancel"
t-on-touchend="this.onTouchEnd"
t-ref="this.rootRef">
<div name="bank_statement_line" class="o_statement_line w-100 p-2" t-on-click="this.selectStatementLine" t-att-class="{'o_selected_statement_line': this.isSelected, 'text-info': this.isDraft}">
<button t-if="!this.recordData.statement_id" type="button" class="o_statement_btn d-none d-md-block position-absolute top-0 end-0 btn btn-sm btn-secondary" t-on-click.stop="this.openStatementCreate">
Statement
</button>
<div class="o_grid_container">
<div class="o_row">
<div class="d-flex gap-3">
<div t-att-data-tooltip="this.formattedFullDate">
<t t-out="this.formattedDate"/>
</div>
<div t-on-click.stop="this.openChatter" t-if="!this.ui.isSmall" class="o_chatter_icon btn-link text-action" t-att-class="{'visible': this.activityNumber or this.hasAttachment()}">
<div t-if="this.activityNumber" class="activity-container position-relative">
<i class="oi oi-lg" data-icon="schedule" role="img" aria-label="Activities"/>
<span class="activity-badge badge rounded-pill" t-out="this.activityNumber"/>
</div>
<i t-elif="this.hasAttachment()"
class="oi oi-lg"
data-icon="attach_file"
role="img"
aria-label="Attachment"
/>
<i t-elif="!this.isChatterOpen"
class="oi oi-lg"
data-icon="forum"
role="img"
aria-label="Journal Entry"
/>
</div>
</div>
<div class="o_payment_ref user-select-text d-none d-md-block"
t-att-class="this.isUnfolded() ? 'overflow-wrap' : 'text-truncate'">
<span class="d-inline">
<t t-if="this.partner">
<a class="fw-bold" href="#" t-on-click.prevent.stop="this.openPartner">
<span t-out="this.partner.display_name" name="statement_line_partner_name"/>
</a>
<button class="btn btn-link oi p-0 align-baseline" data-icon="close_small" t-on-click.stop="this.removePartner" t-if="!this.linesToReconcile().length"/>
</t>
<t t-elif="this.recordData.partner_name">
<span class="fw-bold" t-out="this.recordData.partner_name" name="statement_line_partner_name"/>
</t>
<span t-att-class="this.partner or this.recordData.partner_name ? 'ms-1' : undefined"
t-out="this.recordData.payment_ref"
/>
</span>
</div>
<!-- Only available on large screen -->
<div class="o_button_line d-none d-md-flex align-items-start">
<BankRecButtonList t-props="this.buttonListProps" suspenseAccountLine="this.suspenseAccountLine()" t-if="!this.recordData.is_reconciled or (this.userCanReview and ['todo', 'anomaly'].includes(this.recordData.review_state))"/>
<span class="badge rounded-pill py-1 ps-1" t-att-class="{ 'pe-1': !this.isUnfolded(), 'text-success bg-success-subtle': !this.hasInvalidAnalytics(), 'text-warning bg-warning-subtle': this.hasInvalidAnalytics()}" t-if="this.recordData.is_reconciled">
<i t-if="this.hasInvalidAnalytics()" class="oi" data-icon="warning" data-tooltip="Some lines have invalid analytic distribution"/>
<i t-if="!this.hasInvalidAnalytics()" class="oi" data-icon="check"/>
<span t-if="this.isUnfolded()" class="ms-1">
Reconciled
</span>
</span>
<div t-if="this.recordData.is_reconciled and !this.isUnfolded()" class="text-start text-truncate text-muted" name="reconciled_line_name">
<div t-out="this.recordData.reconciled_lines_name"/>
</div>
<button class="btn btn-link p-0 text-600" t-on-click.stop="this.undoReconciliation" t-if="this.isUnfolded() and this.recordData.is_reconciled and !this.recordData.move_id.inalterable_hash" data-tooltip="Undo reconciliation">
<i class="oi" data-icon="undo"/>
</button>
</div>
<div class="d-flex align-items-start justify-content-between o_line_amount">
<span class="text-muted w-50 text-end text-nowrap" t-if="this.recordData.foreign_currency_id">
<t t-out="this.formattedAmountCurrencyInForeign"/>
</span>
<span t-att-class="this.amountClasses" class="text-end text-nowrap" t-out="this.formattedAmount"/>
</div>
<div class="d-none d-md-block text-end" t-on-click.stop="this.toggleUnfold" t-if="this.recordData.is_reconciled and this.linesToReconcile().length">
<i class="oi" t-attf-data-icon="{{this.isUnfolded() ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}}"/>
</div>
<div class="d-none d-md-block" t-else=""/> <!-- To keep empty space if no chevron -->
</div>
<!-- Only available on small screen -->
<div class="o_row d-md-none">
<span class="text-truncate o_payment_ref"
t-out="this.recordData.payment_ref"
/>
</div>
<t t-if="this.isUnfolded() or !this.recordData.is_reconciled">
<t t-foreach="this.linesToReconcile()" t-as="line" t-key="line_index">
<BankRecLineToReconcile statementLine="this.record" line="line"/>
</t>
<div class="o_row" t-if="this.linesToReconcile().length">
<div t-if="this.suspenseAccountLine()" class="d-none d-md-flex fw-bold text-muted align-items-center justify-content-end o_line_amount" t-att-class="this.allLinesInSameForeignCurrency() ? 'w-50' : 'w-100'">
<t t-out="this.suspenseAccountLineFormattedAmount"/>
</div>
</div>
</t>
<div class="o_row d-md-none">
<div class="o_button_line">
<BankRecButtonList t-props="this.buttonListProps" suspenseAccountLine="this.suspenseAccountLine()" t-if="!this.recordData.is_reconciled or (this.userCanReview and ['todo', 'anomaly'].includes(this.recordData.review_state))"/>
<div t-if="this.recordData.is_reconciled" class="d-flex gap-2 mt-2">
<span class="badge rounded-pill py-1 ps-1" t-att-class="{ 'pe-1': !this.isUnfolded(), 'text-success bg-success-subtle': !this.hasInvalidAnalytics(), 'text-warning bg-warning-subtle': this.hasInvalidAnalytics()}">
<i t-if="this.hasInvalidAnalytics()" class="oi" data-icon="warning" data-tooltip="Some lines have invalid analytic distribution"/>
<i t-if="!this.hasInvalidAnalytics()" class="oi" data-icon="check"/>
<span t-if="this.isUnfolded()" class="ms-1">
Reconciled
</span>
</span>
<span t-if="this.recordData.is_reconciled and !this.isUnfolded()" class="text-start text-muted">
<div t-out="this.recordData.reconciled_lines_name"/>
</span>
</div>
</div>
</div>
</div>
</div>
</article>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,73 @@
import { Component, useProps, t } from "@odoo/owl";
export const bankRecStatementSummaryProps = {
record: t.object().optional(),
label: t.string().optional(),
amount: t.string().optional(),
action: t.function(),
actionReview: t.function().optional(),
journalId: t.number().optional(),
isValid: t.boolean().optional(true),
journalIsInvalid: t.boolean().optional(),
problemDescription: t.string().optional(),
isReviewFilterActive: t.boolean().optional(),
};
export class BankRecStatementSummary extends Component {
static template = "account_accountant.BankRecStatementSummary";
props = useProps(bankRecStatementSummaryProps);
actionApplyInvalidStatement() {
const facets = this.env.searchModel.facets;
const searchItems = this.env.searchModel.searchItems;
const invalidStatementFilter = Object.values(searchItems).find(
(i) => i.name == "invalid_statement"
);
const invalidStatementFacet = facets.filter(
(i) => i.groupId == invalidStatementFilter.groupId
);
if (
invalidStatementFacet.length == 0 ||
!invalidStatementFacet[0].values.includes(invalidStatementFilter.description)
) {
this.env.searchModel.toggleSearchItem(invalidStatementFilter.id);
}
}
get formatStatementDates() {
if (!this.props.record) {
return {};
}
const statementLines = this.env.model.root.records.filter(
(line) => line.data.statement_id.id === this.props.record.statementId
);
if (statementLines.length > 1) {
const dateFrom = statementLines.at(-1).data.date.toLocaleString({
month: "numeric",
day: "2-digit",
});
const dateTo = statementLines.at(0).data.date.toLocaleString({
month: "numeric",
day: "2-digit",
});
if (dateFrom === dateTo) {
return { dateFrom: dateFrom };
}
return { dateFrom: dateFrom, dateTo: dateTo };
}
const date = statementLines.at(0).data.date.toLocaleString({
month: "numeric",
day: "2-digit",
});
return { dateFrom: date };
}
get label() {
return this.props.record?.name || this.props.label || "";
}
get amount() {
return this.props.record?.amount || this.props.amount || "";
}
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.BankRecStatementSummary">
<div class="o_statement_summary d-flex justify-content-between align-items-center w-100 p-2">
<div name="label_statement_summary" class="d-flex gap-2 align-items-center">
<h4 t-out="this.label"
t-on-click="this.props.action"
class="m-0 cursor-pointer"
t-att-class="{'text-danger': !this.props.isValid}"/>
<h6 t-if="this.props.problemDescription"
t-out="this.props.problemDescription"
class="my-0 ms-2 text-warning"
/>
<h6 class="my-0 text-info cursor-pointer"
t-if="!this.props.isValid and !this.props.isReviewFilterActive"
t-on-click="this.props.actionReview"
>
Review
</h6>
</div>
<div t-if="this.amount"
class="btn btn-link p-0 fw-bold fs-4"
t-on-click="this.props.action"
>
<t t-set="dates" t-value="this.formatStatementDates"/>
<t t-if="dates?.dateFrom">
<t t-out="dates.dateFrom"/>
</t>
<t t-if="dates?.dateTo">
- <t t-out="dates.dateTo"/>
</t>
<span class="ms-2" t-out="this.props.amount"/>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,35 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { rpc } from "@web/core/network/rpc";
import { ExportDataDialog } from "@web/views/view_dialogs/export_data_dialog";
patch(ExportDataDialog.prototype, {
async fetchFields(value) {
await super.fetchFields(value);
const analyticLineIdsField = this.knownFields['analytic_line_ids'];
if (analyticLineIdsField) {
// If analytic_distribution field is here, we remove it to replace it by the new fields
this.state.exportList = this.state.exportList.filter(
(field) => field.id !== 'analytic_distribution'
);
const analyticLineFields = await rpc("/web/export/get_fields", {
model: analyticLineIdsField.params.model,
prefix: analyticLineIdsField.params.prefix,
parent_name: analyticLineIdsField.params.parent_field.string,
import_compat: analyticLineIdsField.default_export,
parent_field_type: analyticLineIdsField.params.parent_field.type,
domain:[],
});
// We exclude auto_account_id as it's a magic field who doesn't need to be exported
const filteredAnalyticLineFields = analyticLineFields.filter(
(field) => field.params?.model === 'account.analytic.account'
&& !field.id.includes('auto_account_id')
|| field.id === 'analytic_line_ids/amount'
);
this.state.exportList.push(...filteredAnalyticLineFields);
}
},
});

View File

@@ -0,0 +1,81 @@
import { _t } from "@web/core/l10n/translation";
import { localization } from "@web/core/l10n/localization";
import { registry } from "@web/core/registry";
import { standardFieldProps } from "@web/views/fields/standard_field_props";
import { usePopover } from "@web/core/popover/popover_hook";
import { useService } from "@web/core/utils/hooks";
import { Component, markup, signal, t, useProps } from "@odoo/owl";
const isNonEmptyObject = (obj) => obj && Object.keys(obj).length > 0;
class TransactionDetailsPopover extends Component {
static template = "account_accountant.TransactionDetailsPopover";
props = useProps({
formattedData: t.string(),
setOverPopover: t.function(),
close: t.function().optional(),
});
}
class TransactionDetailsField extends Component {
static template = "account_accountant.TransactionDetailsField";
static components = { Popover: TransactionDetailsPopover };
props = useProps(standardFieldProps);
previewRef = signal.ref();
setup() {
const position = localization.direction === "rtl" ? "bottom" : "left";
this.popover = usePopover(TransactionDetailsPopover, { position });
this.orm = useService("orm");
this.hideTimeout = null;
this.isOverPopover = false;
}
get hasData() {
return isNonEmptyObject(this.props.record.data[this.props.name]);
}
async showPopup() {
if (this.popover.isOpen || !this.hasData) {
return;
}
const formattedData = await this.orm.call(
this.props.record.resModel,
"format_transaction_details",
[this.props.record.resId],
{ context: this.props.record.context }
);
if (formattedData) {
this.popover.open(this.previewRef(), {
formattedData: markup(formattedData),
setOverPopover: this.setOverPopover.bind(this),
});
}
}
hidePopup() {
this.hideTimeout = setTimeout(() => {
if (!this.previewRef()?.matches(":hover") && !this.isOverPopover) {
this.popover.close();
}
}, 100);
}
setOverPopover(value) {
this.isOverPopover = value;
if (!value) {
this.hidePopup();
}
}
}
registry.category("fields").add("formatted_transaction_details", {
component: TransactionDetailsField,
displayName: _t("Formatted Transaction Details"),
supportedTypes: ["json"],
});

View File

@@ -0,0 +1,4 @@
.popover-content-wrapper {
max-height: 400px;
overflow-y: auto;
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="account_accountant.TransactionDetailsField">
<div t-if="this.hasData" class="text-center">
<i class="oi" data-icon="search"
t-ref="this.previewRef"
t-on-mouseenter="this.showPopup"
t-on-mouseleave="this.hidePopup"/>
</div>
</t>
<t t-name="account_accountant.TransactionDetailsPopover">
<div class="p-2 popover-content-wrapper"
t-on-mouseenter="() => this.props.setOverPopover(true)"
t-on-mouseleave="() => this.props.setOverPopover(false)">
<t t-out="this.props.formattedData"/>
</div>
</t>
</templates>

View File

@@ -0,0 +1,26 @@
import { Component } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
export class CreateJournalButton extends Component {
static template = "account.CreateJournalButton";
static components = { DropdownItem };
setup() {
this.action = useService("action");
}
openWizard() {
this.action.doAction("account_accountant.action_journal_create_wizard");
}
}
export const CreateJournalButtonActionMenu = {
Component: CreateJournalButton,
isDisplayed: ({ config, searchModel}) =>
searchModel.resModel === "account.journal" &&
config.viewSubType === 'account_dashboard_kanban',
};
registry.category("cogMenu").add("account-create-journal", CreateJournalButtonActionMenu);

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="account.CreateJournalButton">
<DropdownItem onSelected.bind="this.openWizard">
Add journal
</DropdownItem>
</t>
</templates>

View File

@@ -0,0 +1,201 @@
import { _t } from "@web/core/l10n/translation";
import { Component, onWillStart, t, useProps } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { standardActionServiceProps } from "@web/webclient/actions/action_plugin";
import { user } from "@web/core/user";
import { useHotkey } from "@web/core/hotkeys/hotkey_hook";
class JournalCreateWizardCard extends Component {
static template = "account.JournalCreateWizardCard";
props = useProps({
images: t.any(),
title: t.any(),
text: t.any(),
});
}
export class JournalCreateWizard extends Component {
static template = "account.JournalCreateWizard";
static components = { JournalCreateWizardCard };
props = useProps(standardActionServiceProps);
setup() {
super.setup();
this.orm = useService("orm");
this.action = useService("action");
// Setup keyboard navigation
useHotkey("arrowdown", () => this.navigateVertical("next"), { bypassEditableProtection: true, allowRepeat: true });
useHotkey("arrowup", () => this.navigateVertical("previous"), { bypassEditableProtection: true, allowRepeat: true });
useHotkey("arrowright", () => this.navigateHorizontal("next"), { bypassEditableProtection: true, allowRepeat: true });
useHotkey("arrowleft", () => this.navigateHorizontal("previous"), { bypassEditableProtection: true, allowRepeat: true });
useHotkey("enter", () => this.activateFocusedElement(), { bypassEditableProtection: true });
onWillStart(async () => {
this.hasGroupAccountUser = await user.hasGroup("account.group_account_user");
});
}
async openAccountWizard(type) {
const addBankAction = await this.orm.call(
"res.company",
`setting_init_${type}_account_action`,
user.activeCompany.ids
);
this.action.doAction(addBankAction);
this.env.dialogData.close();
}
openCreateJournalForm(type) {
this.action.doAction({
type: "ir.actions.act_window",
res_model: "account.journal",
views: [[false, "form"]],
target: "current",
context: { default_type: type },
});
}
cardImages(cardType) {
const result = cardType === "card" ? ["logo_visa", "logo_mastercard"] : [cardType];
return result.map((imageName) => `/account_accountant/static/src/img/journal_create_wizard/${imageName}.svg`);
}
get cardsData() {
const data = [
{
images: this.cardImages("bank"),
title: _t("Bank"),
text: _t("Connect your bank and payment gateways (Paypal, Stripe, ...) or record your transactions manually"),
onClick: () => this.openAccountWizard("bank"),
},
{
images: this.cardImages("card"),
title: _t("Card"),
text: _t("Connect your credit card accounts and manage your payouts"),
onClick: () => this.openAccountWizard("credit_card"),
},
{
images: this.cardImages("cash"),
title: _t("Cash"),
text: _t("Record your cash movements and transfers"),
onClick: () => this.openCreateJournalForm("cash"),
},
];
if (this.hasGroupAccountUser) {
data.push(
{
images: this.cardImages("general"),
title: _t("Miscellaneous Journal"),
text: _t("Payroll, depreciation, closing entries, deferred revenues, ...etc"),
onClick: () => this.openCreateJournalForm("general"),
},
{
images: this.cardImages("sale"),
title: _t("Sales Journal"),
text: _t("Create a separate journal for specific sales activities"),
onClick: () => this.openCreateJournalForm("sale"),
},
{
images: this.cardImages("purchase"),
title: _t("Purchases Journal"),
text: _t("Create a separate journal to organize vendor bills"),
onClick: () => this.openCreateJournalForm("purchase"),
}
);
}
return data;
}
/**
* Get all navigable elements within the wizard container
*/
getNavigableElements() {
const container = document.querySelector(".journal-create-wizard-card")?.closest(".container");
if (!container) {
return [];
}
return Array.from(container.querySelectorAll(".o-navigable"));
}
/**
* Group navigable elements into rows based on their vertical position.
* Returns an array of rows, each row being an array of elements.
*/
getElementRows(elements) {
const rows = [];
for (const el of elements) {
const top = el.getBoundingClientRect().top;
const existingRow = rows.find((row) => Math.abs(row[0].getBoundingClientRect().top - top) < 2);
if (existingRow) {
existingRow.push(el);
} else {
rows.push([el]);
}
}
return rows;
}
navigateVertical(direction) {
const elements = this.getNavigableElements();
if (elements.length === 0) {
return;
}
const activeElement = document.activeElement;
const rows = this.getElementRows(elements);
const rowIndex = rows.findIndex((row) => row.includes(activeElement));
if (rowIndex === -1) {
elements[0]?.focus();
return;
}
const colIndex = rows[rowIndex].indexOf(activeElement);
const targetRowIndex = direction === "next"
? Math.min(rowIndex + 1, rows.length - 1)
: Math.max(rowIndex - 1, 0);
const targetRow = rows[targetRowIndex];
// Use the same column, clamped to the target row's length
targetRow[Math.min(colIndex, targetRow.length - 1)]?.focus();
}
navigateHorizontal(direction) {
const elements = this.getNavigableElements();
if (elements.length === 0) {
return;
}
const activeElement = document.activeElement;
const rows = this.getElementRows(elements);
const currentRow = rows.find((row) => row.includes(activeElement));
if (!currentRow) {
elements[0]?.focus();
return;
}
const colIndex = currentRow.indexOf(activeElement);
const targetIndex = direction === "next"
? Math.min(colIndex + 1, currentRow.length - 1)
: Math.max(colIndex - 1, 0);
currentRow[targetIndex]?.focus();
}
/**
* Activate (click) the currently focused element
*/
activateFocusedElement() {
const activeElement = document.activeElement;
if (activeElement.classList.contains("o-navigable")) {
activeElement.click();
}
}
}
registry.category("actions").add("journal_create_wizard", JournalCreateWizard);

View File

@@ -0,0 +1,35 @@
.journal-create-wizard-card {
.card-body {
background: linear-gradient(to right, $card-bg, rgba($card-bg, .95));
}
&:hover,
&:focus {
background: $o-action;
outline: none;
}
&:focus {
box-shadow: 0 0 0 2px rgba($o-action, 0.5);
}
.o_tile {
background: url('/account_accountant/static/src/img/journal_create_wizard/tile.svg') center no-repeat;
background-size: contain;
aspect-ratio: 1 / 1;
inset: 0;
img {
inset: 0;
transform: rotateY(45deg) rotateZ(22deg) rotateX(20deg) translate(-7%, 5%);
}
&.o_tile_back {
background-position: right center;
img {
transform: rotateY(45deg) rotateZ(22deg) rotateX(20deg) translate(50%, -25%);
}
}
}
}

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="account.JournalCreateWizardCard">
<div class="col">
<div class="card h-100 shadow-sm cursor-pointer transition-base journal-create-wizard-card o-navigable" tabindex="0">
<div class="card-body d-flex justify-content-between align-items-start gap-3">
<div>
<h4 class="card-title" t-out="this.props.title"/>
<p class="card-text" t-out="this.props.text"/>
</div>
<img t-if="this.props.images.length === 1" t-att-src="this.props.images[0]" class="flex-shrink-0 w-25" t-att-alt="this.props.title"/>
<div t-elif="this.props.images.length >= 2" class="position-relative flex-shrink-0 w-25 ratio ratio-1x1">
<div class="o_tile w-75 h-auto mt-auto z-1">
<img class="position-absolute w-50 m-auto object-fit-contain" t-att-src="this.props.images[0]"/>
</div>
<div class="o_tile o_tile_back end-0 w-75 h-auto ms-auto">
<img class="position-absolute w-50 m-auto object-fit-contain" t-att-src="this.props.images[1]"/>
</div>
</div>
</div>
</div>
</div>
</t>
<t t-name="account.JournalCreateWizard">
<div class="container py-4">
<div class="row row-cols-1 row-cols-md-2 row-gap-2 row-gap-md-4">
<t t-foreach="this.cardsData" t-as="card" t-key="card['title']">
<JournalCreateWizardCard
images="card['images']"
title="card['title']"
text="card['text']"
t-on-click="card['onClick']"
/>
</t>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,45 @@
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";
import { ProductLabelSectionAndNoteListRender } from '@account/components/product_label_section_and_note_o2m/product_label_section_and_note_field_o2m';
import { M2OCellWithExtraFields } from '@account/components/m2o_cell_with_extra_fields/m2o_cell_with_extra_fields';
import { DateTimeField } from "@web/views/fields/datetime/datetime_field";
patch(ProductLabelSectionAndNoteListRender.prototype, {
getActiveColumns() {
let activeColumns = super.getActiveColumns();
const isDeferredDateColumnActive = activeColumns.some((col) => col.name === "deferred_start_date");
this.props.list.records.forEach((record) => {
// Assign based on the global column presence
record.showDeferredDate = isDeferredDateColumnActive || record.data.is_deferred_account;
});
// Always remove the deferred start date and deferred end date columns from active columns & show them under account
return activeColumns.filter((col) => !["deferred_start_date", "deferred_end_date"].includes(col.name));
}
});
Object.assign(M2OCellWithExtraFields.components, {
DateTimeField
});
patch(M2OCellWithExtraFields.prototype, {
get extraDeferredDateInfo() {
return {
props:{
// Standard Field Props
name: "deferred_start_date",
record: this.props.record,
readonly: this.isReadonlyList || this.props.record.data.has_deferred_moves,
// DateTime props
placeholder: _t("Deferred Date"),
endDateField: "deferred_end_date",
alwaysRange: true,
},
decorationWarning: this.props.record.data.has_abnormal_deferred_dates,
invisible: this.props.name !== 'account_id' || !this.props.record.showDeferredDate,
required: this.props.record.data.is_deferred_account,
};
}
});

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-inherit="account.M2OCellWithExtraFields" t-inherit-mode="extension">
<xpath expr="//div[@id='extra_fields']" position="inside">
<div t-if="!this.extraDeferredDateInfo.invisible" t-att-class="{'o_cell_wrapper': this.extraDeferredDateInfo.required, 'text-warning': this.extraDeferredDateInfo.decorationWarning}">
<DateTimeField t-props="this.extraDeferredDateInfo.props"/>
</div>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,45 @@
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { standardFieldProps } from "@web/views/fields/standard_field_props";
import { Component, useProps } from "@odoo/owl";
class MatchingLink extends Component {
props = useProps(standardFieldProps);
static template = "account_accountant.MatchingLink";
setup() {
this.orm = useService("orm");
this.action = useService("action");
}
async reconcile() {
this.action.doAction("account_accountant.action_move_line_posted_unreconciled", {
additionalContext: {
search_default_partner_id: this.props.record.data.partner_id.id,
search_default_account_id: this.props.record.data.account_id.id,
},
});
}
async viewMatch() {
const action = await this.orm.call("account.move.line", "open_reconcile_view", [this.props.record.resId], {});
this.action.doAction(action, { additionalContext: { is_matched_view: true } });
}
get colorCode() {
const matchValue = this.props.record.data[this.props.name];
const matchColorValue = matchValue.replace('P', '');
if (matchColorValue === '*') {
// reserve color code 0 for multi partial matches
return 0;
} else {
// there is 12 available color palette for 'o_tag_color_*'
// since the color code 0 has been reserved by 'P*', we can only use color codes between 1 and 11
return parseInt(matchColorValue) % 11 + 1;
}
}
}
registry.category("fields").add("matching_link_widget", {
component: MatchingLink,
});

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="account_accountant.MatchingLink">
<t t-if="this.props.record.context.is_matched_view">
<span t-out="this.props.record.data[this.props.name]" t-attf-class="o_tag o_badge badge rounded-pill {{'o_tag_color_' + this.colorCode}}"/>
</t>
<t t-elif="this.props.record.data[this.props.name]">
<a href='#' t-on-click.prevent="this.viewMatch" t-attf-class="o_tag o_badge badge rounded-pill {{'o_tag_color_' + this.colorCode}}">
<span t-out="this.props.record.data[this.props.name]"/>
</a>
</t>
</t>
</templates>

View File

@@ -0,0 +1,40 @@
import { AttachmentPreviewListController, AttachmentPreviewListRenderer } from "../attachment_preview_list_view/attachment_preview_list_view";
import { registry } from "@web/core/registry";
import { listView } from "@web/views/list/list_view";
import { makeActiveField } from "@web/model/relational_model/utils";
export class AccountMoveLineListController extends AttachmentPreviewListController {
get previewerStorageKey() {
return "account.move_line_pdf_previewer_hidden";
}
get modelParams() {
const params = super.modelParams;
params.config.activeFields.move_attachment_ids = makeActiveField();
params.config.activeFields.move_attachment_ids.related = {
fields: {
mimetype: { name: "mimetype", type: "char" },
},
activeFields: {
mimetype: makeActiveField(),
},
};
return params;
}
async setSelectedRecord(accountMoveLineData) {
this.attachmentPreviewState.selectedRecord = accountMoveLineData;
await this.setThread(accountMoveLineData, "move_attachment_ids", "move_id");
}
}
export class AccountMoveLineListRenderer extends AttachmentPreviewListRenderer {}
export const AccountMoveLineListView = {
...listView,
Renderer: AccountMoveLineListRenderer,
Controller: AccountMoveLineListController,
};
registry.category("views").add("account_move_line_list", AccountMoveLineListView);

View File

@@ -0,0 +1,46 @@
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import {
AccountMoveLineListController,
AccountMoveLineListRenderer,
AccountMoveLineListView,
} from "../move_line_list/move_line_list";
function useAutoReconcileAction() {
const action = useService("action");
return (group = null) => {
const options = {};
if (group) {
options.additionalContext = {
domain: group.list.domain,
};
}
return action.doAction("account_accountant.action_open_auto_reconcile_wizard", options);
};
}
export class AccountMoveLineReconcileListController extends AccountMoveLineListController {
openAutoReconcileWizard = useAutoReconcileAction();
}
export class AccountMoveLineReconcileListRenderer extends AccountMoveLineListRenderer {
static groupRowTemplate = "account_accountant.AccountMoveLineReconcileGroupRow";
callAutoReconcileAction = useAutoReconcileAction();
setup() {
super.setup();
this.props.list.groups?.map((group) => this.toggleGroup(group)); // unfold the first groups (account_id)
}
}
export const AccountMoveLineReconcileLineListView = {
...AccountMoveLineListView,
Controller: AccountMoveLineReconcileListController,
Renderer: AccountMoveLineReconcileListRenderer,
buttonTemplate: "account_accountant.ListViewReconcile.Buttons",
};
registry
.category("views")
.add("account_move_line_reconcile_list", AccountMoveLineReconcileLineListView);

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="account_accountant.ListViewReconcile.Buttons" t-inherit="web.ListView.Buttons" t-inherit-mode="primary">
<xpath expr="." position="inside">
<button class="btn btn-primary"
t-on-click="() => this.openAutoReconcileWizard()">
Auto-reconcile
</button>
</xpath>
</t>
<t t-name="account_accountant.AccountMoveLineReconcileGroupRow" t-inherit="web.ListRenderer.GroupRow">
<xpath expr="//div[@class='o_group_buttons']" position="before">
<t t-set="grouped_by_account" t-value="group.list.evalContext.default_account_id"/>
<t t-if="group.groupByField.name == 'account_id' or (group.groupByField.name == 'partner_id' and grouped_by_account)">
<button class="btn btn-link"
t-on-click.stop.prevent="() => this.callAutoReconcileAction(group)">
Auto-reconcile
</button>
</t>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,35 @@
<svg width="64" height="64" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="m58.572 41.734-2.105-1.215-26.31 15.139 2.235 1.29c.654.378 1.714.378 2.364 0L58.58 43.103c.651-.378.646-.991-.008-1.37Z" fill="#fff"/>
<path d="M53.442 38.772c-6.626 4.067-12.926 8.668-19.345 13.085L13.867 38.84l-5.22 3.034c-.65.378-.648.991.008 1.37l20.59 11.887.912.527 26.31-15.14-3.025-1.746Z" fill="#C1DBF6"/>
<path d="M34.835 28.03c-.656-.38-1.713-.38-2.364 0L13.868 38.84l20.23 13.017c6.418-4.417 12.718-9.018 19.343-13.085L34.835 28.029Z" fill="#374874"/>
<path d="M33.278 57.215a2.303 2.303 0 0 1-.886-.267L8.655 43.244c-.312-.19-.482-.389-.494-.69l-.003 1.361c-.001.25.163.5.493.69l23.737 13.704c.333.19.725.27 1.107.282v-1.364a2.9 2.9 0 0 1-.217-.012Z" fill="#FBDBD0"/>
<path d="M59.061 42.472c-.025.283-.25.493-.481.631L34.756 56.948c-.38.208-.83.296-1.261.279v1.364c.43.01.879-.071 1.257-.282l23.824-13.844c.082-.05.16-.107.232-.17.142-.134.252-.31.254-.51l.003-1.361c0 .016-.002.032-.004.048Z" fill="#fff"/>
<path d="m28.738 51.75-.003 1.118c.043 1.033.896 1.72 1.942 2.123V53.88c-1.021-.388-1.863-1.06-1.94-2.128Z" fill="#FBDBD0"/>
<path d="M37.56 51.918c.06-.634-.283-1.278-1.032-1.794l.03-10.671-4.725 2.728c-.017.01-.033.016-.05.025v10.19c-.481.43-.903.912-1.2 1.439 0 .197.094 1.156.094 1.156.935.36 2.023.493 2.822.439 1.442-.077 3.375-.562 3.978-2.024.15-.345.09-1.545.086-1.502 0 .005-.003.009-.003.014Z" fill="#fff"/>
<path d="m31.28 42.233.012.01-1.275-.741-.024 8.47c-1.688 1-1.672 2.607.048 3.6.17.098.353.184.542.263a4.51 4.51 0 0 1 .22-.348l.079-.108c.057-.078.116-.155.178-.23a6.48 6.48 0 0 1 .34-.383c.123-.127.25-.251.383-.37v-10.19c-.21.106-.38.105-.502.027Z" fill="#C1DBF6"/>
<path d="M37.802 51.775h-.005c0-.649-.367-1.267-1.04-1.764l.03-10.69-.459.265c-.008 3.352-.02 11.604-.04 11.67-.021.233-.14.439-.29.614-.74.772-1.914.972-2.946.946-.992-.056-2.226-.335-2.738-1.261a.983.983 0 0 1-.096-.447l.027-9.474-.456-.265-.024 8.48c-1.344.836-1.287 1.75-1.259 3.03.21 3.722 9.82 3.958 9.296-.7-.003-.162-.004-.281 0-.404Zm-.536 1.544c-1.214 2.752-8.018 2.421-8.303-.45l.003-1.099h.003c-.006-.493.273-.969.794-1.368l-.002.722v.024c.097 1.54 2.035 2.09 3.358 2.13 1.145.01 2.424-.243 3.229-1.114.217-.25.375-.559.399-.897.011-.008.007-.637.009-.668.412.388.615.831.58 1.279h.007c-.005.41.04 1.154-.077 1.441Z" fill="#374874"/>
<path d="m21.17 36.36-.023 8.13c-.753.484-1.133 1.094-1.132 1.705l-.001-.005-.003 1.118c.05 1.191 1.18 1.924 2.437 2.29 0 0-.663-2.176.085-3.586v-8.86l-1.363-.792Z" fill="#FBDBD0"/>
<path d="M28.85 46.215c0 .043-.008.086-.012.13 0 .008-.003.016-.004.025.024-.689-.36-1.38-1.15-1.887l.012-4.33-5.163-3v8.86c-.748 1.41-.085 3.584-.085 3.584.807.235 1.666.319 2.328.274 1.441-.077 3.373-.562 3.977-2.024.15-.345.08-1.26.096-1.632Z" fill="#C1DBF6"/>
<path d="M29.097 46.28h-.006c0-.65-.367-1.268-1.04-1.765l.012-4.149-.456-.265-.016 5.569a1.106 1.106 0 0 1-.245.64c-1.004 1.083-2.733 1.174-4.095.848-.729-.158-1.779-.784-1.739-1.505l.026-9.079-.456-.265-.023 8.043c-1.378.89-1.272 1.703-1.259 3.03.153 3.674 9.81 4 9.296-.698-.002-.163-.004-.284 0-.405Zm-.537 1.543c-1.14 2.747-8.097 2.394-8.303-.45l.003-1.106h.002c-.003-.49.277-.964.795-1.361l-.002.746c-.015 1.284 1.759 2.029 2.943 2.102.522.052 1.061.03 1.577-.06.76-.147 1.548-.44 2.072-1.032.086-.098.16-.206.224-.322.047-.092.102-.208.125-.314.077-.207.047-.702.054-.923.404.38.609.816.582 1.255h.005c-.007.413.042 1.172-.076 1.465Z" fill="#374874"/>
<path d="m44.648 24.633 14.216.297c.686.048.415 1.405-.37 1.859L31.834 42.18c-.787.455-1.064-.587-.38-1.425l13.194-16.123Z" fill="#fff"/>
<path d="m44.648 24.633 14.216.297c.686.048.415 1.405-.37 1.859L31.834 42.18c-.787.455-1.064-.587-.38-1.425l13.194-16.123Z" fill="#fff"/>
<path d="m44.648 24.633 14.216.297c.686.048.415 1.405-.37 1.859L31.834 42.18c-.787.455-1.064-.587-.38-1.425l13.194-16.123Z" fill="#fff"/>
<path d="m44.648 24.633 14.216.297c.686.048.415 1.405-.37 1.859L31.834 42.18c-.787.455-1.064-.587-.38-1.425l13.194-16.123Z" fill="#fff"/>
<path d="m47.4 40.796-.003 1.118c.042 1.012.865 1.693 1.883 2.1-.202-.412-.345-.834-.348-1.277-.851-.42-1.501-1.06-1.532-1.941Z" fill="#FBDBD0"/>
<path d="m48.552 32.529-.019 6.567c-1.56 1.005-1.506 2.553.172 3.522.073.042.15.08.227.119l.002-.046a2.352 2.352 0 0 1 .24-.962c.055-.11.116-.217.18-.323l.068-.114.008-.012c.068-.107.138-.213.213-.316V31.9l-1.091.63Z" fill="#C1DBF6"/>
<path d="M56.236 40.845v-.025.014c.006-.497-.236-.995-.726-1.426a11.035 11.035 0 0 0-.442-.037l.03-10.622-5.455 3.15v9.065a5.447 5.447 0 0 0-.47.765c-.174.35-.244.684-.241 1.008.003.443.146.865.348 1.276a7.035 7.035 0 0 0 2.882.463c1.442-.077 3.374-.562 3.979-2.024.147-.339.081-1.222.095-1.607Z" fill="#fff"/>
<path d="M56.483 40.709h-.005c0-.65-.368-1.268-1.04-1.765l.03-10.408-.459.264-.028 9.823c-.003.1.008 1.576-.02 1.634a1.214 1.214 0 0 1-.302.569c-.72.727-1.825.931-2.818.927-.722-.02-1.46-.163-2.093-.522-.55-.317-.85-.725-.85-1.148l.022-7.767-.457.264c-.01 3.042-.018 6.202-.018 6.202-1.361.863-1.28 1.726-1.258 3.03.19 3.719 9.84 3.95 9.295-.699-.002-.163-.004-.284 0-.404Zm-.536 1.543c-1.192 2.75-8.043 2.413-8.304-.45l.004-1.105h.001c-.003-.49.277-.965.795-1.362l-.002.747c-.051.898 1.047 1.69 1.969 1.917 1.467.416 3.527.268 4.618-.901.088-.1.164-.21.23-.329.21-.331.179-.858.178-1.237.404.381.609.816.582 1.255h.005c-.007.413.042 1.172-.077 1.465Z" fill="#374874"/>
<path d="M13.156 41.491v-9.788l-1.256-.73-.024 8.447c-.752.484-1.132 1.093-1.132 1.705v-.006l-.003 1.118c.051.848.61 1.458 1.375 1.87a3.01 3.01 0 0 1-.007-.261c0-.028.003-.056.004-.084.003-.058.006-.115.012-.171.003-.033.008-.065.013-.098a2.766 2.766 0 0 1 .046-.251l.016-.074a3.96 3.96 0 0 1 .03-.107c.003-.006.004-.013.006-.02v-.002l.005-.014.017-.052c.025-.074.053-.148.084-.22l.028-.062c.03-.065.06-.128.094-.191a3.507 3.507 0 0 1 .173-.293c.031-.047.065-.093.099-.14l.057-.077c.127-.165.269-.323.423-.473l-.052-.023a.218.218 0 0 1-.008-.003Z" fill="#FBDBD0"/>
<path d="M18.948 39.823c-.179-.01-.358-.015-.537-.017l.014-5.041-5.268-3.062v9.788l.007.003.052.023c-.436.423-.776.912-.958 1.456a2.885 2.885 0 0 0-.141 1.133c1.15.62 2.767.794 3.844.66 1.409-.152 3.516-.839 3.616-2.505l.003-1.118c0 .018-.004.035-.005.052.016-.474-.192-.951-.627-1.372Z" fill="#C1DBF6"/>
<path d="m19.806 41.169.002-.028h-.004c.023-.727-.542-1.473-1.207-1.883l.012-4.386-.456-.265-.015 5.425c-.007.055-.01.135-.023.187l-.015.053a.571.571 0 0 1-.048.134c-.012.027-.023.054-.036.077l-.015.03-.108.16-.055.064-.02.022c-.032.036-.066.07-.1.102l-.02.018c-.083.069-.167.14-.26.197a2.433 2.433 0 0 1-.424.234c-.134.06-.278.112-.418.16a4.876 4.876 0 0 1-.926.188c-.22.021-.453.03-.673.028a5.42 5.42 0 0 1-.999-.117 4.124 4.124 0 0 1-.626-.185l-.024-.009c-.061-.025-.155-.068-.217-.094-.579-.253-1.103-.788-1.072-1.265l.003-.995.022-7.94-.456-.266-.025 8.517c-.698.497-1.085 1.126-1.087 1.785l-.005 1.128c.182 3.318 7.791 3.865 9.181.62.12-.274.123-.74.115-1.318-.002-.148-.004-.28 0-.378Zm-.535 1.517c-1.14 2.747-8.097 2.394-8.303-.45l.004-1.11c0-.426.22-.847.63-1.214-.08.826.705 1.566 1.574 1.886l.024.01c.107.041.225.08.368.124l.031.01c.028.008.06.015.089.022.077.02.174.043.268.066l.056.01a5.978 5.978 0 0 0 .863.099c.028.001.058.004.087.004.207.001.425-.001.632-.02l.033-.002.059-.004.03-.004a5.298 5.298 0 0 0 1.025-.21l.03-.009c.016-.005.03-.01.06-.023a3.63 3.63 0 0 0 .806-.378c.128-.08.252-.175.364-.273l.024-.02a2.2 2.2 0 0 0 .13-.132c.042-.049.09-.096.123-.15a2.079 2.079 0 0 0 .14-.216c.02-.037.036-.075.062-.132a.574.574 0 0 0 .026-.058l.007-.023c.012-.034.02-.067.03-.101l.008-.031a.92.92 0 0 0 .034-.196l.003-.028a.588.588 0 0 0 .006-.066l.001-.25c.449.344.784.886.751 1.37h.003c-.01.415.044 1.198-.078 1.499Z" fill="#374874"/>
<path d="m38.215 46.19-.003 1.118c.058.956.76 1.608 1.676 2.017a3.95 3.95 0 0 1-.134-1.189c-.802-.378-1.498-1.054-1.539-1.946Z" fill="#FBDBD0"/>
<path d="m39.367 37.832-.019 6.659c-1.7 1.05-1.386 2.801.406 3.644.029-.5.186-.98.505-1.377.187-.25.397-.473.624-.672v-9.13l-1.516.876Z" fill="#C1DBF6"/>
<path d="M46.942 45.656c-.163-.427-.515-.834-1.058-1.177l.03-10.427-5.031 2.904v9.13c-.227.2-.437.423-.624.672a2.351 2.351 0 0 0-.506 1.39c-.019.382.033.779.136 1.177 1.118.5 2.558.635 3.544.512 1.408-.151 3.514-.838 3.614-2.504 0 0 0-.569-.004-.933-.002-.155-.053-.617-.101-.744Z" fill="#fff"/>
<path d="M47.208 46.07c-.07-.572-.428-1.112-1.028-1.555l.03-10.635-.457.265c-.01 3.375-.032 11.35-.035 11.56-.009.154-.058.31-.135.445-.574.881-1.8 1.141-2.792 1.173-.79.011-1.607-.131-2.3-.521-.55-.317-.851-.725-.85-1.149l.023-7.993-.458.265-.018 6.427c-1.35.847-1.286 1.742-1.259 3.03.21 3.696 9.68 3.956 9.306-.598-.003-.033-.019-.644-.027-.713Zm-.519 1.753c-1.213 2.752-8.018 2.42-8.303-.45l.003-1.106h.002c-.003-.49.277-.964.795-1.362l-.002.747c.107 1.876 2.984 2.35 4.52 2.042.876-.172 1.834-.54 2.295-1.353.027-.051.055-.11.08-.17.02-.05.067-.216.074-.257.04-.237.02-.625.026-.811.3.282.49.595.557.917.023.112.03.338.03.338-.007.413.042 1.171-.077 1.465Z" fill="#374874"/>
<path d="M31.562 50.324a.229.229 0 0 1-.228-.228v-7.503a.229.229 0 0 1 .457 0v7.503a.229.229 0 0 1-.229.228ZM33.51 50.682a.229.229 0 0 1-.228-.229v-8.875a.229.229 0 0 1 .457 0v8.875a.229.229 0 0 1-.228.229ZM35.46 50.125a.229.229 0 0 1-.23-.229v-9.56a.229.229 0 1 1 .458 0v9.56a.229.229 0 0 1-.229.229ZM40.883 44.686a.228.228 0 0 1-.229-.228v-7.046a.228.228 0 1 1 .457 0v7.046a.228.228 0 0 1-.228.228ZM42.831 45.044a.228.228 0 0 1-.228-.229v-8.417a.228.228 0 1 1 .457 0v8.417a.228.228 0 0 1-.229.229ZM44.78 44.487a.228.228 0 0 1-.229-.229v-9.103a.228.228 0 1 1 .457 0v9.103a.228.228 0 0 1-.228.229ZM49.887 39.335a.229.229 0 0 1-.229-.229V32.06a.229.229 0 0 1 .458 0v7.046a.229.229 0 0 1-.229.229ZM51.836 39.692a.229.229 0 0 1-.229-.228v-8.418a.228.228 0 1 1 .457 0v8.418a.229.229 0 0 1-.228.228ZM53.784 39.135a.229.229 0 0 1-.229-.228v-9.104a.229.229 0 0 1 .458 0v9.104a.229.229 0 0 1-.229.228Z" fill="#C1DBF6"/>
<path d="m44.648 24.633 14.216.297c.686.048.415 1.405-.37 1.859L31.834 42.18c-.787.455-1.064-.587-.38-1.425l13.194-16.123Z" fill="#fff"/>
<path d="M36.335 37.94a.379.379 0 0 1-.289-.136.377.377 0 0 1-.004-.49l9.127-11.153a.385.385 0 0 1 .303-.14l9.834.207c.174.003.32.119.362.287a.378.378 0 0 1-.179.425L36.528 37.887a.384.384 0 0 1-.193.053ZM45.5 26.48l-8.843 10.805 18.37-10.606-9.527-.2Z" fill="#C1DBF6"/>
<path d="m31.117 42.025-.007-.018a.726.726 0 0 1-.038-.172 1.01 1.01 0 0 1-.003-.169c0-.01 0-.02.002-.029.005-.06.015-.124.03-.189l.005-.017c.017-.07.04-.14.07-.212l.003-.009a1.75 1.75 0 0 1 .113-.223l.004-.007c.046-.076.098-.15.157-.224l13.195-16.123-25.775-14.98L5.678 25.777a1.832 1.832 0 0 0-.13.18l-.027.044-.005.007-.009.015a1.874 1.874 0 0 0-.096.189l-.007.019a1.007 1.007 0 0 0-.004.008l-.015.037a1.628 1.628 0 0 0-.046.14l-.009.035-.004.018-.009.036a1.31 1.31 0 0 0-.018.109l-.004.044a1.022 1.022 0 0 0 .001.198l.004.025a.725.725 0 0 0 .034.147l.008.018a.5.5 0 0 0 .066.12l.008.01c.03.035.062.065.1.088l25.776 14.979a.374.374 0 0 1-.1-.089l-.008-.008a.503.503 0 0 1-.067-.121Z" fill="#FBDBD0"/>
<path d="M58.962 24.948a.37.37 0 0 1 .08.035l-25.775-14.98a.368.368 0 0 0-.08-.035h-.003a.415.415 0 0 0-.095-.017l-14.216-.298 25.775 14.98 14.216.297a.457.457 0 0 1 .096.017h.002Z" fill="#C1DBF6"/>
<path d="M59.976 42.498c.032-.614-.319-1.193-.947-1.556l-2.148-1.24a3.178 3.178 0 0 0-.896-1.088l.026-9.336 2.94-1.698c.856-.493 1.259-1.495 1.215-2.228-.03-.51-.275-.931-.665-1.158l.001-.002-25.775-14.98-.007-.003-.01-.006a1.323 1.323 0 0 0-.22-.097l-.02-.008-.034-.009a1.333 1.333 0 0 0-.282-.05l-.023-.001h-.023l-14.216-.299-.445-.01-.282.345L4.97 25.198a2.803 2.803 0 0 0-.228.324l-.004.007-.003.005-.006.008-.014.024a2.516 2.516 0 0 0-.143.283l-.014.034-.004.01a2.224 2.224 0 0 0-.111.338l-.006.024-.015.06a2.24 2.24 0 0 0-.042.317 1.923 1.923 0 0 0 .013.37c.017.121.044.233.082.337l.01.027.012.029c.05.122.113.233.188.33l.03.04.019.019c.093.108.202.2.324.27l5.926 3.444-.021 7.458a3.31 3.31 0 0 0-.836 1l-1.94 1.127c-.595.347-.938.882-.94 1.468l-.004 1.362c-.001.593.345 1.134.951 1.484L31.931 59.1a3.319 3.319 0 0 0 1.632.405c.6 0 1.165-.137 1.633-.398l.008-.004.008-.004 23.823-13.845c.136-.08.259-.17.374-.27l.014-.012.013-.013c.344-.325.536-.74.54-1.167V42.498Zm-54.68-15.84c0-.015 0-.03.003-.044.004-.036.01-.072.018-.109l.009-.036.004-.018c.003-.011.005-.023.009-.034a1.515 1.515 0 0 1 .046-.142l.015-.036.004-.008.007-.02a1.755 1.755 0 0 1 .096-.188l.01-.015.004-.007.026-.044a1.867 1.867 0 0 1 .131-.18L18.873 9.653l14.216.298a.49.49 0 0 1 .095.017h.003a.417.417 0 0 1 .077.033l.004.002 25.775 14.98c-.013-.008-.027-.012-.041-.018.502.215.218 1.405-.508 1.824l-.796.46-2.6 1.5-22.984 13.27c-.154.09-.33.144-.508.158a1.189 1.189 0 0 1-.701-.16L11.9 30.973l-6.383-3.71a.375.375 0 0 1-.101-.088l-.008-.008a.5.5 0 0 1-.066-.121l-.008-.018a.721.721 0 0 1-.034-.147l-.004-.025a1.007 1.007 0 0 1-.003-.169l.002-.03Zm53.766 17.127c-.002.2-.111.376-.254.51-.072.063-.15.12-.232.17L34.752 58.309c-.358.2-.78.283-1.19.283h-.067c-.382-.012-.774-.094-1.107-.283L8.65 44.605c-.33-.19-.494-.44-.493-.69l.003-1.36c0-.246.162-.493.486-.68L10.84 40.6c.154-.428.5-.836 1.036-1.18l.022-7.92 18.777 10.913a1.652 1.652 0 0 0 .967.22c.246-.02.488-.095.7-.218l22.755-13.137-.028 9.808c.162.102.313.209.44.322.327.287.54.604.647.93l2.416 1.396c.35.202.512.471.49.736v1.315Z" fill="#374874"/>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,11 @@
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.94407 33.263L29.0786 18.7516L60.7935 37.0603C61.2698 37.3352 61.2698 38.0227 60.7935 38.2977L36.0006 52.6136C35.7748 52.744 35.4965 52.744 35.2707 52.6136L3.94407 34.5272C3.45749 34.2462 3.45749 33.5439 3.94407 33.263Z" fill="#FBDBD0"/>
<path d="M2.84927 26.3213L28.7214 11.384C28.9424 11.2564 29.2147 11.2564 29.4358 11.384L60.7935 29.4865C61.2698 29.7615 61.2698 30.449 60.7935 30.724L35.6357 45.2506L2.84927 26.3213Z" fill="white"/>
<path d="M39.625 42.9972L6.83844 24.0698L2.85549 26.3178L2.84927 26.3142V26.3213L2.85071 32.6539C2.8509 33.4227 3.26109 34.133 3.92687 34.5174L35.2868 52.6228C35.4427 52.7128 35.6376 52.6003 35.6376 52.4203L35.6362 46.7666C35.6359 45.8299 36.1402 44.9656 36.9559 44.5049L39.625 42.9972Z" fill="#FBDBD0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.37803 23.5401L39.7393 42.7993L39.5108 43.1952L6.14948 23.936L6.37803 23.5401Z" fill="#374874"/>
<path d="M36.7775 44.5878L58.3233 32.1215V37.3054L35.6357 50.4384L35.6357 46.5675C35.6357 45.7511 36.0709 44.9967 36.7775 44.5878Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M58.5519 37.305C58.552 37.3867 58.5086 37.4623 58.4378 37.5032L35.7502 50.6362C35.6409 50.6995 35.5011 50.6622 35.4378 50.5529C35.3746 50.4437 35.4119 50.3038 35.5211 50.2406L58.0945 37.1737L58.0861 32.8415L39.7373 43.1962C39.6274 43.2583 39.488 43.2194 39.4259 43.1095C39.3639 42.9996 39.4027 42.8601 39.5127 42.7981L58.5425 32.025C58.5425 33.9428 58.5485 35.5664 58.5519 37.305Z" fill="#374874"/>
<path d="M20.3568 26.0742L33.1396 18.6862L38.9735 22.0638L26.1905 29.4534L20.3568 26.0742Z" fill="#C1DBF6"/>
<path d="M29.0786 11.2883C29.2019 11.2883 29.3253 11.3202 29.4358 11.384L60.7935 29.4865C61.2697 29.7614 61.2698 30.4489 60.7935 30.7239L58.3233 32.1503V35.6344L60.7935 37.0603C61.2697 37.3353 61.2698 38.0227 60.7935 38.2977L36.4643 52.346L36.3866 52.391C36.3862 52.3912 36.3857 52.3913 36.3853 52.3915L36.3774 52.3961L36.0037 52.6129C35.8902 52.6788 35.7634 52.7118 35.6366 52.7118C35.5104 52.7118 35.3841 52.6791 35.271 52.6138C35.2709 52.6137 35.2708 52.6137 35.2707 52.6137L18.8129 43.1118L3.92685 34.5173C3.26106 34.133 2.85087 33.4226 2.85071 32.6539L2.84957 27.651C2.84938 26.8238 3.29069 26.0595 4.00712 25.646L28.7214 11.384C28.8319 11.3202 28.9552 11.2883 29.0786 11.2883ZM29.0786 10.374C28.7932 10.374 28.5116 10.4494 28.2644 10.5921L3.55016 24.8541C2.55382 25.4291 1.93503 26.5009 1.9353 27.6512L1.93645 32.6541C1.9367 33.7459 2.52422 34.7633 3.46973 35.3091L18.3558 43.9036L34.8136 53.4055C34.8151 53.4063 34.8166 53.4072 34.8181 53.408C35.0669 53.5506 35.3498 53.626 35.6366 53.626C35.9264 53.626 36.212 53.5492 36.4626 53.4037L36.8297 53.1907C36.8311 53.1899 36.8325 53.1892 36.8339 53.1884C36.8375 53.1863 36.8412 53.1842 36.8448 53.1822L36.9225 53.1371L61.2507 39.0895C61.7606 38.795 62.065 38.2677 62.065 37.6789C62.065 37.0901 61.7605 36.5629 61.2506 36.2685L59.2376 35.1064V32.6781L61.2507 31.5156C61.7606 31.2212 62.0651 30.6939 62.065 30.105C62.0649 29.5162 61.7604 28.9889 61.2505 28.6946L29.8929 10.5922C29.6457 10.4495 29.3641 10.374 29.0786 10.374Z" fill="#374874"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M39.824 42.8848C39.8861 42.9947 39.8474 43.1342 39.7374 43.1962L37.0683 44.7039L36.9559 44.5049L37.0683 44.7039C36.3244 45.1241 35.8645 45.9123 35.8647 46.7666L35.8658 51.5558C35.8659 52.022 36.3606 52.3215 36.7736 52.1061L39.8627 50.4121C39.9734 50.3514 40.1123 50.392 40.173 50.5027C40.2337 50.6133 40.1932 50.7523 40.0825 50.813L36.9915 52.508L36.9879 52.5099C36.2702 52.8869 35.4088 52.3666 35.4087 51.5559L35.4076 46.7667C35.4073 45.7475 35.956 44.8071 36.8434 44.3059L39.5126 42.7982C39.6225 42.7361 39.762 42.7749 39.824 42.8848Z" fill="#374874"/>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg3409" inkscape:version="0.91 r13725" sodipodi:docname="MasterCard 2016.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="999.2px" height="776px"
viewBox="0 0 999.2 776" enable-background="new 0 0 999.2 776" xml:space="preserve">
<path id="XMLID_1775_" inkscape:connector-curvature="0" d="M181.1,774.3v-51.5c0-19.7-12-32.6-32.6-32.6
c-10.3,0-21.5,3.4-29.2,14.6c-6-9.4-14.6-14.6-27.5-14.6c-8.6,0-17.2,2.6-24,12v-10.3h-18v82.4h18v-45.5c0-14.6,7.7-21.5,19.7-21.5
s18,7.7,18,21.5v45.5h18v-45.5c0-14.6,8.6-21.5,19.7-21.5c12,0,18,7.7,18,21.5v45.5H181.1z M448.1,691.9h-29.2V667h-18v24.9h-16.3
v16.3h16.3v37.8c0,18.9,7.7,30,28.3,30c7.7,0,16.3-2.6,22.3-6l-5.2-15.5c-5.2,3.4-11.2,4.3-15.5,4.3c-8.6,0-12-5.2-12-13.7v-36.9
h29.2V691.9z M600.9,690.1c-10.3,0-17.2,5.2-21.5,12v-10.3h-18v82.4h18v-46.4c0-13.7,6-21.5,17.2-21.5c3.4,0,7.7,0.9,11.2,1.7
l5.2-17.2C609.4,690.1,604.3,690.1,600.9,690.1L600.9,690.1z M370,698.7c-8.6-6-20.6-8.6-33.5-8.6c-20.6,0-34.3,10.3-34.3,26.6
c0,13.7,10.3,21.5,28.3,24l8.6,0.9c9.4,1.7,14.6,4.3,14.6,8.6c0,6-6.9,10.3-18.9,10.3c-12,0-21.5-4.3-27.5-8.6l-8.6,13.7
c9.4,6.9,22.3,10.3,35.2,10.3c24,0,37.8-11.2,37.8-26.6c0-14.6-11.2-22.3-28.3-24.9l-8.6-0.9c-7.7-0.9-13.7-2.6-13.7-7.7
c0-6,6-9.4,15.5-9.4c10.3,0,20.6,4.3,25.8,6.9L370,698.7L370,698.7z M848.9,690.1c-10.3,0-17.2,5.2-21.5,12v-10.3h-18v82.4h18v-46.4
c0-13.7,6-21.5,17.2-21.5c3.4,0,7.7,0.9,11.2,1.7L861,691C857.5,690.1,852.4,690.1,848.9,690.1L848.9,690.1z M618.9,733.1
c0,24.9,17.2,42.9,43.8,42.9c12,0,20.6-2.6,29.2-9.4l-8.6-14.6c-6.9,5.2-13.7,7.7-21.5,7.7c-14.6,0-24.9-10.3-24.9-26.6
c0-15.5,10.3-25.8,24.9-26.6c7.7,0,14.6,2.6,21.5,7.7l8.6-14.6c-8.6-6.9-17.2-9.4-29.2-9.4C636.1,690.1,618.9,708.2,618.9,733.1
L618.9,733.1L618.9,733.1z M785.4,733.1v-41.2h-18v10.3c-6-7.7-14.6-12-25.8-12c-23.2,0-41.2,18-41.2,42.9c0,24.9,18,42.9,41.2,42.9
c12,0,20.6-4.3,25.8-12v10.3h18V733.1L785.4,733.1z M719.3,733.1c0-14.6,9.4-26.6,24.9-26.6c14.6,0,24.9,11.2,24.9,26.6
c0,14.6-10.3,26.6-24.9,26.6C728.8,758.8,719.3,747.6,719.3,733.1L719.3,733.1z M503.9,690.1c-24,0-41.2,17.2-41.2,42.9
c0,25.8,17.2,42.9,42.1,42.9c12,0,24-3.4,33.5-11.2l-8.6-12.9c-6.9,5.2-15.5,8.6-24,8.6c-11.2,0-22.3-5.2-24.9-19.7h60.9
c0-2.6,0-4.3,0-6.9C542.5,707.3,527,690.1,503.9,690.1L503.9,690.1L503.9,690.1z M503.9,705.6c11.2,0,18.9,6.9,20.6,19.7h-42.9
C483.3,714.2,491,705.6,503.9,705.6L503.9,705.6z M951.1,733.1v-73.8h-18v42.9c-6-7.7-14.6-12-25.8-12c-23.2,0-41.2,18-41.2,42.9
c0,24.9,18,42.9,41.2,42.9c12,0,20.6-4.3,25.8-12v10.3h18V733.1L951.1,733.1z M885,733.1c0-14.6,9.4-26.6,24.9-26.6
c14.6,0,24.9,11.2,24.9,26.6c0,14.6-10.3,26.6-24.9,26.6C894.4,758.8,885,747.6,885,733.1L885,733.1z M282.4,733.1v-41.2h-18v10.3
c-6-7.7-14.6-12-25.8-12c-23.2,0-41.2,18-41.2,42.9c0,24.9,18,42.9,41.2,42.9c12,0,20.6-4.3,25.8-12v10.3h18V733.1L282.4,733.1z
M215.5,733.1c0-14.6,9.4-26.6,24.9-26.6c14.6,0,24.9,11.2,24.9,26.6c0,14.6-10.3,26.6-24.9,26.6
C224.9,758.8,215.5,747.6,215.5,733.1z"/>
<g>
<rect id="rect19" x="364" y="66.1" fill="#FF5A00" width="270.4" height="485.8"/>
<path id="XMLID_330_" inkscape:connector-curvature="0" fill="#EB001B" d="M382,309c0-98.7,46.4-186.3,117.6-242.9
C447.2,24.9,381.1,0,309,0C138.2,0,0,138.2,0,309s138.2,309,309,309c72.1,0,138.2-24.9,190.6-66.1C428.3,496.1,382,407.7,382,309z"
/>
<path id="path22" inkscape:connector-curvature="0" fill="#F79E1B" d="M999.2,309c0,170.8-138.2,309-309,309
c-72.1,0-138.2-24.9-190.6-66.1c72.1-56.7,117.6-144.2,117.6-242.9S570.8,122.7,499.6,66.1C551.9,24.9,618,0,690.1,0
C861,0,999.2,139.1,999.2,309z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="259.25" height="84" viewBox="0 0 259.25 84" fill="#1434cb"><path d="M551.23,470c-18.41,0-34.86,9.54-34.86,27.17,0,20.22,29.17,21.61,29.17,31.77,0,4.28-4.9,8.1-13.27,8.1a44.07,44.07,0,0,1-20.76-5.35l-3.8,17.79A64.79,64.79,0,0,0,531.53,554c20.13,0,36-10,36-27.94,0-21.36-29.3-22.72-29.3-32.14,0-3.35,4-7,12.37-7a42,42,0,0,1,17.1,3.89l3.72-17.18A55.64,55.64,0,0,0,551.23,470Zm-168.41,1.3-.45,2.59a86.57,86.57,0,0,1,14.72,4.24c9,3.24,9.62,5.13,11.13,11l16.48,63.54H446.8l34-81.37h-22l-21.87,55.32L428,479.73c-.82-5.37-5-8.43-10-8.43Zm106.88,0-17.29,81.37h21l17.23-81.37h-21Zm117.24,0c-5.07,0-7.75,2.71-9.72,7.46l-30.8,73.91h22l4.26-12.32h26.85l2.59,12.32h19.45l-17-81.37H606.94Zm2.87,22,6.53,30.53h-17.5l11-30.53Z" transform="translate(-382.37 -470)"/></svg>

After

Width:  |  Height:  |  Size: 802 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -0,0 +1,28 @@
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.2327 23.0633C11.5288 23.0633 11.7688 23.3034 11.7688 23.5994V62.7245C11.7688 63.0206 11.5288 63.2606 11.2327 63.2606C10.9366 63.2606 10.6966 63.0206 10.6966 62.7245V23.5994C10.6966 23.3034 10.9366 23.0633 11.2327 23.0633Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.7089 19.3921C18.0049 19.3921 18.245 19.6321 18.245 19.9282V59.0361C18.245 59.3322 18.0049 59.5722 17.7089 59.5722C17.4128 59.5722 17.1728 59.3322 17.1728 59.0361V19.9282C17.1728 19.6321 17.4128 19.3921 17.7089 19.3921Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.7733 15.9867C24.0694 15.9867 24.3094 16.2267 24.3094 16.5228V55.5836C24.3094 55.8797 24.0694 56.1197 23.7733 56.1197C23.4772 56.1197 23.2372 55.8797 23.2372 55.5836V16.5228C23.2372 16.2267 23.4772 15.9867 23.7733 15.9867Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.8356 12.5642C30.1317 12.5642 30.3717 12.8043 30.3717 13.1003V52.0174C30.3717 52.3135 30.1317 52.5535 29.8356 52.5535C29.5395 52.5535 29.2995 52.3135 29.2995 52.0174V13.1003C29.2995 12.8043 29.5395 12.5642 29.8356 12.5642Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.7885 9.20606C36.0846 9.20606 36.3246 9.44608 36.3246 9.74216V48.7386C36.3246 49.0347 36.0846 49.2747 35.7885 49.2747C35.4925 49.2747 35.2524 49.0347 35.2524 48.7386V9.74216C35.2524 9.44608 35.4925 9.20606 35.7885 9.20606Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.9623 5.72135C42.2584 5.72135 42.4984 5.96137 42.4984 6.25745V45.2239C42.4984 45.5199 42.2584 45.76 41.9623 45.76C41.6663 45.76 41.4262 45.5199 41.4262 45.2239V6.25745C41.4262 5.96137 41.6663 5.72135 41.9623 5.72135Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.0268 2.51758C48.3229 2.51758 48.5629 2.7576 48.5629 3.05368V41.8014C48.5629 42.0974 48.3229 42.3375 48.0268 42.3375C47.7307 42.3375 47.4907 42.0974 47.4907 41.8014V3.05368C47.4907 2.7576 47.7307 2.51758 48.0268 2.51758Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.8987 5.56324C51.0452 5.82052 50.9554 6.14787 50.6982 6.2944L11.7253 28.4914C11.468 28.6379 11.1407 28.5481 10.9941 28.2909C10.8476 28.0336 10.9374 27.7062 11.1947 27.5597L50.1675 5.36272C50.4248 5.21618 50.7521 5.30596 50.8987 5.56324Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.8987 12.4791C51.0452 12.7363 50.9554 13.0637 50.6981 13.2102L11.498 35.5337C11.2407 35.6802 10.9134 35.5904 10.7668 35.3331C10.6203 35.0759 10.7101 34.7485 10.9674 34.602L50.1675 12.2785C50.4248 12.132 50.7522 12.2218 50.8987 12.4791Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.8987 19.3927C51.0452 19.65 50.9554 19.9773 50.6981 20.1238L11.498 42.4474C11.2407 42.5939 10.9134 42.5041 10.7668 42.2468C10.6203 41.9895 10.7101 41.6622 10.9674 41.5156L50.1675 19.1921C50.4248 19.0456 50.7522 19.1354 50.8987 19.3927Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.8987 26.3063C51.0452 26.5636 50.9554 26.891 50.6981 27.0375L11.5495 49.3331C11.2922 49.4796 10.9648 49.3899 10.8183 49.1326C10.6718 48.8753 10.7616 48.5479 11.0188 48.4014L50.1675 26.1058C50.4248 25.9592 50.7522 26.049 50.8987 26.3063Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.8987 33.22C51.0452 33.4772 50.9554 33.8046 50.6981 33.9511L11.498 56.2768C11.2407 56.4233 10.9134 56.3335 10.7668 56.0762C10.6203 55.8189 10.7101 55.4916 10.9674 55.3451L50.1675 33.0194C50.4248 32.8729 50.7522 32.9627 50.8987 33.22Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.8987 40.1336C51.0452 40.3909 50.9554 40.7182 50.6981 40.8647L11.498 63.1904C11.2407 63.3369 10.9134 63.2471 10.7668 62.9899C10.6203 62.7326 10.7101 62.4052 10.9674 62.2587L50.1675 39.933C50.4248 39.7865 50.7522 39.8763 50.8987 40.1336Z" fill="#ECECEC"/>
<path d="M20.3597 51.6602C20.1992 51.6602 20.0376 51.6477 19.8791 51.6234C19.3887 51.5522 18.9294 51.3707 18.518 51.0846L14.6184 48.4571C13.9716 48.0109 13.9242 47.0067 14.4959 45.9556C14.9041 45.2045 15.7126 44.6594 16.4182 44.6594C16.6278 44.6594 16.8162 44.7065 16.9783 44.7998C17.0191 44.823 17.0593 44.852 17.097 44.8853L20.0037 47.0991C20.0084 47.1027 20.0129 47.1056 20.0178 47.1078C20.0245 47.1093 20.0309 47.1109 20.0374 47.1125C20.0486 47.1136 20.0566 47.114 20.0628 47.114C20.0716 47.114 20.0765 47.1131 20.0816 47.1118L20.1048 47.1024C20.1097 47.0982 20.1193 47.0904 20.1244 47.0864C20.1251 47.0848 20.1367 47.064 20.1374 47.0625L28.2432 30.4797C28.7633 29.3772 29.8932 28.6611 31.1189 28.6611C31.5896 28.6611 32.0457 28.7636 32.4742 28.9658C32.6584 29.0526 32.8349 29.1578 32.999 29.2781L40.3845 34.3216C40.3994 34.3323 40.4088 34.3374 40.4175 34.3406L40.4311 34.3428C40.4396 34.3428 40.4483 34.3437 40.4573 34.3448C40.4749 34.3426 40.4997 34.335 40.518 34.3098L42.914 30.5183L51.0512 17.6254C49.6702 16.3145 49.1559 14.8975 49.7419 13.9486C49.8162 13.8283 49.9104 13.7178 50.0291 13.6125C50.0439 13.5971 50.0597 13.5826 50.0769 13.5692C50.0845 13.5631 50.0936 13.5564 50.1028 13.5502C50.1805 13.4877 50.2637 13.4317 50.3506 13.3837L58.168 8.12967C58.2448 8.07811 58.3338 8.052 58.4229 8.052C58.501 8.052 58.5794 8.07209 58.6497 8.11228C58.8006 8.19845 58.8896 8.36295 58.8791 8.53639C58.8791 8.53639 58.2912 18.4089 58.2908 18.4141C58.2878 18.4458 58.2818 18.4766 58.2729 18.506C58.239 18.7205 58.1686 18.915 58.0633 19.0859C57.7211 19.6399 57.043 19.9453 56.1539 19.9453C55.6354 19.9453 55.0497 19.8431 54.4421 19.6482L43.3352 37.5795C42.8251 38.404 41.9785 38.9444 41.0126 39.0618C41.0064 39.0625 40.9961 39.0636 40.9896 39.0643C40.8939 39.0754 40.8131 39.0815 40.7318 39.0844C40.7267 39.0846 40.5749 39.0846 40.5749 39.0846C40.5298 39.0846 40.4847 39.0837 40.4396 39.0808C40.343 39.0755 40.2434 39.0647 40.1443 39.0498C40.1403 39.0493 40.1361 39.0487 40.1321 39.0478C39.6568 38.9741 39.2151 38.7987 38.8189 38.5259L31.5267 33.4728C31.5171 33.4665 31.5006 33.4618 31.4818 33.4618C31.4812 33.4618 31.4747 33.4621 31.4687 33.4625C31.46 33.4645 31.4497 33.467 31.4497 33.467C31.4379 33.4721 31.4251 33.4821 31.4151 33.4969L23.228 49.8565C22.707 50.9491 21.5798 51.6602 20.3597 51.6602Z" fill="white"/>
<path d="M58.4229 8.50913H58.424ZM58.4229 8.50913L57.8359 18.3639C57.8366 18.3445 57.8349 18.3247 57.8357 18.3052C57.8226 18.5021 57.7732 18.6854 57.6742 18.8458C57.407 19.2785 56.8574 19.4881 56.154 19.4881C55.5939 19.4881 54.9363 19.3552 54.2462 19.096L42.9466 37.3388C42.4937 38.0708 41.7502 38.5117 40.9574 38.6081C40.9547 38.6085 40.9519 38.6085 40.9492 38.6088C40.8718 38.618 40.7942 38.6249 40.7161 38.6274C40.7118 38.6275 40.7075 38.6276 40.7032 38.6276C40.6878 38.6276 40.6724 38.6268 40.657 38.6268C40.6553 38.6268 40.6536 38.6268 40.652 38.6268C40.6263 38.6271 40.6007 38.6274 40.5751 38.6274C40.5393 38.6274 40.5035 38.6268 40.4677 38.6247C40.3822 38.6199 40.2969 38.6105 40.2119 38.5977C40.2117 38.5976 40.2115 38.5976 40.2112 38.5976C39.8153 38.5375 39.4275 38.3899 39.0781 38.1494L31.787 33.0972C31.6937 33.0341 31.5873 33.0045 31.4814 33.0045C31.4679 33.0045 31.4545 33.005 31.4411 33.006C31.4283 33.0071 31.4155 33.0073 31.4028 33.0093C31.3902 33.0111 31.3779 33.0144 31.3654 33.0171C31.34 33.0229 31.3147 33.0292 31.2903 33.0386C31.2883 33.0394 31.2862 33.0403 31.2842 33.0411C31.1879 33.0797 31.1014 33.1459 31.0382 33.2379C31.0221 33.2613 31.0079 33.286 30.9957 33.3116L22.819 49.6522C22.3521 50.6314 21.3765 51.2031 20.3594 51.2031C20.2228 51.2031 20.0854 51.1927 19.9484 51.1717C19.5394 51.1123 19.1386 50.9597 18.7789 50.7094L14.8739 48.0782C14.445 47.7822 14.445 47.0059 14.8974 46.1739C15.2578 45.5112 15.9283 45.1165 16.4182 45.1166C16.5434 45.1166 16.6568 45.1424 16.7502 45.1961C16.7691 45.2069 16.7869 45.2207 16.8037 45.2367L19.7267 47.4627C19.7881 47.5099 19.8565 47.5412 19.9271 47.5586C19.9256 47.5576 19.9233 47.5559 19.9219 47.5549C19.967 47.5667 20.0123 47.5722 20.0571 47.5722C20.1025 47.5722 20.1474 47.5665 20.1907 47.5558C20.196 47.5545 20.2015 47.5536 20.2068 47.5521C20.2271 47.5464 20.2465 47.5385 20.266 47.5306C20.279 47.5252 20.292 47.5199 20.3046 47.5134C20.318 47.5067 20.3308 47.499 20.3435 47.4912C20.3633 47.4789 20.3827 47.4657 20.401 47.4506C20.4065 47.4462 20.412 47.4418 20.4173 47.4372C20.4424 47.4148 20.4662 47.3904 20.4874 47.3627C20.5111 47.3319 20.5315 47.2985 20.548 47.2633L28.6539 30.6804C29.1186 29.6955 30.0975 29.1183 31.1189 29.1183C31.5081 29.1184 31.9037 29.2022 32.279 29.3793C32.4371 29.4539 32.5875 29.5434 32.7284 29.6468L40.1267 34.6991C40.186 34.7423 40.2513 34.7712 40.3184 34.7875C40.3281 34.79 40.3378 34.7904 40.3475 34.7924C40.3736 34.7972 40.3998 34.8017 40.426 34.8027C40.4264 34.8027 40.4267 34.8028 40.4271 34.8028C40.4285 34.8028 40.4299 34.8027 40.4313 34.8027C40.4316 34.8027 40.432 34.8027 40.4323 34.8027C40.4371 34.8028 40.4418 34.8028 40.4466 34.8028C40.615 34.8028 40.781 34.7255 40.8875 34.5789C40.8937 34.5705 40.8995 34.562 40.9051 34.5532L43.3004 30.7626L51.643 17.5445C50.2863 16.3724 49.6256 15.0073 50.1308 14.1888C50.1948 14.0852 50.2789 13.9977 50.3735 13.9194C50.3705 13.9216 50.3672 13.9234 50.3641 13.9253L50.3755 13.9176C50.4402 13.8644 50.5106 13.8164 50.588 13.7748L58.4229 8.50913ZM50.3641 13.9253L50.3599 13.9281C50.3612 13.9271 50.3626 13.9262 50.3641 13.9253ZM57.8359 18.3639C57.8358 18.3671 57.8356 18.3703 57.8354 18.3735L57.8359 18.3639ZM58.4241 7.59485H58.4229C58.2297 7.59485 58.0504 7.65478 57.9028 7.75713L50.1105 12.9941C50.0128 13.0496 49.9187 13.113 49.8299 13.1831C49.824 13.1873 49.8183 13.1914 49.813 13.1954C49.7766 13.2226 49.743 13.2518 49.7119 13.283C49.5659 13.4147 49.4479 13.5546 49.3529 13.7085C48.6904 14.7815 49.1317 16.2936 50.4695 17.6907L42.5272 30.2746L40.3393 33.7371L33.2559 28.8998C33.072 28.7662 32.8747 28.6493 32.6692 28.5524C32.1793 28.3212 31.6577 28.204 31.119 28.204C29.7195 28.2039 28.4293 29.0202 27.83 30.2841L19.922 46.4622L17.3852 44.5303C17.328 44.4813 17.2672 44.4383 17.2038 44.4021C16.9737 44.2699 16.7088 44.2023 16.4182 44.2023C15.5414 44.2022 14.5857 44.8333 14.0943 45.7371C13.4051 47.0044 13.5097 48.2476 14.3546 48.8306L18.2625 51.4639C18.7247 51.7841 19.2621 51.9959 19.8171 52.0765C19.9909 52.1032 20.1759 52.1173 20.3594 52.1173C21.7517 52.1173 23.0384 51.3078 23.6402 50.0541L31.625 34.0972L38.5573 38.9009C39.0147 39.2157 39.5223 39.4169 40.0683 39.5006C40.0705 39.501 40.0727 39.5013 40.0749 39.5017C40.1917 39.5194 40.3068 39.5314 40.4169 39.5376C40.4677 39.5406 40.5214 39.5417 40.5752 39.5417L40.6456 39.5412L40.6599 39.5411L40.7032 39.5419C40.7184 39.5419 40.7335 39.5417 40.7486 39.5411C40.8392 39.5382 40.9367 39.5307 41.0438 39.5183C41.0526 39.5175 41.0613 39.5165 41.069 39.5156C42.1722 39.3814 43.1404 38.7633 43.7241 37.8199L54.6471 20.1852C55.1774 20.3282 55.6889 20.4024 56.154 20.4024C57.2075 20.4024 58.0236 20.0202 58.4521 19.3261C58.5853 19.1105 58.6749 18.8689 58.7199 18.6055C58.7328 18.5559 58.7418 18.5046 58.7463 18.4518C58.747 18.4433 58.7478 18.4315 58.7485 18.4203C58.7485 18.4196 58.7486 18.419 58.7486 18.4183L59.3336 8.59734C59.3364 8.56831 59.3378 8.53889 59.3378 8.50913C59.3378 8.0042 58.929 7.59485 58.4241 7.59485Z" fill="#374874"/>
<path d="M57.6741 18.8458C58.3037 17.826 57.1255 15.9567 55.0425 14.6707C52.9595 13.3847 50.7605 13.1689 50.1308 14.1888C49.5012 15.2086 50.6794 17.0779 52.7624 18.3639C54.8455 19.6499 57.0445 19.8657 57.6741 18.8458Z" fill="#C1DBF6"/>
<path d="M18.8368 50.7371L14.8739 48.078L16.7502 45.1959L19.7267 47.4626C19.9644 47.6451 20.305 47.6003 20.4874 47.3626C20.5111 47.3317 20.5314 47.2984 20.548 47.2632L28.654 30.6803C29.2957 29.32 30.9187 28.7374 32.279 29.3792C32.437 29.4537 32.5875 29.5433 32.7284 29.6467L40.1266 34.699C40.3699 34.8759 40.7106 34.8221 40.8875 34.5788C40.8936 34.5704 40.8995 34.5619 40.9051 34.5532L52.3499 16.4413C52.3499 16.4413 52.8881 15.8623 54.0997 16.4799C55.3114 17.0975 55.0497 17.7988 55.0497 17.7988L42.9466 37.3388C42.1552 38.6179 40.4768 39.0133 39.1977 38.2219C39.1601 38.1986 39.123 38.1745 39.0866 38.1494L31.7955 33.0971C31.5475 32.9268 31.2085 32.9899 31.0382 33.2379C31.0221 33.2613 31.0079 33.2859 30.9957 33.3115L22.819 49.6521C22.1717 51.0098 20.5463 51.5856 19.1886 50.9383C19.0665 50.8801 18.9489 50.8128 18.8368 50.7371Z" fill="white"/>
<path d="M54.7066 14.475C56.2313 15.292 57.9554 16.9711 57.8354 18.3735L58.4229 8.50916L50.3599 13.9281C51.4171 13.1368 53.2377 13.6987 54.7066 14.475Z" fill="white"/>
<path d="M16.7502 45.1961C17.0354 45.359 17.0933 46.1374 16.6344 46.9673C16.1755 47.7972 15.2663 48.3419 14.8739 48.0782C14.445 47.7822 14.445 47.006 14.8974 46.1739C15.3499 45.3419 16.2913 44.9323 16.7502 45.1961Z" fill="#C1DBF6"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.8723 45.3764C15.5431 45.5399 15.2124 45.834 14.9978 46.2285C14.7781 46.6327 14.6722 47.0164 14.6694 47.3281C14.6667 47.6403 14.7662 47.8646 14.9382 47.9837C15.003 48.027 15.0995 48.0439 15.2295 48.0201C15.359 47.9965 15.5104 47.9341 15.669 47.8357C15.9862 47.6391 16.3145 47.3098 16.5344 46.912C16.756 46.5114 16.8503 46.1273 16.8571 45.829C16.8605 45.6796 16.8419 45.5555 16.8092 45.4629C16.776 45.3687 16.7324 45.3175 16.6935 45.2953L16.6933 45.2951C16.5128 45.1914 16.2079 45.2098 15.8723 45.3764ZM16.8072 45.097C16.5287 44.9369 16.1335 44.9915 15.7706 45.1717C15.4012 45.3551 15.035 45.6817 14.797 46.1193C14.5644 46.5472 14.444 46.9676 14.4409 47.3261C14.4377 47.6836 14.5524 47.9952 14.809 48.1722L14.8101 48.173C14.9415 48.2613 15.1056 48.2751 15.2705 48.245C15.4361 48.2148 15.6144 48.1386 15.7894 48.03C16.1397 47.8128 16.4955 47.4548 16.7344 47.0226C16.9718 46.5934 17.0779 46.1734 17.0856 45.8342C17.0895 45.6648 17.0689 45.5119 17.0248 45.3869C16.9813 45.2634 16.9108 45.1563 16.8072 45.097Z" fill="#C1DBF6"/>
<path d="M40.7099 37.7162C39.5219 37.3731 33.2537 32.8205 32.0271 31.9263C31.9256 31.8524 31.7835 31.8748 31.7096 31.9763C31.7033 31.9849 31.6976 31.994 31.6926 32.0035C31.4396 32.4667 31.1737 32.9835 31.075 33.1808C31.2589 32.9804 31.5617 32.9448 31.787 33.0971L39.078 38.1494C40.2141 38.9314 41.7556 38.7397 42.6657 37.7034C42.6132 37.7061 42.5609 37.7118 42.5091 37.7205C42.1188 37.787 41.5892 37.9736 40.7099 37.7162Z" fill="#C1DBF6"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31.6172 31.909C31.7282 31.7565 31.9418 31.7228 32.0944 31.8339C32.7075 32.2809 34.5804 33.6419 36.448 34.9339C37.382 35.58 38.3137 36.2082 39.0856 36.6959C39.4716 36.9399 39.8166 37.1481 40.1014 37.3056C40.3889 37.4647 40.6068 37.5675 40.7416 37.6064L40.742 37.6065C41.4602 37.8168 41.9283 37.7208 42.2979 37.6451C42.3648 37.6314 42.4285 37.6183 42.4899 37.6079C42.5461 37.5984 42.6029 37.5922 42.6597 37.5892L42.9303 37.5752L42.7515 37.7788C41.8032 38.8587 40.1971 39.0583 39.0132 38.2436L39.0129 38.2434L31.7229 33.1918C31.7228 33.1917 31.7226 33.1916 31.7224 33.1915C31.5441 33.0713 31.3047 33.0995 31.1592 33.258L30.6086 33.8581L30.9728 33.1297C31.0719 32.9314 31.3383 32.4137 31.592 31.9493C31.5995 31.9351 31.608 31.9217 31.6172 31.909ZM31.802 32.0435C31.7988 32.0479 31.796 32.0524 31.7936 32.0569L31.7929 32.0583C31.6338 32.3495 31.4696 32.662 31.3454 32.9024C31.5154 32.8673 31.698 32.899 31.851 33.0025L31.8521 33.0032L39.1428 38.0553C39.1429 38.0553 39.1428 38.0552 39.1428 38.0553C40.1356 38.7385 41.4517 38.6458 42.3368 37.8707C41.965 37.9473 41.4463 38.0508 40.678 37.826C40.5159 37.7791 40.2781 37.6646 39.9907 37.5056C39.7005 37.345 39.3513 37.1343 38.9635 36.8892C38.1876 36.3989 37.2529 35.7687 36.318 35.1219C34.4479 33.8283 32.5733 32.4659 31.9598 32.0186C31.9093 31.9819 31.8387 31.9931 31.802 32.0435Z" fill="#C1DBF6"/>
<path d="M20.443 50.2718C19.8211 50.0917 17.4922 48.5349 15.4829 47.141C15.2684 47.4476 15.0411 47.8208 14.8739 48.0781L18.7789 50.7093C19.9263 51.5076 21.4906 51.3145 22.4094 50.2611C22.3665 50.2611 21.3393 50.5292 20.443 50.2718Z" fill="#C1DBF6"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.4545 46.9822L15.548 47.0471C16.5523 47.7437 17.6356 48.4805 18.545 49.0654C18.9998 49.3579 19.4102 49.6118 19.7449 49.8035C20.0833 49.9972 20.3341 50.1213 20.4746 50.162C20.9033 50.2851 21.3681 50.2834 21.7356 50.2492C21.9186 50.2322 22.0756 50.2072 22.1897 50.1865C22.2467 50.1762 22.293 50.1669 22.3268 50.1601L22.329 50.1597C22.3447 50.1565 22.3585 50.1537 22.369 50.1518C22.3744 50.1507 22.38 50.1497 22.3851 50.149L22.3854 50.1489C22.3885 50.1484 22.3986 50.1468 22.4094 50.1468H22.6607L22.4955 50.3363C21.5386 51.4333 19.9095 51.6347 18.7143 50.8036L14.7168 48.1101L14.7781 48.0158C14.829 47.9374 14.8864 47.8469 14.9477 47.7501C15.0842 47.5347 15.2404 47.2883 15.3892 47.0755L15.4545 46.9822ZM15.512 47.3002C15.3867 47.4845 15.2601 47.6843 15.1448 47.8662C15.1052 47.9287 15.067 47.989 15.0306 48.0459L18.8442 50.6155C19.8449 51.3118 21.1767 51.221 22.0718 50.438C21.9797 50.452 21.8733 50.4659 21.7568 50.4768C21.376 50.5122 20.879 50.5159 20.4114 50.3817L20.4112 50.3816C20.2406 50.3322 19.9672 50.1941 19.6314 50.0018C19.2917 49.8074 18.8777 49.5511 18.4214 49.2577C17.5371 48.6889 16.4903 47.978 15.512 47.3002Z" fill="#C1DBF6"/>
<path d="M30.2966 30.2236C29.4388 31.1071 21.9505 46.8129 21.3222 48.1961C21.2704 48.3104 21.1357 48.3612 21.0213 48.3094C21.0119 48.3051 21.0028 48.3002 20.9941 48.2947C20.5459 48.016 20.0999 47.6771 19.9219 47.5549C20.1747 47.6208 20.4389 47.4986 20.5523 47.2633L28.669 30.6525C29.2748 29.4142 30.71 28.8232 32.0122 29.2758C31.9658 29.2999 31.9178 29.3207 31.8685 29.338C31.4889 29.4731 30.9378 29.5674 30.2966 30.2236Z" fill="#FBDBD0"/>
<path d="M53.7245 16.3213C53.7245 16.3213 42.359 34.0429 41.7157 35.426C41.6747 35.5371 41.5514 35.594 41.4403 35.553C41.4214 35.5461 41.4037 35.5365 41.3876 35.5247C40.9394 35.2459 40.4934 34.9071 40.3154 34.787C40.5687 34.8525 40.8331 34.7294 40.9458 34.4932L52.3392 16.4414C52.9182 15.9696 53.7245 16.3213 53.7245 16.3213Z" fill="#FBDBD0"/>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,6 @@
<svg width="41" height="64" viewBox="0 0 41 64" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M37.3387 63.9999C36.7637 64.0052 36.1967 63.8639 35.6914 63.5893L2.62385 44.4981C1.63699 43.8842 1.02039 42.8194 0.979126 41.6579V3.46248C1.04776 2.30902 1.6576 1.25593 2.62385 0.622286L2.99566 0.407981C4.02559 -0.135994 5.25777 -0.135994 6.2877 0.407981L39.3553 19.5147C40.3431 20.1276 40.9601 21.193 41 22.3549V60.5245C40.9314 61.6779 40.3215 62.731 39.3553 63.3647L38.9835 63.579" fill="#374874"/>
<path d="M38.5265 62.5694L38.8957 62.3577C39.5267 61.9435 39.9242 61.2548 39.9672 60.5013V22.3497C39.925 21.5959 39.5273 20.9069 38.8957 20.4933L5.84618 1.41754C5.17251 1.07659 4.3768 1.07659 3.70313 1.41754L3.3339 1.62926C2.70583 2.04517 2.31138 2.73355 2.27012 3.48571V41.6372C2.31069 42.3916 2.70878 43.0812 3.34165 43.4937L36.3911 62.5694C37.0621 62.9103 37.8555 62.9103 38.5265 62.5694Z" fill="white"/>
<path d="M39.9672 41.4255V22.3472C39.9553 21.9749 39.8496 21.6117 39.6599 21.2911L35.0614 24.0074V61.7432L36.4221 62.5488C37.1066 62.9051 37.922 62.9051 38.6065 62.5488L38.9163 62.3655C39.536 61.9494 39.9249 61.2671 39.9672 60.5219V41.4255Z" fill="#FBDBD0"/>
<path d="M2.27012 3.5451C2.27012 2.86604 2.75295 2.58718 3.34165 2.928L36.3163 21.965C36.9477 22.3761 37.3449 23.064 37.3852 23.8163V61.8955C37.3852 62.5772 36.9075 62.8535 36.3163 62.5126L3.33907 43.473C2.70767 43.0619 2.31048 42.3741 2.27012 41.6217V3.5451Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@@ -0,0 +1,105 @@
import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { patch } from "@web/core/utils/patch";
import { markup } from "@odoo/owl";
import { accountTourSteps } from "@account/js/tours/account";
patch(accountTourSteps, {
draftBillSelector:
":has(.o_radio_input[data-value=in_invoice]:checked):has(.o_arrow_button_current[data-value=draft])",
newInvoice() {
return [
{
trigger: "button[name=action_create_new]",
content: _t("Now, we'll create your first invoice (accountant)"),
run: "click",
}
]
},
endSteps() {
return [
{
trigger: ".dropdown-item[data-menu-xmlid='account.menu_board_journal_1']",
content: _t("You can now go back to the dashboard."),
tooltipPosition: "bottom",
run: "click",
},
];
},
});
registry.category("web_tour.tours").add('account_accountant_tour', {
steps: () => [
...accountTourSteps.goToAccountMenu().map(step => ({
...step,
// A little hack since the user will come from the account tour which we make sure to make him go to the
// dashboard in endSteps(), so we want to resume from there.
isActive: ['auto'].concat(step.isActive || []),
})),
// The tour will stop here if there is at least 1 vendor bill in the database.
// While not ideal, it is ok, since that means the user obviously knows how to create a vendor bill...
{
trigger: 'a[name="action_create_vendor_bill"]',
content: markup(_t('Create your first vendor bill.<br/><br/><i>Tip: If you don’t have one on hand, use our sample bill.</i>')),
tooltipPosition: 'bottom',
run: "click",
}, {
trigger: `.o_form_view_container${accountTourSteps.draftBillSelector} button.btn-primary[name='action_post']`,
content: _t('After the data extraction, check and validate the bill. If no vendor has been found, add one before validating.'),
tooltipPosition: 'bottom',
run: "click",
}, {
trigger: '.dropdown-item[data-menu-xmlid="account.menu_board_journal_1"]',
content: _t('Let’s go back to the dashboard.'),
tooltipPosition: 'bottom',
run: "click",
}, {
trigger: 'a[name="open_action"] span:contains(bank)',
content: _t('Connect your bank and get your latest transactions.'),
tooltipPosition: 'bottom',
run: "click",
}, {
isActive: ["auto"],
trigger: ".o_bank_reconciliation_container",
}, {
trigger: ".o_bank_rec_widget_kanban_view button.o-kanban-button-new",
content: _t('Create a new transaction.'),
tooltipPosition: "bottom",
run: "click",
}, {
trigger: ".o_bank_rec_widget_kanban_view div[name=amount] input",
content: _t("Set an amount."),
tooltipPosition: "bottom",
run: "edit -19250.00",
}, {
trigger: ".o_bank_rec_widget_kanban_view div[name=payment_ref] input[id=payment_ref_0]",
content: _t("Set the payment reference."),
tooltipPosition: "bottom",
run: "edit Payment Acme Corporation",
}, {
trigger: ".o_bank_rec_widget_kanban_view button.o_kanban_edit",
content: _t("Confirm the transaction."),
tooltipPosition: "bottom",
run: "click",
}, {
isActive: ["auto"],
trigger: '.o_kanban_renderer:not(:has(.o_bank_reconciliation_quick_create))',
}, {
isActive: ["auto"],
trigger: ".o_bank_reconciliation_container",
}, {
trigger: ".o_bank_rec_widget_kanban_view div[name='bank_statement_line']:first",
content: _t("Click on the statement to unfold it."),
tooltipPosition: "bottom",
run: "click",
}, {
isActive: ["auto"],
trigger: "div.o_button_line",
}, {
trigger: '.dropdown-item[data-menu-xmlid="account.menu_board_journal_1"]',
content: _t('Let’s go back to the dashboard.'),
run: "click",
}
]
});

View File

@@ -0,0 +1,69 @@
import { describe, expect, test } from "@odoo/hoot";
import { click } from "@odoo/hoot-dom";
import { animationFrame } from "@odoo/hoot-mock";
import { mountWithCleanup, defineModels } from "@web/../tests/web_test_helpers";
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { BankRecButton } from "@account_accountant/components/bank_reconciliation/button/button";
// Due to dependency with mail module, we have to define their models for our tests.
defineModels(mailModels);
describe.current.tags("desktop");
test("can display a button", async () => {
await mountWithCleanup(BankRecButton, {
props: {
label: "A label",
action: () => {},
count: null,
primary: false,
},
});
expect(".btn.btn-secondary").toHaveText("A label");
});
test("can display a button with a count", async () => {
await mountWithCleanup(BankRecButton, {
props: {
label: "Another label",
action: () => {},
count: 10,
primary: false,
},
});
expect(".btn span:first").toHaveText("Another label");
expect(".btn span:last").toHaveText("10");
});
test("can display a button with primary class", async () => {
await mountWithCleanup(BankRecButton, {
props: {
label: "A label with primary class",
action: () => {},
count: null,
primary: true,
},
});
expect(".btn.btn-primary").toHaveText("A label with primary class");
});
test("can call function when button is clicked", async () => {
let counter = 0;
await mountWithCleanup(BankRecButton, {
props: {
label: "A button with an action",
action: () => counter++,
count: null,
primary: false,
},
});
await click(".btn");
await animationFrame();
expect(counter).toBe(1);
});

View File

@@ -0,0 +1,289 @@
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { beforeEach, describe, expect, test } from "@odoo/hoot";
import { click, queryAll, queryAllTexts, queryOne } from "@odoo/hoot-dom";
import { animationFrame, mockDate } from "@odoo/hoot-mock";
import {
contains,
defineModels,
fields,
getService,
models,
mountWithCleanup,
} from "@web/../tests/web_test_helpers";
import { WebClient } from "@web/webclient/webclient";
import { BankRecSelectCreateDialog } from "@account_accountant/components/bank_reconciliation/search_dialog/search_dialog";
class AccountMoveLine extends models.Model {
name = fields.Char({ string: "Name" });
date = fields.Date({ string: "Date" });
partner_id = fields.Many2one({ string: "Partner", relation: "partner" });
amount_residual = fields.Float({ string: "Amount Residual" });
amount_residual_currency = fields.Float({ string: "Amount Residual Currency" });
currency_id = fields.Many2one({ string: "Currency", relation: "res.currency" });
company_currency_id = fields.Many2one({ string: "Currency", relation: "res.currency" });
_records = [
{
id: 1,
name: "INV/2025/0001",
date: "2025-01-11",
partner_id: 1,
amount_residual: -230,
currency_id: 1,
},
{
id: 2,
name: "INV/2025/0002",
date: "2025-01-12",
partner_id: 1,
amount_residual: -150,
currency_id: 1,
},
{
id: 3,
name: "INV/2025/0003",
date: "2025-01-13",
partner_id: 1,
amount_residual: -50,
currency_id: 1,
},
{
id: 4,
name: "INV/2025/0004",
date: "2025-01-14",
partner_id: 2,
amount_residual: -100,
currency_id: 1,
},
{
id: 5,
name: "INV/2025/0005",
date: "2025-01-15",
partner_id: 3,
amount_residual: -125,
currency_id: 1,
},
];
_views = {
list: /* xml */ `
<list js_class="bank_rec_dialog_list" string="Journal Items">
<field name="date"/>
<field name="name"/>
<field name="partner_id"/>
<field name="amount_residual"/>
<field name="amount_residual_currency"/>
<field name="currency_id"/>
</list>
`,
search: /* xml */ `
<search>
<field name="partner_id"/>
</search>
`,
kanban: /* xml */ `
<kanban>
<field name="date"/>
<field name="name"/>
<templates>
<t t-name="card"/>
</templates>
</kanban>
`,
form: /* xml */ `
<form/>
`,
};
}
class Partner extends models.Model {
name = fields.Char({ string: "Name" });
_records = [
{ id: 1, name: "Jean Pierre" },
{ id: 2, name: "Pierre Jean" },
{ id: 3, name: "JB Pokie" },
];
}
// Due to dependency with mail module, we have to define their models for our tests.
defineModels({ ...mailModels, AccountMoveLine, Partner });
beforeEach(() => {
mockDate("2025-04-22 00:00:00");
});
describe.current.tags("desktop");
test("BankRecSelectCreateDialog footer with right information", async () => {
await mountWithCleanup(WebClient);
getService("dialog").add(BankRecSelectCreateDialog, {
noCreate: true,
resModel: "account.move.line",
suspenseAccountLine: {
amount_currency: 233.33,
currency_id: { id: 1 },
company_currency_id: { id: 1 },
},
date: luxon.DateTime.now(),
reference: "A cool reference to display",
context: { search_default_partner_id: 1 },
domain: [],
});
await animationFrame();
const bankReconciliationInfoNode = queryOne("div[name='bank_reconciliation_info']").children;
const bankReconciliationInfo = queryAllTexts(bankReconciliationInfoNode);
expect(bankReconciliationInfo[0]).toBe("Apr 22");
expect(bankReconciliationInfo[1]).toBe("A cool reference to display");
expect(bankReconciliationInfo[2]).toBe("Balance: $ 233.33");
});
test("BankRecSelectCreateDialog list view single currency", async () => {
await mountWithCleanup(WebClient);
getService("dialog").add(BankRecSelectCreateDialog, {
noCreate: true,
resModel: "account.move.line",
suspenseAccountLine: {
amount_currency: 100,
currency_id: { id: 1 },
company_currency_id: { id: 1 },
},
reference: "A useless reference",
date: luxon.DateTime.now(),
context: { search_default_partner_id: 1 },
domain: [],
});
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ 100.00");
expect("div.o_facet_values > small.o_facet_value").toHaveText("Jean Pierre");
// Check that we have 4 checkboxes (Select all + 3 elements)
let checkboxes = queryAll(".form-check > .form-check-input[type='checkbox']");
expect(checkboxes.length).toBe(4);
// Select an element already fetch
await click(checkboxes[2]);
await animationFrame();
// Unselect this element
await click(checkboxes[2]);
await animationFrame();
await click("div.o_facet_values > button.o_facet_remove");
await animationFrame();
// Check that we have 6 checkboxes (Select all + 5 elements)
checkboxes = queryAll(".form-check > .form-check-input[type='checkbox']");
expect(checkboxes.length).toBe(6);
await click(checkboxes[4]);
await animationFrame();
await animationFrame();
// Check that the balance is correctly affected by the selection
expect("div[name='remaining_amount']").toHaveText("Balance: $ 0.00");
await click(checkboxes[4]);
await animationFrame();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ 100.00");
await click(".o_pager_value");
await animationFrame();
expect(".o_pager_counter .o_pager_value").toHaveValue("1-5");
await contains("input.o_pager_value").edit("1-2");
await click(document.body);
await animationFrame();
checkboxes = queryAll(".form-check > .form-check-input[type='checkbox']");
expect(checkboxes.length).toBe(3);
await click(checkboxes[0]);
await animationFrame();
await contains(`.o_select_domain`).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ -555.00");
});
test("BankRecSelectCreateDialog list view multi currencies", async () => {
AccountMoveLine._records.push({
id: 6,
name: "INV/2025/0006",
date: "2025-01-15",
partner_id: 3,
amount_residual: -100,
amount_residual_currency: -200,
currency_id: 2,
});
AccountMoveLine._records.push({
id: 7,
name: "INV/2025/0007",
date: "2025-01-15",
partner_id: 3,
amount_residual: -100,
amount_residual_currency: -150,
currency_id: 2,
});
AccountMoveLine._records.push({
id: 8,
name: "INV/2025/0008",
date: "2025-01-15",
partner_id: 3,
amount_residual: -100,
amount_residual_currency: -100,
currency_id: 1,
});
await mountWithCleanup(WebClient);
getService("dialog").add(BankRecSelectCreateDialog, {
noCreate: true,
resModel: "account.move.line",
suspenseAccountLine: {
amount_currency: 100,
currency_id: { id: 2 },
company_currency_id: { id: 1 },
},
reference: "A useless reference",
date: luxon.DateTime.now(),
context: { search_default_partner_id: 3 },
domain: [],
});
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: 100.00 €");
const checkboxes = queryAll(".form-check > .form-check-input[type='checkbox']");
expect(checkboxes.length).toBe(5);
await click(checkboxes[2]);
await animationFrame();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: -100.00 €");
await click(checkboxes[3]);
await animationFrame();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: -250.00 €");
await click(checkboxes[2]);
await animationFrame();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: -50.00 €");
await click(checkboxes[3]);
await animationFrame();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: 100.00 €");
// Different currencies cannot be computed together
await click(checkboxes[4]);
await animationFrame();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: /");
await click(checkboxes[4]);
await animationFrame();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: 100.00 €");
});

View File

@@ -0,0 +1,258 @@
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { beforeEach, describe, expect, test } from "@odoo/hoot";
import { click, keyDown, queryAll, queryAllTexts, queryOne } from "@odoo/hoot-dom";
import { animationFrame, mockDate } from "@odoo/hoot-mock";
import {
contains,
defineModels,
fields,
getService,
models,
mountWithCleanup,
} from "@web/../tests/web_test_helpers";
import { WebClient } from "@web/webclient/webclient";
import { BankRecSelectCreateDialog } from "@account_accountant/components/bank_reconciliation/search_dialog/search_dialog";
class AccountMoveLine extends models.Model {
move_name = fields.Char({ string: "Move Name" });
ref = fields.Char({ string: "Ref" });
date = fields.Date({ string: "Date" });
partner_id = fields.Many2one({ string: "Partner", relation: "partner" });
amount_residual = fields.Float({ string: "Amount Residual" });
amount_residual_currency = fields.Float({ string: "Amount Residual Currency" });
currency_id = fields.Many2one({ string: "Currency", relation: "res.currency" });
company_currency_id = fields.Many2one({ string: "Currency", relation: "res.currency" });
_records = [
{
id: 1,
move_name: "INV/2025/0001",
ref: "Customer Reference invoice 1",
date: "2025-01-11",
partner_id: 1,
amount_residual: -230,
currency_id: 1,
},
{
id: 2,
move_name: "INV/2025/0002",
ref: "Customer Reference invoice 2",
date: "2025-01-12",
partner_id: 1,
amount_residual: -150,
currency_id: 1,
},
{
id: 3,
move_name: "INV/2025/0003",
ref: "Customer Reference invoice 3",
date: "2025-01-13",
partner_id: 1,
amount_residual: -50,
currency_id: 1,
},
{
id: 4,
move_name: "INV/2025/0004",
ref: "Customer Reference invoice 4",
date: "2025-01-14",
partner_id: 2,
amount_residual: -100,
currency_id: 1,
},
{
id: 5,
move_name: "INV/2025/0005",
ref: "Customer Reference invoice 5",
date: "2025-01-15",
partner_id: 2,
amount_residual: 100,
currency_id: 1,
},
{
id: 6,
move_name: "INV/2025/0006",
ref: "Customer Reference invoice 6",
date: "2025-01-15",
partner_id: 3,
amount_residual: -125,
currency_id: 1,
},
];
_views = {
kanban: /* xml */ `
<kanban js_class="bank_rec_dialog_kanban">
<field name="currency_id"/>
<field name="company_currency_id"/>
<templates>
<t t-name="card">
<field name="move_name"/>
<field name="ref"/>
<field name="date"/>
<field name="partner_id"/>
<field name="amount_residual"/>
<field name="amount_residual_currency"/>
</t>
</templates>
</kanban>
`,
search: /* xml */ `
<search>
<field name="partner_id"/>
</search>
`,
};
}
class Partner extends models.Model {
name = fields.Char({ string: "Name" });
_records = [
{ id: 1, name: "Jean Pierre" },
{ id: 2, name: "Pierre Jean" },
{ id: 3, name: "JB Pokie" },
];
}
defineModels({ ...mailModels, AccountMoveLine, Partner });
beforeEach(() => {
mockDate("2025-04-22 00:00:00");
});
describe.current.tags("mobile");
test("BankRecSelectCreateDialog header with right information", async () => {
await mountWithCleanup(WebClient);
getService("dialog").add(BankRecSelectCreateDialog, {
noCreate: true,
resModel: "account.move.line",
suspenseAccountLine: {
amount_currency: 233.33,
currency_id: { id: 1 },
company_currency_id: { id: 1 },
},
date: luxon.DateTime.now(),
reference: "A cool reference to display",
context: {},
domain: [],
});
await animationFrame();
const bankReconciliationInfoNode = queryOne("div[name='bank_reconciliation_info']").children;
const bankReconciliationInfo = queryAllTexts(bankReconciliationInfoNode);
expect(bankReconciliationInfo[0]).toBe("Apr 22");
expect(bankReconciliationInfo[1]).toBe("A cool reference to display");
expect(bankReconciliationInfo[2]).toBe("Balance: $ 233.33");
});
test("BankRecSelectCreateDialog kanban view single currency", async () => {
await mountWithCleanup(WebClient);
getService("dialog").add(BankRecSelectCreateDialog, {
noCreate: true,
resModel: "account.move.line",
suspenseAccountLine: {
amount_currency: 100,
currency_id: { id: 1 },
company_currency_id: { id: 1 },
},
reference: "A useless reference",
date: luxon.DateTime.now(),
context: { search_default_partner_id: 1 },
domain: [],
});
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ 100.00");
await click("div.o_control_panel_navigation > button > i[data-icon='search']");
await animationFrame();
expect("div.o_facet_values > small.o_facet_value").toHaveText("Jean Pierre");
let articles = queryAll("article.o_kanban_record");
expect(articles.length).toBe(3);
await click("button.o_facet_remove");
await animationFrame();
articles = queryAll("article.o_kanban_record");
expect(articles.length).toBe(6);
await keyDown("Alt");
await contains(articles[3]).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ 0.00");
await keyDown("Alt");
await contains(articles[3]).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ 100.00");
await keyDown("Alt");
await contains(articles[4]).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ 200.00");
await keyDown("Alt");
await contains(articles[4]).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: $ 100.00");
await keyDown("Alt");
await contains(articles[0]).click();
await animationFrame();
await contains(`.o_select_domain`).click();
await animationFrame();
expect("div.o_selection_box").toHaveText("All 6 selected");
expect("div[name='remaining_amount']").toHaveText("Balance: $ -455.00");
});
test("BankRecSelectCreateDialog kanban view multiple currencies", async () => {
AccountMoveLine._records.push({
id: 7,
move_name: "INV/2025/0007",
ref: "Customer Reference invoice 7",
date: "2025-01-17",
partner_id: 3,
amount_residual: -100,
amount_residual_currency: -200,
currency_id: 2,
company_currency_id: 1,
});
await mountWithCleanup(WebClient);
getService("dialog").add(BankRecSelectCreateDialog, {
noCreate: true,
resModel: "account.move.line",
suspenseAccountLine: {
amount_currency: 100,
currency_id: { id: 2 },
company_currency_id: { id: 1 },
},
reference: "A useless reference",
date: luxon.DateTime.now(),
context: {},
domain: [],
});
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: 100.00 €");
const articles = queryAll("article.o_kanban_record");
expect(articles.length).toBe(7);
await keyDown("Alt");
await contains(articles[6]).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: -100.00 €");
await keyDown("Alt");
await contains(articles[6]).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: 100.00 €");
await keyDown("Alt");
await contains(articles[3]).click();
await animationFrame();
expect("div[name='remaining_amount']").toHaveText("Balance: /");
});

View File

@@ -0,0 +1,54 @@
import { describe, expect, test } from "@odoo/hoot";
import { click, queryOne } from "@odoo/hoot-dom";
import { animationFrame } from "@odoo/hoot-mock";
import { mountWithCleanup, defineModels } from "@web/../tests/web_test_helpers";
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { BankRecStatementSummary } from "@account_accountant/components/bank_reconciliation/statement_summary/statement_summary";
// Due to dependency with mail module, we have to define their models for our tests.
defineModels(mailModels);
describe.current.tags("desktop");
test("can display a BankRecStatementSummary", async () => {
let counter = 0;
await mountWithCleanup(BankRecStatementSummary, {
props: {
label: "A label",
action: () => {
counter++;
},
amount: "$1,000.00",
},
});
const elements = queryOne("div.o_statement_summary").children;
await click(elements[1]);
await animationFrame();
expect(counter).toBe(1);
expect(elements[0]).toHaveText("A label");
expect(elements[1]).toHaveText("$1,000.00");
});
test("no amount displayed if no amount in props", async () => {
await mountWithCleanup(BankRecStatementSummary, {
props: {
label: "A label",
action: () => {},
},
});
const elements = queryOne("div.o_statement_summary").children;
expect(elements).toHaveCount(1);
});
test("label in text danger when isValid set to False", async () => {
await mountWithCleanup(BankRecStatementSummary, {
props: {
label: "A label",
isValid: false,
action: () => {},
amount: "$1,000.00",
},
});
expect("div.o_statement_summary > div > h4").toHaveClass("text-danger");
});

View File

@@ -0,0 +1,57 @@
import { expect, runAllTimers, test } from "@odoo/hoot";
import { clickFieldDropdownItem, contains, defineModels, fields, models, mountView, onRpc } from "@web/../tests/web_test_helpers";
import { mailModels } from "@mail/../tests/mail_test_helpers";
class AccountBankStatement extends models.Model {
name = fields.Char();
_records = [
{ id: 1, name: "Statement 1" },
{ id: 2, name: "Statement 2" },
];
}
class AccountBankStatementLine extends models.Model {
name = fields.Char();
statement_id = fields.Many2one({ relation: "account.bank.statement" });
attachment_ids = fields.Many2many({ relation: "ir.attachment" });
bank_statement_attachment_ids = fields.Many2many({ relation: "ir.attachment" });
partner_id = fields.Integer();
line_ids = fields.Integer();
journal_id = fields.Integer();
company_id = fields.Integer();
_records = [
{ id: 1, name: "Line 1", statement_id: 1 },
{ id: 2, name: "Line 2", statement_id: 1 },
];
}
defineModels({ ...mailModels, AccountBankStatement, AccountBankStatementLine });
test.tags("desktop");
test("bank_rec_list_many2one_multi_id widget works in multi-edit", async () => {
expect.assertions(1);
onRpc("web_save", ({ args }) => {
expect(args[1].statement_id).toBe(3);
});
await mountView({
resModel: "account.bank.statement.line",
type: "list",
arch: `
<list multi_edit="1" js_class="bank_rec_list">
<field name="name"/>
<field name="statement_id" widget="bank_rec_list_many2one_multi_id"/>
</list>
`,
});
await contains(".o_data_row:eq(0) .o_list_record_selector input").click();
await contains(".o_data_row:eq(1) .o_list_record_selector input").click();
await contains(".o_data_row:eq(0) [name='statement_id']").click();
await contains("[name='statement_id'] input").edit("New Statement", { confirm: false });
await runAllTimers();
await clickFieldDropdownItem("statement_id", 'Create "New Statement"');
// Confirm the multi-edit dialog
await contains(".modal .btn-primary").click();
});

View File

@@ -0,0 +1,331 @@
import { defineAccountModels } from "@account/../tests/account_test_helpers";
import {
click,
contains,
listenStoreFetch,
onRpcBefore,
openListView,
patchUiSize,
SIZES,
start,
startServer,
STORE_FETCH_ROUTES,
userContext,
waitStoreFetch,
} from "@mail/../tests/mail_test_helpers";
import { beforeEach, expect, test } from "@odoo/hoot";
import { onRpc } from "@web/../tests/web_test_helpers";
import { getOrigin } from "@web/core/utils/urls";
const ROUTES_TO_IGNORE = [
...STORE_FETCH_ROUTES,
"/bus/im_status",
"/hr_attendance/attendance_user_data",
"/web/dataset/call_kw/account.move.line/get_views",
"/web/dataset/call_kw/res.users/has_group",
"/web/dataset/call_kw/res.users/load_views",
"/web/webclient/load_menus",
];
const openPreparedView = async (size) => {
patchUiSize({ size: size });
onRpcBefore((route, args) => {
if (
ROUTES_TO_IGNORE.includes(route) ||
route.includes("/web/static/lib/pdfjs/web/viewer.html")
) {
return;
}
expect.step(`${route} - ${JSON.stringify(args)}`);
});
onRpc(({ kwargs, route }) => {
if (ROUTES_TO_IGNORE.includes(route)) {
return;
}
expect.step(`${route} - {"kwargs":${JSON.stringify(kwargs)}}`);
});
listenStoreFetch("init_messaging");
await start();
await waitStoreFetch("init_messaging");
await openListView("account.move.line", {
context: { group_by: ["move_id"] },
arch: `
<list editable='bottom' js_class='account_move_line_list'>
<field name='id'/>
<field name='name'/>
<field name='move_id'/>
</list>`,
});
};
defineAccountModels();
beforeEach(async () => {
const pyEnv = await startServer();
const accountMoveLineIds = pyEnv["account.move.line"].create([
{ name: "line0" },
{ name: "line1" },
{ name: "line2" },
{ name: "line3" },
{ name: "line4" },
{ name: "line5" },
]);
const accountMove = pyEnv["account.move"].create([
{ name: "move0", invoice_line_ids: [accountMoveLineIds[0], accountMoveLineIds[1]] },
{ name: "move1", invoice_line_ids: [accountMoveLineIds[2], accountMoveLineIds[3]] },
{ name: "move2", invoice_line_ids: [accountMoveLineIds[4], accountMoveLineIds[5]] },
]);
const attachmentIds = pyEnv["ir.attachment"].create([
{ res_id: accountMove[1], res_model: "account.move", mimetype: "application/pdf" },
{ res_id: accountMove[2], res_model: "account.move", mimetype: "application/pdf" },
]);
pyEnv["account.move"].write([accountMove[1]], { attachment_ids: [attachmentIds[0]] });
pyEnv["account.move.line"].write([accountMoveLineIds[0]], { move_id: accountMove[0] });
pyEnv["account.move.line"].write([accountMoveLineIds[1]], { move_id: accountMove[0] });
pyEnv["account.move.line"].write([accountMoveLineIds[2]], {
move_id: accountMove[1],
move_attachment_ids: [attachmentIds[0]],
});
pyEnv["account.move.line"].write([accountMoveLineIds[3]], {
move_id: accountMove[1],
move_attachment_ids: [attachmentIds[0]],
});
pyEnv["account.move.line"].write([accountMoveLineIds[4]], {
move_id: accountMove[2],
move_attachment_ids: [attachmentIds[1]],
});
pyEnv["account.move.line"].write([accountMoveLineIds[5]], {
move_id: accountMove[2],
move_attachment_ids: [attachmentIds[1]],
});
});
test("No preview on small devices", async () => {
await openPreparedView(SIZES.XL);
await contains(".o_move_line_list_view");
await expect.waitForSteps([
`/web/dataset/call_kw/account.move.line/web_read_group - ${JSON.stringify({
kwargs: {
domain: [],
groupby: ["move_id"],
aggregates: [],
limit: 80,
offset: 0,
order: "",
auto_unfold: false,
unfold_read_specification: {
id: {},
name: {},
move_id: { fields: { display_name: {} } },
move_attachment_ids: { fields: { mimetype: {} } },
},
unfold_read_default_limit: 80,
groupby_read_specification: {},
context: {
...userContext(),
bin_size: true,
read_group_expand: true,
group_by: ["move_id"],
},
},
})}`,
]);
// weak test, no guarantee to wait long enough for the potential attachment preview to show
await contains(".o_attachment_preview", { count: 0 }); // The preview component shouldn't be mounted for small screens
await click(":nth-child(1 of .o_group_header)");
await contains(".o_data_row", { count: 2 });
await expect.waitForSteps([
`/web/dataset/call_kw/account.move.line/web_search_read - ${JSON.stringify({
kwargs: {
specification: {
id: {},
name: {},
move_id: { fields: { display_name: {} } },
move_attachment_ids: { fields: { mimetype: {} } },
},
offset: 0,
order: "",
limit: 80,
context: {
...userContext(),
group_by: ["move_id"],
default_move_id: 1,
},
count_limit: 10001,
domain: [["move_id", "=", 1]],
},
})}`,
]);
await click(":nth-child(1 of .o_data_row) :nth-child(2 of .o_data_cell)");
await contains(":nth-child(1 of .o_data_row) :nth-child(2 of .o_data_cell) textarea");
// weak test, no guarantee to wait long enough for the potential attachment preview to show
await contains(".o_attachment_preview", { count: 0 }); // The preview component shouldn't be mounted for small screens even when clicking on a line without attachment
await click(":nth-child(2 of .o_group_header)");
await contains(".o_data_row", { count: 4 });
await expect.waitForSteps([
`/web/dataset/call_kw/account.move.line/web_search_read - ${JSON.stringify({
kwargs: {
specification: {
id: {},
name: {},
move_id: { fields: { display_name: {} } },
move_attachment_ids: { fields: { mimetype: {} } },
},
offset: 0,
order: "",
limit: 80,
context: {
...userContext(),
group_by: ["move_id"],
default_move_id: 2,
},
count_limit: 10001,
domain: [["move_id", "=", 2]],
},
})}`,
]);
await click(":nth-child(4 of .o_data_row) :nth-child(2 of .o_data_cell)");
await contains(":nth-child(4 of .o_data_row) :nth-child(2 of .o_data_cell) textarea");
// weak test, no guarantee to wait long enough for the potential attachment preview to show
await contains(".o_attachment_preview", { count: 0 }); // The preview component shouldn't be mounted for small screens even when clicking on a line with attachment
await expect.waitForSteps([], { message: "no extra rpc should be done" });
});
test("Fetch and preview of attachments on big devices", async () => {
await openPreparedView(SIZES.XXL);
await contains(".o_move_line_list_view");
await expect.waitForSteps([
`/web/dataset/call_kw/account.move.line/web_read_group - ${JSON.stringify({
kwargs: {
domain: [],
groupby: ["move_id"],
aggregates: [],
limit: 80,
offset: 0,
order: "",
auto_unfold: false,
unfold_read_specification: {
id: {},
name: {},
move_id: { fields: { display_name: {} } },
move_attachment_ids: { fields: { mimetype: {} } },
},
unfold_read_default_limit: 80,
groupby_read_specification: {},
context: {
...userContext(),
bin_size: true,
read_group_expand: true,
group_by: ["move_id"],
},
},
})}`,
]);
await contains(".o_attachment_preview");
await contains(".o_attachment_preview p", {
text: "Choose a line to preview its attachments.",
});
await contains(".o_attachment_preview iframe", { count: 0 });
await click(":nth-child(1 of .o_group_header)");
await contains(".o_data_row", { count: 2 });
await expect.waitForSteps([
`/web/dataset/call_kw/account.move.line/web_search_read - ${JSON.stringify({
kwargs: {
specification: {
id: {},
name: {},
move_id: { fields: { display_name: {} } },
move_attachment_ids: { fields: { mimetype: {} } },
},
offset: 0,
order: "",
limit: 80,
context: {
...userContext(),
group_by: ["move_id"],
default_move_id: 1,
},
count_limit: 10001,
domain: [["move_id", "=", 1]],
},
})}`,
]);
await click(":nth-child(1 of .o_data_row) :nth-child(2 of .o_data_cell)");
await contains(".o_attachment_preview iframe", { count: 0 });
await contains(".o_attachment_preview p", { text: "No attachments linked." });
await click(":nth-child(2 of .o_group_header)");
await contains(".o_data_row", { count: 4 });
await contains(".o_attachment_preview p", { text: "No attachments linked." });
await expect.waitForSteps([
`/web/dataset/call_kw/account.move.line/web_search_read - ${JSON.stringify({
kwargs: {
specification: {
id: {},
name: {},
move_id: { fields: { display_name: {} } },
move_attachment_ids: { fields: { mimetype: {} } },
},
offset: 0,
order: "",
limit: 80,
context: {
...userContext(),
group_by: ["move_id"],
default_move_id: 2,
},
count_limit: 10001,
domain: [["move_id", "=", 2]],
},
})}`,
]);
await click(":nth-child(4 of .o_data_row) :nth-child(2 of .o_data_cell)");
await contains(".o_attachment_preview p", { count: 0 });
await contains(
`.o_attachment_preview iframe[data-src='/web/static/lib/pdfjs/web/viewer.html?file=${encodeURIComponent(
getOrigin() + "/web/content/1"
)}#pagemode=none']`
);
await expect.waitForSteps([], { message: "no extra rpc should be done" });
await click(":nth-child(3 of .o_group_header)");
await contains(".o_data_row", { count: 6 });
// weak test, no guarantee to wait long enough for the potential attachment to change
await contains(
`.o_attachment_preview iframe[data-src='/web/static/lib/pdfjs/web/viewer.html?file=${encodeURIComponent(
getOrigin() + "/web/content/1"
)}#pagemode=none']`
); // The previewer content shouldn't change without clicking on another line from another account.move
await expect.waitForSteps([
`/web/dataset/call_kw/account.move.line/web_search_read - ${JSON.stringify({
kwargs: {
specification: {
id: {},
name: {},
move_id: { fields: { display_name: {} } },
move_attachment_ids: { fields: { mimetype: {} } },
},
offset: 0,
order: "",
limit: 80,
context: {
...userContext(),
group_by: ["move_id"],
default_move_id: 3,
},
count_limit: 10001,
domain: [["move_id", "=", 3]],
},
})}`,
]);
await click(":nth-child(5 of .o_data_row) :nth-child(2 of .o_data_cell)");
await contains(":nth-child(5 of .o_data_row) :nth-child(2 of .o_data_cell) textarea");
await contains(
`.o_attachment_preview iframe[data-src='/web/static/lib/pdfjs/web/viewer.html?file=${encodeURIComponent(
getOrigin() + "/web/content/2"
)}#pagemode=none']`
);
await expect.waitForSteps([]);
await click(":nth-child(1 of .o_data_row) :nth-child(2 of .o_data_cell)");
await contains(".o_attachment_preview iframe", { count: 0 });
await contains(".o_attachment_preview p");
await expect.waitForSteps([]);
});

View File

@@ -0,0 +1,66 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
import { accountTourSteps } from "@account/js/tours/account";
registry.category("web_tour.tours").add('account_accountant_bank_rec_widget_save_analytic_distribution', {
steps: () => [
stepUtils.showAppsMenuItem(),
...accountTourSteps.goToAccountMenu("Open the accounting module"),
{
trigger: ".o_breadcrumb",
},
{
content: "Open the bank reconciliation widget",
trigger: "button.btn-secondary[name='action_open_reconcile']",
run: "click",
},
{
trigger: "div[name='line_ids']",
},
{
content: "The 'line1' should be selected by default",
trigger: "div[name='line_ids'] td[field='name']:contains('line1')",
},
{
content: "Click on first line",
trigger: "div[name='line_ids'] td[field='debit']:first",
run: "click",
},
{
content: "The 'manual_operations_tab' should be active now and the auto_balance line mounted in edit",
trigger: "a.active[name='manual_operations_tab']",
},
{
content: "Enter an analytic distribution",
trigger: "div[name='analytic_distribution'] .o_input_dropdown",
run: "click",
},
{
content: "Select analytic distribution",
trigger: "tr[name='line_0'] input",
run: "edit analytic_account",
},
{
trigger: ".ui-autocomplete",
},
{
content: "Select analytic distribution",
trigger: ".ui-autocomplete:visible li:contains('analytic_account')",
run: "click",
},
{
content: "Close the analytic distribution",
trigger: ".o_button",
run: "click",
},
...stepUtils.toggleHomeMenu(),
...accountTourSteps.goToAccountMenu("Reset back to accounting module"),
{
content: "check that we're back on the dashboard",
trigger: 'a:contains("Sales")',
},
]
});

View File

@@ -0,0 +1,58 @@
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
import { accountTourSteps } from "@account/js/tours/account";
/**
* Verifies that when setting a partner on a statement line from a branch company,
* contacts owned by the parent company are visible in the lookup dialog.
*
* The partner lookup domain uses `parent_of` so that contacts belonging to any
* ancestor company of the statement line's company are included.
*/
registry.category("web_tour.tours").add("account_accountant_bank_rec_set_partner_branch_company", {
steps: () => [
stepUtils.showAppsMenuItem(),
...accountTourSteps.goToAccountMenu("Open the accounting module"),
{
content: "Open the branch bank reconciliation widget",
trigger: "a.oe_kanban_action span:contains('Branch Bank')",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_kanban_renderer",
},
{
content: "Unfold the statement line",
trigger: "div[name='bank_statement_line']",
run: "click",
},
{
content: "Line is unfolded",
trigger: "div.o_button_line",
},
{
content: "Open the Set Partner dialog",
trigger: "button.set-partner-btn",
run: "click",
},
{
content: "Search dialog is open",
trigger: "div.modal-dialog",
},
{
// The parent company's contact must appear even though the statement line
// belongs to a branch company — this validates the `parent_of` domain fix.
content: "Parent company contact is visible in the results",
trigger: "tbody > tr > td[name='display_name']:contains('AAAA Parent Partner')",
},
{
content: "Select the parent company contact",
trigger: "tbody > tr > td[name='display_name']:contains('AAAA Parent Partner')",
run: "click",
},
{
content: "Partner is set on the statement line",
trigger: "span[name='statement_line_partner_name']:contains('AAAA Parent Partner')",
},
],
});

View File

@@ -0,0 +1,267 @@
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
import { accountTourSteps } from "@account/js/tours/account";
registry.category("web_tour.tours").add("account_accountant_bank_rec_widget", {
steps: () => [
stepUtils.showAppsMenuItem(),
...accountTourSteps.goToAccountMenu("Open the accounting module"),
{
content: "Open the bank reconciliation widget",
trigger: "a.oe_kanban_action span:contains('Bank')",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_kanban_renderer",
},
{
content: "Create New statement",
trigger: "button.o-kanban-button-new",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_quick_create",
},
{
content: "Write Label",
trigger: "div[name='payment_ref'] input",
run: "edit test",
},
{
content: "Add a amount",
trigger: "div[name='amount'] input",
run: "edit 100",
},
{
content: "Save & close",
trigger: "div.button_group button.o_kanban_edit",
run: "click",
},
{
content: "Statement is created",
trigger: "div[name='bank_statement_line']",
},
{
content: "Unfold statement line",
trigger: "div[name='bank_statement_line']",
run: "click",
},
{
content: "line is unfolded",
trigger: "div.o_button_line",
},
{
content: "Set Partner",
trigger: "button.set-partner-btn",
run: "click",
},
{
content: "Search view is opened",
trigger: "div.modal-dialog",
},
{
content: "Select first partner",
trigger: "tbody > tr > td[name='display_name']",
run: "click",
},
{
content: "Partner is set",
trigger: "span[name='statement_line_partner_name']",
},
{
content: "Fold statement line",
trigger: "div[name='bank_statement_line']",
run: "click",
},
{
content: "Statement line is reconciled because move with same partner and amount",
trigger: "div[name='reconciled_line_name']",
},
{
content: "Create New statement",
trigger: "button.o-kanban-button-new",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_quick_create",
},
{
content: "Write Label",
trigger: "div[name='payment_ref'] input",
run: "edit test",
},
{
content: "Add a amount",
trigger: "div[name='amount'] input",
run: "edit 150",
},
{
content: "Save & close",
trigger: "div.button_group button.o_kanban_edit",
run: "click",
},
{
content: "Open Ellipsis button",
trigger: "button.btn-secondary i[data-icon='more_vert']",
run: "click",
},
{
content: "Reconcile button",
trigger: "span.btn-link:contains('Reconcile')",
run: "click",
},
{
content: "Search view is opened",
trigger: "div.modal-dialog",
},
{
content: "Select first move line",
trigger: "tbody > tr > td[name='partner_id']",
run: "click",
},
{
content: "Statement line is reconciled",
trigger: "div[name='reconciled_line_name']",
},
// ensure statement can be added for multiple statement lines at once
{
content: "Switch to list view",
trigger: "button.o_switch_view.o_list",
run: "click",
},
{
content: "Select the statement lines",
trigger: "div.o-checkbox",
run: "click",
},
{
content: "Open the Many2One to set statement",
trigger: "td.o_bank_rec_list_many2one_multi_id_cell",
run: "click",
},
{
content: "Search for the created statement",
trigger: "input.o-autocomplete--input",
run: "click",
},
{
content: "Select the created statement",
trigger: "a.dropdown-item:contains('test')",
run: "click",
},
{
content: "Update setting statement on both lines",
trigger: "button.btn-primary:contains('Update')",
run: "click",
},
],
});
registry.category("web_tour.tours").add("account_accountant_set_partner_with_child_contact", {
steps: () => [
stepUtils.showAppsMenuItem(),
...accountTourSteps.goToAccountMenu("Open the accounting module"),
{
content: "Open the bank reconciliation widget",
trigger: "a.oe_kanban_action span:contains('Bank')",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_kanban_renderer",
},
{
content: "Create New statement",
trigger: "button.o-kanban-button-new",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_quick_create",
},
{
content: "Write Label",
trigger: "div[name='payment_ref'] input",
run: "edit test",
},
{
content: "Add a amount",
trigger: "div[name='amount'] input",
run: "edit 100",
},
{
content: "Save & close",
trigger: "div.button_group button.o_kanban_edit",
run: "click",
},
{
content: "Statement is created",
trigger: "div[name='bank_statement_line']",
},
{
content: "Set Partner",
trigger: "button.set-partner-btn",
run: "click",
},
{
content: "Search view is opened",
trigger: "div.modal-dialog",
},
{
content: "Select partner",
trigger: "body:not(:has(tbody > tr > td[name='display_name']:contains('test child contact')))",
},
]
});
registry.category("web_tour.tours").add("account_accountant_bank_reconciliation_ui_context_keys", {
steps: () => [
{
trigger: "div.o_bank_reconciliation_kanban_renderer",
},
{
content: "Create New statement",
trigger: "button.o-kanban-button-new",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_quick_create",
},
{
content: "Write Label",
trigger: "div[name='payment_ref'] input",
run: "edit test",
},
{
content: "Add a amount",
trigger: "div[name='amount'] input",
run: "edit 100",
},
{
content: "Save & close",
trigger: "div.button_group button.o_kanban_edit",
run: "click",
},
{
content: "Statement is created",
trigger: "div[name='bank_statement_line']",
},
{
content: "Statement line is reconciled",
trigger: "div[name='reconciled_line_name']",
},
{
content: "Upload button is not shown for a synchronized journal (Kanban View)",
trigger: "div.o_control_panel_main_buttons:not(:has(.o_button_upload_bill))",
},
{
content: "Switch to List View",
trigger: "button.o_switch_view.o_list",
run: "click",
},
{
content: "Upload button is not shown for a synchronized journal (List View)",
trigger: "div.o_control_panel_main_buttons:not(:has(.o_button_upload_bill))",
},
]
});

View File

@@ -0,0 +1,53 @@
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
import { accountTourSteps } from "@account/js/tours/account";
registry
.category("web_tour.tours")
.add("account_accountant_bank_reconciliation_widget_reload_activies_when_add_a_new_one", {
steps: () => [
stepUtils.showAppsMenuItem(),
...accountTourSteps.goToAccountMenu("Open the accounting module"),
{
content: "Open the bank reconciliation widget",
trigger: "a.oe_kanban_action span:contains('Bank')",
run: "click",
},
{
trigger: "div.o_bank_reconciliation_kanban_renderer",
},
{
content: "Select statement line",
trigger: "div[name='bank_statement_line']",
run: "click",
},
{
content: "Open chatter",
trigger: "i.oi.oi-lg[data-icon='forum']:not(:visible)",
run: "click",
},
{
content: "Chatter is opened",
trigger: "div.o_bank_rec_widget_chatter_container",
},
{
content: "Create an activity",
trigger: "button.o-mail-Chatter-activity",
run: "click",
},
{
content: "Dialog activity is opened",
trigger: "h4.modal-title:contains('Schedule Activity')",
},
{
content: "Validate default activity",
trigger: "button[name='action_schedule_activities']",
run: "click",
},
{
content: "Activity is reloaded in the widget",
trigger: "div.activity-container > i.oi.oi-lg[data-icon='schedule']",
},
],
});

View File

@@ -0,0 +1,50 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
import { accountTourSteps } from "@account/js/tours/account";
registry.category("web_tour.tours").add("account_accountant_journal_items_export", {
steps: () => [
stepUtils.showAppsMenuItem(),
...accountTourSteps.goToAccountMenu("Open the accounting module"),
{
content: "Open journal items list view",
trigger: 'button[data-menu-xmlid="account.menu_finance_entries"]',
run: "click",
},
{
content: "Open journal items list view",
trigger: 'a[data-menu-xmlid="account.menu_action_account_moves_all"]',
run: "click",
},
{
content: "Select all items",
trigger: 'thead tr th.o_list_record_selector',
run: "click",
},
{
content: "Open export dialog",
trigger: 'i[data-icon="more_vert"]',
run: "click",
},
{
content: "Open export dialog",
trigger: 'i[data-icon="upload"]',
run: "click",
},
{
content: "Click on the cancel button",
trigger: 'button.o_form_button_cancel',
run: "click",
},
// End
...stepUtils.toggleHomeMenu(),
...accountTourSteps.goToAccountMenu("Reset back to accounting module"),
{
content: "check that we're back on the dashboard",
trigger: 'a:contains("Sales")',
},
],
});

View File

@@ -0,0 +1,66 @@
import { expect, test } from "@odoo/hoot";
import {
contains,
defineModels,
fields,
models,
mountView,
onRpc,
} from "@web/../tests/web_test_helpers";
import { mailModels } from "@mail/../tests/mail_test_helpers";
class AccountBankStatementLine extends models.Model {
transaction_details = fields.Json();
_records = [
{
id: 1,
transaction_details: {
name: "Downpayment for your services",
amount: 350,
status: "posted",
identifier: "cb38d10c-4c93-41c7-bbbb-e0f57745cf0a",
counter_part: { name: "Azure Interior" },
is_zero_balancing: false,
},
},
];
}
defineModels({ ...mailModels, AccountBankStatementLine });
test.tags("desktop");
test("Check Formatted Transactions Details Widget on Desktop", async () => {
onRpc(
"account.bank.statement.line",
"format_transaction_details",
() => {
return "<div><pre><b>name:</b> Downpayment for your services\n<b>amount:</b> 350.0\n<b>status:</b> posted\n<b>identifier:</b> cb38d10c-4c93-41c7-bbbb-e0f57745cf0a\n<b>counter_part:</b> \n <b>name:</b> Azure Interior\n<b>is_zero_balancing:</b> False\n</pre></div>";
}
);
await mountView({
type: "list",
resModel: "account.bank.statement.line",
arch: `
<list>
<field name="transaction_details" widget="formatted_transaction_details"/>
</list>`,
resId: 1,
});
// no popover by default
expect(".popover-content-wrapper").toHaveCount(0);
// hover over search icon to see if popover appears
await contains(".o_field_formatted_transaction_details [data-icon='search']").hover();
expect(".popover-content-wrapper").toHaveCount(1);
// the output should be expected markup formatted
expect(".popover-content-wrapper").toHaveText("name: Downpayment for your services\namount: 350.0\nstatus: posted\nidentifier: cb38d10c-4c93-41c7-bbbb-e0f57745cf0a\ncounter_part: \n name: Azure Interior\nis_zero_balancing: False");
// hover over popover to check that it still stays open
await contains(".popover-content-wrapper").hover();
expect(".popover-content-wrapper").toHaveCount(1);
});