Eliminate Python dependency: embed frontend assets in odoo-go
- Copy all OWL frontend assets (JS/CSS/XML/fonts/images) into frontend/ directory (2925 files, 43MB) — no more runtime reads from Python Odoo - Replace OdooAddonsPath config with FrontendDir pointing to local frontend/ - Rewire bundle.go, static.go, templates.go, webclient.go to read from frontend/ instead of external Python Odoo addons directory - Auto-detect frontend/ and build/ dirs relative to binary in main.go - Delete obsolete Python helper scripts (tools/*.py) The Go server is now fully self-contained: single binary + frontend/ folder. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
43
frontend/account/static/src/services/account_move_service.js
Normal file
43
frontend/account/static/src/services/account_move_service.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { markup } from "@odoo/owl";
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
export class AccountMoveService {
|
||||
constructor(env, services) {
|
||||
this.setup(env, services);
|
||||
}
|
||||
|
||||
setup(env, services) {
|
||||
this.env = env;
|
||||
this.action = services.action;
|
||||
this.dialog = services.dialog;
|
||||
this.orm = services.orm;
|
||||
}
|
||||
|
||||
async getDeletionDialogBody(body, moveIds) {
|
||||
const isMoveEndOfChain = await this.orm.call("account.move", "check_move_sequence_chain", [moveIds]);
|
||||
if (!isMoveEndOfChain) {
|
||||
const message = _t("This operation will create a gap in the sequence.");
|
||||
return markup`<div class="text-danger">${message}</div>${body}`;
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
async downloadPdf(accountMoveId, target = "download") {
|
||||
const downloadAction = await this.orm.call(
|
||||
"account.move",
|
||||
"action_invoice_download_pdf",
|
||||
[accountMoveId, target]
|
||||
);
|
||||
await this.action.doAction(downloadAction);
|
||||
}
|
||||
}
|
||||
|
||||
export const accountMoveService = {
|
||||
dependencies: ["action", "dialog", "orm"],
|
||||
start(env, services) {
|
||||
return new AccountMoveService(env, services);
|
||||
},
|
||||
};
|
||||
|
||||
registry.category("services").add("account_move", accountMoveService);
|
||||
@@ -0,0 +1,29 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
|
||||
export const accountNotificationService = {
|
||||
dependencies: ["bus_service", "notification", "action"],
|
||||
|
||||
start(env, { bus_service, notification, action }) {
|
||||
bus_service.subscribe("account_notification", ({ message, sticky, title, type, action_button}) => {
|
||||
const buttons = [{
|
||||
name: action_button.name,
|
||||
primary: false,
|
||||
onClick: () => {
|
||||
action.doAction({
|
||||
name: _t(action_button.action_name),
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: action_button.model,
|
||||
domain: [["id", "in", action_button.res_ids]],
|
||||
views: [[false, 'list'], [false, 'form']],
|
||||
target: 'current',
|
||||
});
|
||||
},
|
||||
}];
|
||||
notification.add(message, { sticky, title, type, buttons });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
registry.category("services").add("accountNotification", accountNotificationService);
|
||||
Reference in New Issue
Block a user