[IMP] *: add properties to several models and display them in cards
### 1. Add properties to various models This PR adds properties (and related properties definitions) to the following models: - hr.employee (hr.res_company) - hr_recruitment.hr_applicant (hr_recruitment.hr_job) - product.product (product.category) - stock.picking (stock.picking_type) These have been added to the related form, kanban and calendar views when applicable. Properties have also been added to kanban and calendar views of - crm.lead - event.event - project.task ### 2. Remove "hideKanbanOption" This PR removes the "hideKanbanOption" from the properties field. This option allowed to prevent users to make properties visible on cards (kanban cards and calendar popovers). The rationale being that there is no reason to prevent users of adding properties on cards now that [they have been redesigned](https://github.com/odoo/odoo/commit/25e8fbe0a1327c289df826cf6eb7882098a4c325). Task-3458627 closes odoo/odoo#132578 Related: odoo/upgrade#5196 Related: odoo/enterprise#46043 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -252,7 +252,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<div class="d-flex">
|
||||
<field name="lead_properties" nolabel="1" columns="2" hideKanbanOption="1"/>
|
||||
<field name="lead_properties" nolabel="1" columns="2"/>
|
||||
</div>
|
||||
<notebook>
|
||||
<page string="Internal Notes" name="internal_notes">
|
||||
@@ -440,6 +440,8 @@
|
||||
<field name="expected_revenue"/>
|
||||
<field name="partner_id" avatar_field="avatar_128"/>
|
||||
<field name="user_id" filters="1" invisible="1"/>
|
||||
<field name="team_id" invisible="1"/>
|
||||
<field name="lead_properties"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
@@ -553,6 +555,7 @@
|
||||
<field name="activity_state" />
|
||||
<field name="activity_ids" />
|
||||
<field name="recurring_revenue_monthly"/>
|
||||
<field name="team_id"/>
|
||||
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'
|
||||
sum_field="expected_revenue" recurring_revenue_sum_field="recurring_revenue_monthly"
|
||||
help="This bar allows to filter the opportunities based on scheduled activities."/>
|
||||
@@ -590,6 +593,9 @@
|
||||
<div>
|
||||
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
</div>
|
||||
<div>
|
||||
<field name="lead_properties" widget="properties"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_kanban_footer">
|
||||
<div class="o_kanban_record_bottom">
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<field name="utm_source_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="registration_properties" columns="2" hideKanbanOption="1"/>
|
||||
<field name="registration_properties" columns="2"/>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids"/>
|
||||
@@ -165,6 +165,7 @@
|
||||
</span>
|
||||
<span class="o_text_overflow" invisible="not partner_id">Booked by <field name="partner_id" /></span>
|
||||
<div id="event_ticket_id" class="o_field_many2many_tags o_field_widget d-flex mt-auto align-items-center">
|
||||
<field name="registration_properties"/>
|
||||
<t t-if="record.event_ticket_id.raw_value">
|
||||
<i class="fa fa-ticket" title="Ticket type"/>
|
||||
<b><span class="o_badge_text o_text_overflow ms-1"><t t-out="record.event_ticket_id.value"/></span></b>
|
||||
@@ -193,6 +194,7 @@
|
||||
<calendar date_start="event_begin_date" date_stop="event_end_date" string="Event Registration" color="event_id" event_limit="5">
|
||||
<field name="event_id" filters="1"/>
|
||||
<field name="name"/>
|
||||
<field name="registration_properties"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -111,9 +111,7 @@
|
||||
<field name="location"/>
|
||||
</group>
|
||||
</group>
|
||||
<div class="d-flex">
|
||||
<field name="vehicle_properties" nolabel="1" columns="2" hideKanbanOption="1"/>
|
||||
</div>
|
||||
<field name="vehicle_properties" columns="2"/>
|
||||
<notebook>
|
||||
<page string="Tax Info">
|
||||
<group>
|
||||
@@ -301,6 +299,9 @@
|
||||
<li>
|
||||
<t t-if="record.location.raw_value"><small><i class="fa fa-map-marker" title="Location"></i> <field name="location"/></small></t>
|
||||
</li>
|
||||
<li>
|
||||
<field name="vehicle_properties" widget="properties"/>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="o_kanban_record_bottom" t-if="!selection_mode">
|
||||
<div class="oe_kanban_bottom_left">
|
||||
|
||||
@@ -139,6 +139,8 @@ class HrEmployeePrivate(models.Model):
|
||||
driving_license = fields.Binary(string="Driving License", groups="hr.group_hr_user")
|
||||
private_car_plate = fields.Char(groups="hr.group_hr_user", help="If you have more than one car, just separate the plates by a space.")
|
||||
currency_id = fields.Many2one('res.currency', related='company_id.currency_id', readonly=True)
|
||||
# properties
|
||||
employee_properties = fields.Properties('Properties', definition='company_id.employee_properties_definition', precompute=False)
|
||||
|
||||
_sql_constraints = [
|
||||
('barcode_uniq', 'unique (barcode)', "The Badge ID must be unique, this one is already assigned to another employee."),
|
||||
|
||||
@@ -9,3 +9,4 @@ class Company(models.Model):
|
||||
|
||||
hr_presence_control_email_amount = fields.Integer(string="# emails to send")
|
||||
hr_presence_control_ip_list = fields.Char(string="Valid IP addresses")
|
||||
employee_properties_definition = fields.PropertiesDefinition('Employee Properties')
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
<field name="coach_id" widget="many2one_avatar_user"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="employee_properties" columns="2"/>
|
||||
<notebook>
|
||||
<page name="public" string="Work Information">
|
||||
<div id="o_work_employee_container" class="d-lg-flex"> <!-- These two div are used to position org_chart -->
|
||||
@@ -274,6 +275,7 @@
|
||||
<field name="hr_icon_display"/>
|
||||
<field name="show_hr_icon_display"/>
|
||||
<field name="image_128" />
|
||||
<field name="company_id"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_hr_kanban_record">
|
||||
@@ -301,6 +303,9 @@
|
||||
<i class="fa fa-fw me-2 fa-phone text-primary" title="Phone"/>
|
||||
<field name="work_phone" />
|
||||
</li>
|
||||
<li>
|
||||
<field name="employee_properties" widget="properties"/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="oe_kanban_content o_hr_employee_kanban_bottom position-absolute bottom-0 start-0 end-0">
|
||||
|
||||
@@ -111,6 +111,7 @@ class Applicant(models.Model):
|
||||
('refused', 'Refused'),
|
||||
('archived', 'Archived'),
|
||||
], compute="_compute_application_status")
|
||||
applicant_properties = fields.Properties('Properties', definition='job_id.applicant_properties_definition', copy=True)
|
||||
|
||||
@api.onchange('job_id')
|
||||
def _onchange_job_id(self):
|
||||
|
||||
@@ -56,6 +56,8 @@ class Job(models.Model):
|
||||
activities_overdue = fields.Integer(compute='_compute_activities')
|
||||
activities_today = fields.Integer(compute='_compute_activities')
|
||||
|
||||
applicant_properties_definition = fields.PropertiesDefinition('Applicant Properties')
|
||||
|
||||
@api.depends_context('uid')
|
||||
def _compute_activities(self):
|
||||
self.env.cr.execute("""
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
<field name="applicant_properties" columns="2"/>
|
||||
<notebook>
|
||||
<page string="Application Summary" name="application_summary">
|
||||
<field name="description" placeholder="Motivations..."/>
|
||||
@@ -288,6 +289,7 @@
|
||||
<field name="priority" widget="priority"/>
|
||||
<field name="activity_summary"/>
|
||||
<field name="user_id" filters="1" invisible="1"/>
|
||||
<field name="applicant_properties"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
@@ -366,6 +368,7 @@
|
||||
</div>
|
||||
<field name="categ_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<t t-if="record.partner_mobile.raw_value"><i class="fa fa-mobile mr4" role="img" aria-label="Mobile" title="Mobile"/><field name="partner_mobile" widget="phone"/><br/></t>
|
||||
<field name="applicant_properties" widget="properties"/>
|
||||
<div class="o_kanban_record_bottom mt4">
|
||||
<div class="oe_kanban_bottom_left">
|
||||
<div class="float-start mr4" groups="base.group_user">
|
||||
|
||||
@@ -23,6 +23,7 @@ class ProductCategory(models.Model):
|
||||
product_count = fields.Integer(
|
||||
'# Products', compute='_compute_product_count',
|
||||
help="The number of products under this category (Does not consider the children categories)")
|
||||
product_properties_definition = fields.PropertiesDefinition('Product Properties')
|
||||
|
||||
@api.depends('name', 'parent_id.complete_name')
|
||||
def _compute_complete_name(self):
|
||||
|
||||
@@ -101,6 +101,8 @@ class ProductProduct(models.Model):
|
||||
image_128 = fields.Image("Image 128", compute='_compute_image_128')
|
||||
can_image_1024_be_zoomed = fields.Boolean("Can Image 1024 be zoomed", compute='_compute_can_image_1024_be_zoomed')
|
||||
write_date = fields.Datetime(compute='_compute_write_date', store=True)
|
||||
# Properties
|
||||
product_properties = fields.Properties('Properties', definition='categ_id.product_properties_definition', copy=True)
|
||||
|
||||
@api.depends('image_variant_1920', 'image_variant_1024')
|
||||
def _compute_can_image_variant_1024_be_zoomed(self):
|
||||
|
||||
@@ -428,6 +428,9 @@
|
||||
<field name="product_tag_ids" position="after">
|
||||
<field name="additional_product_tag_ids" widget="many2many_tags"/>
|
||||
</field>
|
||||
<notebook position="before">
|
||||
<field name="product_properties" columns="2"/>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -440,6 +443,7 @@
|
||||
<field name="lst_price"/>
|
||||
<field name="activity_state"/>
|
||||
<field name="color"/>
|
||||
<field name="categ_id"/>
|
||||
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
@@ -464,6 +468,7 @@
|
||||
Price: <field name="lst_price"></field>
|
||||
</div>
|
||||
<div name="tags"/>
|
||||
<field name="product_properties" widget="properties"/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -371,9 +371,7 @@
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
<div class="d-flex">
|
||||
<field name="task_properties" nolabel="1" columns="2" hideKanbanOption="1"/>
|
||||
</div>
|
||||
<field name="task_properties" columns="2"/>
|
||||
<notebook>
|
||||
<page name="description_page" string="Description">
|
||||
<field name="description" type="html" options="{'collaborative': true, 'resizable': false}" placeholder="Add details about this task..."/>
|
||||
@@ -616,6 +614,7 @@
|
||||
<div t-if="record.date_deadline.raw_value" name="date_deadline" invisible="state in ['1_done', '1_canceled']">
|
||||
<field name="date_deadline" widget="remaining_days"/>
|
||||
</div>
|
||||
<field name="task_properties" widget="properties"/>
|
||||
<div t-if="record.displayed_image_id.value">
|
||||
<field name="displayed_image_id" widget="attachment_image"/>
|
||||
</div>
|
||||
@@ -762,6 +761,7 @@
|
||||
<field name="stage_id" invisible="not project_id or not stage_id"/>
|
||||
<field name="state" widget="project_task_state_selection" readonly="1"/>
|
||||
<field name="personal_stage_id" string="Personal Stage" invisible="project_id or not personal_stage_id"/>
|
||||
<field name="task_properties"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
'data/stock_data.xml',
|
||||
'data/stock_sequence_data.xml',
|
||||
'data/stock_traceability_report_data.xml',
|
||||
'data/ir_actions_client_data.xml',
|
||||
|
||||
'report/report_stock_quantity.xml',
|
||||
'report/report_stock_reception.xml',
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<record id="stock_lot_action_configure_properties_field" model="ir.actions.client">
|
||||
<field name="name">Add Properties</field>
|
||||
<field name="res_model">stock.lot</field>
|
||||
<field name="tag">action_configure_properties_field</field>
|
||||
<field name="binding_model_id" ref="stock.model_stock_lot"/>
|
||||
<field name="binding_view_types">form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -105,6 +105,8 @@ class PickingType(models.Model):
|
||||
" * Never: remaining products are cancelled")
|
||||
show_picking_type = fields.Boolean(compute='_compute_show_picking_type')
|
||||
|
||||
picking_properties_definition = fields.PropertiesDefinition("Picking Properties")
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
@@ -486,6 +488,11 @@ class Picking(models.Model):
|
||||
show_set_qty_button = fields.Boolean(compute='_compute_show_qty_button')
|
||||
show_clear_qty_button = fields.Boolean(compute='_compute_show_qty_button')
|
||||
|
||||
picking_properties = fields.Properties(
|
||||
'Properties',
|
||||
definition='picking_type_id.picking_properties_definition',
|
||||
copy=True)
|
||||
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique(name, company_id)', 'Reference must be unique per company!'),
|
||||
]
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<field name="origin"/>
|
||||
<field name="picking_type_id"/>
|
||||
<field name="state"/>
|
||||
<field name="picking_properties"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
@@ -40,6 +41,7 @@
|
||||
<field name="state"/>
|
||||
<field name="scheduled_date"/>
|
||||
<field name="activity_state"/>
|
||||
<field name="picking_type_id"/>
|
||||
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
@@ -53,6 +55,9 @@
|
||||
<field name="state" widget="label_selection" options="{'classes': {'draft': 'default', 'cancel': 'danger', 'waiting': 'warning', 'confirmed': 'warning', 'done': 'success'}}"/>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="o_kanban_record_body">
|
||||
<field name="picking_properties" widget="properties"/>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom">
|
||||
<div class="oe_kanban_bottom_left">
|
||||
<t t-esc="record.partner_id.value"/>
|
||||
@@ -257,6 +262,7 @@
|
||||
readonly="state in ['cancel', 'done']"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="picking_properties" columns="2"/>
|
||||
<notebook>
|
||||
<page string="Detailed Operations"
|
||||
name="detailed_operations"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { propertiesField, PropertiesField } from "./properties_field";
|
||||
|
||||
export class CardPropertiesField extends PropertiesField {
|
||||
static template = "web.CardPropertiesField";
|
||||
|
||||
async _checkDefinitionAccess() {
|
||||
// can not edit properties definition in cards
|
||||
this.state.canChangeDefinition = false;
|
||||
}
|
||||
}
|
||||
|
||||
export const cardPropertiesField = {
|
||||
...propertiesField,
|
||||
component: CardPropertiesField,
|
||||
};
|
||||
|
||||
registry.category("fields").add("calendar.properties", cardPropertiesField);
|
||||
registry.category("fields").add("kanban.properties", cardPropertiesField);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
.o_kanban_property_field {
|
||||
.o_card_property_field {
|
||||
max-width: 300px;
|
||||
font-size: 0.875rem;
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-name="web.KanbanPropertiesField">
|
||||
<div t-ref="properties" class="w-100 mt-2 fw-normal text-muted">
|
||||
<div class="o_kanban_property_field d-inline-flex flex-column justify-content-center align-items-start w-100 my-1"
|
||||
<t t-name="web.CardPropertiesField">
|
||||
<div t-ref="properties" class="w-100 fw-normal text-muted">
|
||||
<div class="o_card_property_field d-inline-flex flex-column justify-content-center align-items-start w-100 mb-1"
|
||||
t-foreach="propertiesList"
|
||||
t-as="propertyConfiguration"
|
||||
t-key="propertyConfiguration.name"
|
||||
t-if="propertyConfiguration.value and propertyConfiguration.view_in_kanban">
|
||||
t-if="propertyConfiguration.value and propertyConfiguration.view_in_cards">
|
||||
<!-- We purposefully hide 'Falsy' values such as a False boolean or a 0 value integer field. -->
|
||||
<div class="mw-100 text-truncate d-flex gap-2"
|
||||
t-att-class="{'border rounded-3 ps-2' : propertyConfiguration.type === 'boolean'}">
|
||||
@@ -1,20 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { propertiesField, PropertiesField } from "./properties_field";
|
||||
|
||||
export class KanbanPropertiesField extends PropertiesField {
|
||||
static template = "web.KanbanPropertiesField";
|
||||
|
||||
async _checkDefinitionAccess() {
|
||||
// can not edit properties definition in the kanban view
|
||||
this.state.canChangeDefinition = false;
|
||||
}
|
||||
}
|
||||
|
||||
export const kanbanPropertiesField = {
|
||||
...propertiesField,
|
||||
component: KanbanPropertiesField,
|
||||
};
|
||||
|
||||
registry.category("fields").add("kanban.properties", kanbanPropertiesField);
|
||||
@@ -31,7 +31,6 @@ export class PropertiesField extends Component {
|
||||
context: { type: Object, optional: true },
|
||||
columns: { type: Number, optional: true },
|
||||
showAddButton: { type: Boolean, optional: true },
|
||||
hideKanbanOption: { type: Boolean, optional: true },
|
||||
};
|
||||
|
||||
setup() {
|
||||
@@ -898,7 +897,6 @@ export class PropertiesField extends Component {
|
||||
isNewlyCreated: isNewlyCreated,
|
||||
propertyIndex: propertyIndex,
|
||||
propertiesSize: propertiesList.length,
|
||||
hideKanbanOption: this.props.hideKanbanOption,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -943,7 +941,6 @@ export const propertiesField = {
|
||||
context: dynamicInfo.context,
|
||||
columns: parseInt(attrs.columns || "1"),
|
||||
showAddButton: archParseBoolean(attrs.showAddButton),
|
||||
hideKanbanOption: archParseBoolean(attrs.hideKanbanOption),
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
width: 100%;
|
||||
// be sure that the property field can take zero height
|
||||
// in case no property exists
|
||||
display: block;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ export class PropertyDefinition extends Component {
|
||||
onViewInKanbanChange(newValue) {
|
||||
const propertyDefinition = {
|
||||
...this.state.propertyDefinition,
|
||||
view_in_kanban: newValue,
|
||||
view_in_cards: newValue,
|
||||
};
|
||||
this.props.onChange(propertyDefinition);
|
||||
this.state.propertyDefinition = propertyDefinition;
|
||||
@@ -401,7 +401,6 @@ PropertyDefinition.props = {
|
||||
canChangeDefinition: { type: Boolean, optional: true },
|
||||
checkDefinitionWriteAccess: { type: Function, optional: true },
|
||||
propertyDefinition: { optional: true },
|
||||
hideKanbanOption: { type: Boolean, optional: true },
|
||||
context: { type: Object },
|
||||
isNewlyCreated: { type: Boolean, optional: true },
|
||||
// index and number of properties, to hide the move arrows when needed
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
onChange.bind="onDefaultChange"
|
||||
/>
|
||||
</div>
|
||||
<div t-if="!props.hideKanbanOption and state.propertyDefinition.type !== 'separator'"
|
||||
<div t-if="state.propertyDefinition.type !== 'separator'"
|
||||
class="o_field_property_definition_kanban d-contents mb-3 mb-sm-0">
|
||||
<label t-att-for="getUniqueDomID('kanban')" class="o_form_label align-self-center text-900">
|
||||
Display in Cards
|
||||
@@ -164,7 +164,7 @@
|
||||
</label>
|
||||
<CheckBox
|
||||
id="getUniqueDomID('kanban')"
|
||||
value="props.propertyDefinition.view_in_kanban"
|
||||
value="props.propertyDefinition.view_in_cards"
|
||||
disabled="props.readonly"
|
||||
onChange.bind="onViewInKanbanChange"
|
||||
/>
|
||||
|
||||
@@ -4811,6 +4811,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
string: "My Char",
|
||||
type: "char",
|
||||
value: "hello",
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_2",
|
||||
@@ -4823,6 +4824,14 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
],
|
||||
value: "b",
|
||||
default: "c",
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_3",
|
||||
string: "Hidden Char",
|
||||
type: "char",
|
||||
value: "hidden",
|
||||
view_in_cards: false,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -4845,10 +4854,10 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
|
||||
await clickEvent(target, 1);
|
||||
assert.deepEqual(
|
||||
[...target.querySelectorAll(".o_popover [name='properties'] .o_property_field")].map(
|
||||
[...target.querySelectorAll(".o_popover [name='properties'] .o_card_property_field")].map(
|
||||
(el) => el.textContent
|
||||
),
|
||||
["My Charhello", "My SelectionB"]
|
||||
["hello", "B"]
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
string: "My Char",
|
||||
type: "char",
|
||||
value: "char value",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_2",
|
||||
@@ -187,7 +187,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
],
|
||||
value: "b",
|
||||
default: "c",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
],
|
||||
company_id: 37,
|
||||
@@ -201,7 +201,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
string: "My Char",
|
||||
type: "char",
|
||||
value: "char value",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_2",
|
||||
@@ -214,7 +214,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
],
|
||||
value: "c",
|
||||
default: "c",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_3",
|
||||
@@ -227,7 +227,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
string: "My Char 4",
|
||||
type: "char",
|
||||
value: "char value 4",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
],
|
||||
company_id: 37,
|
||||
@@ -264,7 +264,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
name: "property_1",
|
||||
string: "My Char",
|
||||
type: "char",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_2",
|
||||
@@ -276,7 +276,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
["c", "C"],
|
||||
],
|
||||
default: "c",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_3",
|
||||
@@ -287,7 +287,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
name: "property_4",
|
||||
string: "My Char 4",
|
||||
type: "char",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -1480,7 +1480,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
|
||||
// check second card
|
||||
const property3 = target.querySelector(
|
||||
".o_kanban_record:nth-child(2) .o_kanban_property_field:nth-child(3) span"
|
||||
".o_kanban_record:nth-child(2) .o_card_property_field:nth-child(3) span"
|
||||
);
|
||||
assert.notEqual(
|
||||
property3.innerText,
|
||||
@@ -1489,17 +1489,17 @@ QUnit.module("Fields", (hooks) => {
|
||||
);
|
||||
assert.equal(property3.innerText, "char value 4");
|
||||
const property1 = target.querySelector(
|
||||
".o_kanban_record:nth-child(2) .o_kanban_property_field:nth-child(1) span"
|
||||
".o_kanban_record:nth-child(2) .o_card_property_field:nth-child(1) span"
|
||||
);
|
||||
assert.equal(property1.innerText, "char value");
|
||||
const property2 = target.querySelector(
|
||||
".o_kanban_record:nth-child(2) .o_kanban_property_field:nth-child(2) span"
|
||||
".o_kanban_record:nth-child(2) .o_card_property_field:nth-child(2) span"
|
||||
);
|
||||
assert.equal(property2.innerText, "C");
|
||||
|
||||
// check first card
|
||||
const items = target.querySelectorAll(
|
||||
".o_kanban_record:nth-child(1) .o_kanban_property_field"
|
||||
".o_kanban_record:nth-child(1) .o_card_property_field"
|
||||
);
|
||||
assert.equal(items.length, 2);
|
||||
});
|
||||
@@ -1516,14 +1516,14 @@ QUnit.module("Fields", (hooks) => {
|
||||
string: "My Date",
|
||||
type: "date",
|
||||
value: "2019-01-01",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_2",
|
||||
string: "My DateTime",
|
||||
type: "datetime",
|
||||
value: "2019-01-01 10:00:00",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
],
|
||||
company_id: 37,
|
||||
@@ -1549,11 +1549,11 @@ QUnit.module("Fields", (hooks) => {
|
||||
|
||||
// check fifth card
|
||||
const property1 = target.querySelector(
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(1) span"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(1) span"
|
||||
);
|
||||
assert.equal(property1.innerText, "01/01/2019");
|
||||
const property2 = target.querySelector(
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(2) span"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(2) span"
|
||||
);
|
||||
assert.equal(property2.innerText, "01/01/2019 11:00:00");
|
||||
}
|
||||
@@ -1566,7 +1566,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
name: "property_integer",
|
||||
string: "My Integer",
|
||||
type: "integer",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
};
|
||||
serverData.models.company.records.push({
|
||||
id: 38,
|
||||
@@ -1633,35 +1633,35 @@ QUnit.module("Fields", (hooks) => {
|
||||
string: "My Integer",
|
||||
type: "integer",
|
||||
value: 12,
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_float",
|
||||
string: "My Float",
|
||||
type: "float",
|
||||
value: 12.2,
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_date",
|
||||
string: "My Date",
|
||||
type: "date",
|
||||
value: "2023-06-05",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_datetime",
|
||||
string: "My Datetime",
|
||||
type: "datetime",
|
||||
value: "2023-06-05 11:05:00",
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
{
|
||||
name: "property_checkbox",
|
||||
string: "My Checkbox",
|
||||
type: "boolean",
|
||||
value: true,
|
||||
view_in_kanban: true,
|
||||
view_in_cards: true,
|
||||
},
|
||||
],
|
||||
company_id: 37,
|
||||
@@ -1688,25 +1688,25 @@ QUnit.module("Fields", (hooks) => {
|
||||
// check for label in integer, float, date and datetime field
|
||||
assert.strictEqual(
|
||||
target.querySelector(
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(1) label"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(1) label"
|
||||
).innerText,
|
||||
"My Integer"
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.querySelector(
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(2) label"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(2) label"
|
||||
).innerText,
|
||||
"My Float"
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.querySelector(
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(3) label"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(3) label"
|
||||
).innerText,
|
||||
"My Date"
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.querySelector(
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(4) label"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(4) label"
|
||||
).innerText,
|
||||
"My Datetime"
|
||||
);
|
||||
@@ -1714,11 +1714,11 @@ QUnit.module("Fields", (hooks) => {
|
||||
//check that label and border class is present for checkbox field
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(5) .border"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(5) .border"
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.querySelector(
|
||||
".o_kanban_record:nth-child(5) .o_kanban_property_field:nth-child(5) label"
|
||||
".o_kanban_record:nth-child(5) .o_card_property_field:nth-child(5) label"
|
||||
).innerText,
|
||||
"My Checkbox"
|
||||
);
|
||||
|
||||
+1
-1
@@ -3803,7 +3803,7 @@ class PropertiesDefinition(Field):
|
||||
REQUIRED_KEYS = ('name', 'type')
|
||||
ALLOWED_KEYS = (
|
||||
'name', 'string', 'type', 'comodel', 'default',
|
||||
'selection', 'tags', 'domain', 'view_in_kanban',
|
||||
'selection', 'tags', 'domain', 'view_in_cards',
|
||||
)
|
||||
# those keys will be removed if the types does not match
|
||||
PROPERTY_PARAMETERS_MAP = {
|
||||
|
||||
Reference in New Issue
Block a user