[MERGE] various: improve html fields integration
PURPOSE Fix issues generated due to conversion of text field into Html field. SPECIFICATIONS Improve integration of HTML fields as well as "empty html" management. See various commits for more details. Followup of odoo/odoo@cb4f597 and odoo/enterprise@971f3ed Task-2558824 closes odoo/odoo#74795 Related: odoo/enterprise#20117 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -1019,25 +1019,26 @@
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<!-- Totals (only invoices / receipts) -->
|
||||
<group class="oe_subtotal_footer oe_right"
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('payment_state' ,'=', 'invoicing_legacy')]}">
|
||||
<field name="amount_tax" invisible="1"/>
|
||||
<field name="amount_untaxed" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
|
||||
<field name="amount_by_group" widget="tax-group-custom-field" nolabel="1" colspan="2" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
|
||||
<field name="amount_total" attrs="{'invisible': [('amount_tax', '!=', 0)]}"/>
|
||||
<field name="amount_total" class="oe_subtotal_footer_separator" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
|
||||
<field name="invoice_payments_widget" colspan="2" nolabel="1" widget="payment"/>
|
||||
<field name="amount_residual" class="oe_subtotal_footer_separator" attrs="{'invisible': [('state', '=', 'draft')]}"/>
|
||||
</group>
|
||||
<field name="invoice_outstanding_credits_debits_widget"
|
||||
class="oe_invoice_outstanding_credits_debits"
|
||||
colspan="2" nolabel="1" widget="payment"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'posted'), ('move_type', 'in', ('out_receipt', 'in_receipt'))]}"/>
|
||||
<group>
|
||||
<field name="narration" placeholder="Terms and Conditions" class="oe_inline" nolabel="1"/>
|
||||
<group col="4">
|
||||
<group colspan="3">
|
||||
<field name="narration" placeholder="Terms and Conditions" class="oe_inline" nolabel="1"/>
|
||||
</group>
|
||||
<!-- Totals (only invoices / receipts) -->
|
||||
<group class="oe_subtotal_footer oe_right"
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
|
||||
('payment_state' ,'=', 'invoicing_legacy')]}">
|
||||
<field name="amount_tax" invisible="1"/>
|
||||
<field name="amount_untaxed" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
|
||||
<field name="amount_by_group" widget="tax-group-custom-field" nolabel="1" colspan="2" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
|
||||
<field name="amount_total" attrs="{'invisible': [('amount_tax', '!=', 0)]}"/>
|
||||
<field name="amount_total" class="oe_subtotal_footer_separator" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
|
||||
<field name="invoice_payments_widget" colspan="2" nolabel="1" widget="payment"/>
|
||||
<field name="amount_residual" class="oe_subtotal_footer_separator" attrs="{'invisible': [('state', '=', 'draft')]}"/>
|
||||
</group>
|
||||
<field name="invoice_outstanding_credits_debits_widget"
|
||||
class="oe_invoice_outstanding_credits_debits"
|
||||
colspan="2" nolabel="1" widget="payment"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'posted'), ('move_type', 'in', ('out_receipt', 'in_receipt'))]}"/>
|
||||
</group>
|
||||
</page>
|
||||
<page id="aml_tab" string="Journal Items" groups="account.group_account_readonly">
|
||||
|
||||
@@ -108,11 +108,11 @@
|
||||
% if object.event_id.videocall_location:
|
||||
<li>Join Video Call: <a href="${object.event_id.videocall_location}" target="_blank">${object.event_id.videocall_location}</a></li>
|
||||
% endif
|
||||
% if not is_html_empty(object.event_id.description):
|
||||
<li>Description of the event:
|
||||
${object.event_id.description | safe}</li>
|
||||
% endif
|
||||
</ul>
|
||||
% if not is_html_empty(object.event_id.description):
|
||||
<p><strong>Description of the event</strong></p>
|
||||
${object.event_id.description | safe}
|
||||
% endif
|
||||
</td>
|
||||
</tr></table>
|
||||
<br/>
|
||||
@@ -230,11 +230,11 @@
|
||||
% if object.event_id.videocall_location:
|
||||
<li>Join Video Call: <a href="${object.event_id.videocall_location}" target="_blank">${object.event_id.videocall_location}</a></li>
|
||||
% endif
|
||||
% if not is_html_empty(object.event_id.description):
|
||||
<li>Description of the event:
|
||||
${object.event_id.description | safe}</li>
|
||||
% endif
|
||||
</ul>
|
||||
% if not is_html_empty(object.event_id.description):
|
||||
<p><strong>Description of the event</strong></p>
|
||||
${object.event_id.description | safe}
|
||||
% endif
|
||||
</td>
|
||||
</tr></table>
|
||||
<br/>
|
||||
@@ -332,11 +332,11 @@
|
||||
% if object.event_id.videocall_location:
|
||||
<li>Join Video Call: <a href="${object.event_id.videocall_location}" target="_blank">${object.event_id.videocall_location}</a></li>
|
||||
% endif
|
||||
% if not is_html_empty(object.event_id.description):
|
||||
<li>Description of the event:
|
||||
${object.event_id.description | safe}</li>
|
||||
% endif
|
||||
</ul>
|
||||
% if not is_html_empty(object.event_id.description):
|
||||
<p><strong>Description of the event</strong></p>
|
||||
${object.event_id.description | safe}
|
||||
% endif
|
||||
</td>
|
||||
</tr></table>
|
||||
<br/>
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
from collections import defaultdict
|
||||
from random import randint
|
||||
|
||||
from markupsafe import Markup
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import float_compare
|
||||
from odoo.tools import float_compare, is_html_empty
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
@@ -344,7 +346,7 @@ class Repair(models.Model):
|
||||
'partner_id': partner_invoice.id,
|
||||
'partner_shipping_id': repair.address_id.id,
|
||||
'currency_id': currency.id,
|
||||
'narration': narration,
|
||||
'narration': narration if not is_html_empty(narration) else '',
|
||||
'invoice_origin': repair.name,
|
||||
'repair_ids': [(4, repair.id)],
|
||||
'invoice_line_ids': [],
|
||||
@@ -358,10 +360,11 @@ class Repair(models.Model):
|
||||
invoice_vals = current_invoices_list[0]
|
||||
invoice_vals['invoice_origin'] += ', ' + repair.name
|
||||
invoice_vals['repair_ids'].append((4, repair.id))
|
||||
if not invoice_vals['narration']:
|
||||
invoice_vals['narration'] = narration
|
||||
else:
|
||||
invoice_vals['narration'] += '<br/>' + narration
|
||||
if not is_html_empty(narration):
|
||||
if is_html_empty(invoice_vals['narration']):
|
||||
invoice_vals['narration'] = narration
|
||||
else:
|
||||
invoice_vals['narration'] += Markup('<br/>') + narration
|
||||
|
||||
# Create invoice lines from operations.
|
||||
for operation in repair.operations.filtered(lambda op: op.type == 'add'):
|
||||
|
||||
@@ -318,7 +318,6 @@
|
||||
<field name="country_id" placeholder="Country" class="o_address_country" options='{"no_open": True, "no_create": True}'/>
|
||||
</div>
|
||||
</div>
|
||||
<field name="comment" placeholder="Internal notes..."/>
|
||||
</group>
|
||||
<group colspan="5">
|
||||
<field name="email" widget="email"/>
|
||||
@@ -327,13 +326,16 @@
|
||||
<field name="company_id" invisible="1"/>
|
||||
</group>
|
||||
<group colspan="1">
|
||||
<field name="avatar_128" invisible="1"/>
|
||||
<field name="image_1920" widget="image" class="oe_avatar" nolabel="1" options="{'image_preview': 'avatar_128'}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="comment" placeholder="Internal notes..."/>
|
||||
</group>
|
||||
<field name="lang" invisible="True"/>
|
||||
<field name="user_id" invisible="True"/>
|
||||
<field name="image_128" invisible="1"/>
|
||||
<field name="avatar_128" invisible="1"/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user