[IMP] * : generic improvements

[IMP] sale_timesheet: add domain on sales order field
==========================================

A domain has been added to the Sales Order field
on project task so that the task and the so have the same
commercial_partner_id.

[IMP] sale: add kanban view for sale.order.line for better display on mobile
=========================================================

For a SO line on mobile it was displaying only the name of the line without
the SO number. It wasn't very practical for the users so we added this view
to display the display_name instead.

[IMP] web: change the default name of a column in kanban view
=================================================

This changes the name of the column in kanban view when the records
are grouped by date. The column name of the records with no date
went from false to Undefined.

Task-2188831

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#45646

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Odoo's Mergebot
2020-02-28 11:24:49 +01:00
committed by GitHub
4 changed files with 27 additions and 3 deletions
+20
View File
@@ -1057,6 +1057,26 @@
</field>
</record>
<record id="sale_order_line_view_kanban" model="ir.ui.view">
<field name="name">sale.order.line.kanban</field>
<field name="model">sale.order.line</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_content oe_kanban_global_click">
<div class="row">
<div class="col-12">
<field name="display_name"/>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record model="ir.ui.view" id="product_form_view_sale_order_button">
<field name="name">product.product.sale.order</field>
<field name="model">product.product</field>
+2 -1
View File
@@ -160,7 +160,8 @@ class ProjectTask(models.Model):
_inherit = "project.task"
# override sale_order_id and make it computed stored field instead of regular field.
sale_order_id = fields.Many2one(compute='_compute_sale_order_id', store=True, readonly=False)
sale_order_id = fields.Many2one(compute='_compute_sale_order_id', store=True, readonly=False,
domain="['|', '|', ('partner_id', '=', partner_id), ('partner_id', 'child_of', commercial_partner_id), ('partner_id', 'parent_of', partner_id)]")
analytic_account_id = fields.Many2one('account.analytic.account', related='sale_order_id.analytic_account_id')
billable_type = fields.Selection([
('task_rate', 'At Task Rate'),
@@ -74,8 +74,8 @@ var KanbanColumn = Widget.extend({
this.record_options = _.clone(recordOptions);
if (options.grouped_by_m2o) {
// For many2one, a false value means that the field is not set.
if (options.grouped_by_m2o || options.grouped_by_date ) {
// For many2one and datetime, a false value means that the field is not set.
this.title = value ? value : _t('Undefined');
} else {
// False and 0 might be valid values for these fields.
@@ -503,9 +503,11 @@ var KanbanRenderer = BasicRenderer.extend({
// - is a date or datetime since we group by month or
// - is readonly (on the field attrs or in the view)
var draggable = true;
var grouped_by_date = false;
if (groupByFieldAttrs) {
if (groupByFieldAttrs.type === "date" || groupByFieldAttrs.type === "datetime") {
draggable = false;
grouped_by_date = true;
} else if (groupByFieldAttrs.readonly !== undefined) {
draggable = !(groupByFieldAttrs.readonly);
}
@@ -523,6 +525,7 @@ var KanbanRenderer = BasicRenderer.extend({
group_by_tooltip: groupByTooltip,
groupedBy: groupByField,
grouped_by_m2o: this.groupedByM2O,
grouped_by_date: grouped_by_date,
relation: relation,
quick_create: this.quickCreateEnabled && viewUtils.isQuickCreateEnabled(state),
});