19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:53 +01:00
parent dc68f80d3f
commit 7221b9ac46
610 changed files with 135477 additions and 161677 deletions

View file

@ -1,42 +1,53 @@
odoo.define('crm_iap_mine.generate_leads_steps', function (require) {
"use strict";
import { registry } from "@web/core/registry";
import { _t } from "@web/core/l10n/translation";
import "@crm/js/tours/crm";
import { patch } from "@web/core/utils/patch";
var tour = require('web_tour.tour');
const {Markup} = require('web.utils');
var core = require('web.core');
import { markup } from "@odoo/owl";
require('@crm/js/tours/crm');
var _t = core._t;
var DragOppToWonStepIndex = _.findIndex(tour.tours.crm_tour.steps, function (step) {
return (step.id === 'drag_opportunity_to_won_step');
});
tour.tours.crm_tour.steps.splice(DragOppToWonStepIndex + 1, 0, {
/**
* Add some steps between "Drag your opportunity to <b>Won</b> when you get
* the deal. Congrats !" and "Lets have a look at an Opportunity." to
* include the steps related to the lead generation (crm_iap_mine).
* This eases the on boarding for the Lead Generation process.
*
*/
trigger: ".o_button_generate_leads",
content: Markup(_t("Looking for more opportunities ?<br>Try the <b>Lead Generation</b> tool.")),
position: "bottom",
run: function (actions) {
actions.auto('.o_button_generate_leads');
patch(registry.category("web_tour.tours").get("crm_tour"), {
steps() {
const originalSteps = super.steps();
const DragOppToWonStepIndex = originalSteps.findIndex(
(step) => step.id === "drag_opportunity_to_won_step"
);
originalSteps.splice(
DragOppToWonStepIndex + 1,
0,
{
/**
* Add some steps between "Drag your opportunity to <b>Won</b> when you get
* the deal. Congrats!" and "Lets have a look at an Opportunity." to
* include the steps related to the lead generation (crm_iap_mine).
* This eases the on boarding for the Lead Generation process.
*
*/
trigger: ".o_button_generate_leads",
content: markup(_t("Looking for more opportunities?<br>Try the <b>Lead Generation</b> tool.")),
tooltipPosition: "bottom",
run: "click .o_button_generate_leads",
},
{
trigger: ".modal-body .o_industry",
content: _t("Which Industry do you want to target?"),
tooltipPosition: "right",
run: "click",
},
{
isActive: ["manual"],
trigger: ".modal-footer button[name=action_submit]",
content: _t("Now, just let the magic happen!"),
tooltipPosition: "bottom",
run: "click",
},
{
isActive: ["auto"],
trigger: ".modal-footer button[special=cancel]",
content: _t("Now, just let the magic happen!"),
tooltipPosition: "bottom",
run: "click",
}
);
return originalSteps;
},
}, {
trigger: '.modal-body .o_industry',
content: _t("Which Industry do you want to target?"),
position: "right",
}, {
trigger: '.modal-footer button[name=action_submit]',
content: _t("Now, just let the magic happen!"),
position: "bottom",
run: function (actions) {
actions.auto('.modal-footer button[special=cancel]');
}
});
});

View file

@ -1,27 +0,0 @@
/** @odoo-module **/
import { useService } from "@web/core/utils/hooks";
const { onWillStart, useComponent } = owl;
export function useGenerateLeadsButton() {
const component = useComponent();
const user = useService("user");
const action = useService("action");
onWillStart(async () => {
component.isSalesManager = await user.hasGroup("sales_team.group_sale_manager");
});
component.onClickGenerateLead = () => {
const leadType = component.props.context.default_type;
action.doAction({
name: "Generate Leads",
type: "ir.actions.act_window",
res_model: "crm.iap.lead.mining.request",
target: "new",
views: [[false, "form"]],
context: { is_modal: true, default_lead_type: leadType },
});
};
}

View file

@ -1,29 +0,0 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { patch } from "@web/core/utils/patch";
import { useGenerateLeadsButton } from "@crm_iap_mine/views/generate_leads_hook";
import { crmKanbanView } from "@crm/views/crm_kanban/crm_kanban_view";
import { ListController } from "@web/views/list/list_controller";
import { listView } from "@web/views/list/list_view";
export class LeadMiningRequestListController extends ListController {
setup() {
super.setup();
useGenerateLeadsButton();
}
}
registry.category("views").add("crm_iap_lead_mining_request_tree", {
...listView,
Controller: LeadMiningRequestListController,
buttonTemplate: "LeadMiningRequestListView.buttons",
});
patch(crmKanbanView.Controller.prototype, "crm_iap_lead_mining_request_kanban", {
setup() {
this._super(...arguments);
useGenerateLeadsButton();
},
});
crmKanbanView.buttonTemplate = "LeadMiningRequestKanbanView.buttons";

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="LeadMiningRequest.generate_leads_button" owl="1">
<button t-if="isSalesManager" type="button" class="btn btn-secondary o_button_generate_leads" t-on-click="onClickGenerateLead">
Generate Leads
</button>
</t>
<t t-name="LeadMiningRequestListView.buttons" t-inherit="web.ListView.Buttons" t-inherit-mode="primary" owl="1">
<!-- Before the export button -->
<xpath expr="//t[contains(@t-if, 'isExportEnable')]" position="before">
<t t-call="LeadMiningRequest.generate_leads_button"/>
</xpath>
</t>
<t t-name="LeadMiningRequestKanbanView.buttons" t-inherit="web.KanbanView.Buttons" t-inherit-mode="primary" owl="1">
<xpath expr="//div[@t-if='props.showButtons']" position="inside">
<t t-call="LeadMiningRequest.generate_leads_button"/>
</xpath>
</t>
</templates>