mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract: add section and notes in contract line
This commit is contained in:
committed by
Pedro M. Baeza
parent
c51ac90345
commit
69df8ed71a
@@ -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">
|
||||
|
||||
38
contract/static/src/js/section_and_note_fields_backend.js
Normal file
38
contract/static/src/js/section_and_note_fields_backend.js
Normal 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
|
||||
},
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user