[IMP] contract: add section and notes in contract line

This commit is contained in:
Ernesto Tejeda
2020-03-17 17:27:28 -04:00
committed by Pedro M. Baeza
parent c51ac90345
commit 69df8ed71a
13 changed files with 254 additions and 67 deletions

View File

@@ -425,6 +425,8 @@ To use it, just select the template on the contract and fields will be filled au
<h1><a class="toc-backref" href="#id3">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Recover states and others functional fields in Contracts.</li>
<li>Depending on the contract lines, some sections of contract
line have no meaning that they are propagated to certain invoices</li>
</ul>
</div>
<div class="section" id="bug-tracker">

View File

@@ -0,0 +1,38 @@
/* Copyright 2020 Tecnativa - Ernesto Tejeda
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
/*
If in the sub-tree view where the sections and notes are to be used
there are fields that have defined in the XML attrs = {'invisible': ....}
and this condition is met, then an extra space appears in the rows
corresponding to the sections and lines.
This js was written to deal with that problem, but a solution based on
this can be applied directly to Odoo*/
odoo.define('contract.section_and_note_backend', function (require) {
"use strict";
var fieldRegistry = require('web.field_registry');
var section_and_note_one2many = fieldRegistry.get('section_and_note_one2many');
section_and_note_one2many.include({
_getRenderer: function () {
var result = this._super.apply(this, arguments);
if (this.view.arch.tag === 'tree') {
result.include({
_renderBodyCell: function (record, node, index, options) {
var $cell = this._super.apply(this, arguments);
var isSection = record.data.display_type === 'line_section';
var isNote = record.data.display_type === 'line_note';
if (isSection || isNote) {
$cell.removeClass('o_invisible_modifier');
}
return $cell;
}
})
}
return result
},
});
});