Initial commit: Crm packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:49 +02:00
commit 21a345b5b9
654 changed files with 418312 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

@ -0,0 +1,42 @@
odoo.define('crm_iap_mine.generate_leads_steps', function (require) {
"use strict";
var tour = require('web_tour.tour');
const {Markup} = require('web.utils');
var core = require('web.core');
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');
},
}, {
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

@ -0,0 +1,27 @@
/** @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

@ -0,0 +1,29 @@
/** @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

@ -0,0 +1,22 @@
<?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>