odoo_partner_scrapper: get rid of broken static components, to be replaced by an action later
This commit is contained in:
parent
5390b6308e
commit
dec2e44c09
3 changed files with 11 additions and 102 deletions
|
|
@ -1,68 +0,0 @@
|
||||||
/** @odoo-module **/
|
|
||||||
|
|
||||||
import ListController from 'web.ListController';
|
|
||||||
import ListView from 'web.ListView';
|
|
||||||
|
|
||||||
import KanbanController from 'web.KanbanController';
|
|
||||||
import KanbanView from 'web.KanbanView';
|
|
||||||
|
|
||||||
const viewRegistry = require('web.view_registry');
|
|
||||||
|
|
||||||
const OdooScrapperListController = ListController.extend({
|
|
||||||
// buttons_template must match the t-name on the template for the button (static xml)
|
|
||||||
buttons_template: 'odoo_scrapper.list_view_buttons',
|
|
||||||
events: _.extend({}, ListController.prototype.events, {
|
|
||||||
'click .o_button_get_partner': '_onGetPartnerClick',
|
|
||||||
}),
|
|
||||||
// This may need to be async function() if there needs to be an await this._rpc({ ... }); call to not reload early
|
|
||||||
_onGetPartnerClick: function () {
|
|
||||||
this._rpc({
|
|
||||||
model: 'res.partner',
|
|
||||||
method: 'get_odoo_partner',
|
|
||||||
args: [],
|
|
||||||
}).then(() => {
|
|
||||||
this.reload();
|
|
||||||
});
|
|
||||||
// Couldn't test this for real, but it runs the action. May need a this.reload()
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const OdooScrapperListView = ListView.extend({
|
|
||||||
config: _.extend({}, ListView.prototype.config, {
|
|
||||||
Controller: OdooScrapperListController,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// key must match with the js_class attribute of the tree view you want to modify
|
|
||||||
viewRegistry.add('res_partner_odoo_scrapper_tree', OdooScrapperListView);
|
|
||||||
|
|
||||||
const OdooScrapperKanbanController = KanbanController.extend({
|
|
||||||
// buttons_template must match the t-name on the template for the button (static xml)
|
|
||||||
buttons_template: 'odoo_scrapper.kanban_view_buttons',
|
|
||||||
events: _.extend({}, KanbanController.prototype.events, {
|
|
||||||
'click .o_button_get_partner': '_onGetPartnerClick',
|
|
||||||
}),
|
|
||||||
// This may need to be async function() if there needs to be an await this._rpc({ ... }); call to not reload early
|
|
||||||
_onGetPartnerClick: function () {
|
|
||||||
this._rpc({
|
|
||||||
model: 'res.partner',
|
|
||||||
method: 'get_odoo_partner',
|
|
||||||
args: [],
|
|
||||||
}).then(() => {
|
|
||||||
this.reload();
|
|
||||||
});
|
|
||||||
// Couldn't test this for real, but it runs the action. May need a this.reload()
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const OdooScrapperKanbanView = KanbanView.extend({
|
|
||||||
config: _.extend({}, KanbanView.prototype.config, {
|
|
||||||
Controller: OdooScrapperKanbanController,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// key must match with the js_class attribute of the tree view you want to modify
|
|
||||||
viewRegistry.add('res_partner_odoo_scrapper_kanban', OdooScrapperKanbanView);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<templates id="template" xml:space="preserve">
|
|
||||||
|
|
||||||
<t t-extend="ListView.buttons" t-name="odoo_scrapper.list_view_buttons"> <!-- t-name must match with js controller button template -->
|
|
||||||
<t t-jquery="button.o_list_button_add" t-operation="after">
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-primary ml4 o_button_get_partner"
|
|
||||||
title="Get Odoo Partner"> Get Odoo Partner </button>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
<t t-extend="KanbanView.buttons" t-name="odoo_scrapper.kanban_view_buttons">
|
|
||||||
<t t-jquery="button" t-operation="after">
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-primary ml4 o_button_get_partner"
|
|
||||||
title="Get Odoo Partner"> Get Odoo Partner </button>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
</templates>
|
|
||||||
|
|
@ -8,19 +8,22 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="company_type" position="after">
|
<field name="company_type" position="after">
|
||||||
<br/>
|
<br/>
|
||||||
<field name="is_odoo_user"/>Odoo User
|
<field name="is_odoo_user"/>
|
||||||
<field name="is_odoo_partner"/>Odoo Partner
|
Odoo User
|
||||||
|
<field name="is_odoo_partner"/>
|
||||||
|
Odoo Partner
|
||||||
<br/>
|
<br/>
|
||||||
<div invisible="is_odoo_partner == False">
|
<div invisible="is_odoo_partner == False">
|
||||||
<h3><field name="odoo_partner_type"/> Partner</h3>
|
<h3>
|
||||||
|
<field name="odoo_partner_type"/>
|
||||||
|
Partner</h3>
|
||||||
</div>
|
</div>
|
||||||
</field>
|
</field>
|
||||||
<group name="container_row_2" position="after">
|
<group name="container_row_2" position="after">
|
||||||
<group name="container_row_3">
|
<group name="container_row_3">
|
||||||
<field name="relation_all_ids">
|
<field name="relation_all_ids">
|
||||||
<list>
|
<list>
|
||||||
<field name="other_partner_id" required="True" options="{'no_create': True}"
|
<field name="other_partner_id" required="True" options="{'no_create': True}" string="Customer" domain="[['relation_all_ids.type_selection_id.id', '=', 1]]"/>
|
||||||
string="Customer" domain="[['relation_all_ids.type_selection_id.id', '=', 1]]"/>
|
|
||||||
<field name="date_start"/>
|
<field name="date_start"/>
|
||||||
<field name="date_end"/>
|
<field name="date_end"/>
|
||||||
<field name="active" invisible="1"/>
|
<field name="active" invisible="1"/>
|
||||||
|
|
@ -38,9 +41,6 @@
|
||||||
<field name="model">res.partner</field>
|
<field name="model">res.partner</field>
|
||||||
<field name="inherit_id" ref="base.view_partner_tree"/>
|
<field name="inherit_id" ref="base.view_partner_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//list" position="attributes">
|
|
||||||
<attribute name="js_class">res_partner_odoo_scrapper_tree</attribute>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//list" position="inside">
|
<xpath expr="//list" position="inside">
|
||||||
<field name="is_odoo_user"/>
|
<field name="is_odoo_user"/>
|
||||||
<field name="is_odoo_partner"/>
|
<field name="is_odoo_partner"/>
|
||||||
|
|
@ -54,20 +54,17 @@
|
||||||
<field name="model">res.partner</field>
|
<field name="model">res.partner</field>
|
||||||
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//kanban" position="attributes">
|
|
||||||
<attribute name="js_class">res_partner_odoo_scrapper_kanban</attribute>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//kanban" position="inside">
|
<xpath expr="//kanban" position="inside">
|
||||||
<field name="odoo_partner_type"/>
|
<field name="odoo_partner_type"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//div[hasclass('oe_kanban_global_click') and hasclass('o_kanban_record_has_image_fill') and hasclass('o_res_partner_kanban')]" position="attributes">
|
<xpath expr="//div[hasclass('o_kanban_image_fill')]" position="attributes">
|
||||||
<attribute name="t-attf-class">oe_kanban_global_click o_kanban_record_has_image_fill o_res_partner_kanban oe_kanban_color_#{record.color}</attribute>
|
<attribute name="t-attf-class">oe_kanban_global_click o_kanban_record_has_image_fill o_res_partner_kanban oe_kanban_color_#{record.color}</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//strong[hasclass('o_kanban_record_title') and hasclass('oe_partner_heading')]" position="before">
|
<field name="display_name" position="before">
|
||||||
<strong t-if="record.odoo_partner_type.raw_value" class="o_kanban_record_subtitle oe_partner_heading">
|
<strong t-if="record.odoo_partner_type.raw_value" class="o_kanban_record_subtitle oe_partner_heading">
|
||||||
<field name="odoo_partner_type"/>
|
<field name="odoo_partner_type"/>
|
||||||
</strong>
|
</strong>
|
||||||
</xpath>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue