Mladen Meseldžija
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
15 additions and
12 deletions
-
web_context_in_colors/__manifest__.py
-
web_context_in_colors/static/src/js/web_context_in_colors.js
-
web_context_in_colors/view/qweb.xml
|
|
@ -21,7 +21,7 @@ |
|
|
|
{ |
|
|
|
"name": "Context in colors and fonts", |
|
|
|
"summary": "Use the context in a tree view's colors and fonts attribute", |
|
|
|
"version": "8.0.1.1.0", |
|
|
|
"version": "10.0.1.0.0", |
|
|
|
"author": "Therp BV,Odoo Community Association (OCA)", |
|
|
|
"complexity": "normal", |
|
|
|
"category": "Hidden/Dependency", |
|
|
|
|
|
@ -19,22 +19,25 @@ |
|
|
|
//
|
|
|
|
//############################################################################
|
|
|
|
|
|
|
|
openerp.web_context_in_colors = function(instance) |
|
|
|
{ |
|
|
|
instance.web.ListView.include( |
|
|
|
{ |
|
|
|
style_for: function (record) |
|
|
|
{ |
|
|
|
odoo.define('web_context_in_colors.list_view_extensions', function(require) { |
|
|
|
"use strict"; |
|
|
|
|
|
|
|
var ListView = require('web.ListView'); |
|
|
|
var py = window.py; |
|
|
|
var pyeval = require('web.pyeval'); |
|
|
|
|
|
|
|
ListView.include({ |
|
|
|
style_for: function (record){ |
|
|
|
var record_with_context = { |
|
|
|
attributes: _.extend({}, record.attributes || {}), |
|
|
|
}; |
|
|
|
if(!record_with_context.attributes.context) |
|
|
|
{ |
|
|
|
record_with_context.attributes.context = py.dict.fromJSON( |
|
|
|
instance.web.pyeval.eval( |
|
|
|
record_with_context.attributes.context = py.str.fromJSON( |
|
|
|
pyeval.eval( |
|
|
|
'context', this.dataset.get_context())); |
|
|
|
} |
|
|
|
return this._super.apply(this, [record_with_context]); |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
@ -1,5 +1,5 @@ |
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
|
|
<openerp> |
|
|
|
<odoo> |
|
|
|
<data> |
|
|
|
<template id="assets_backend" name="web_context_in_colors" inherit_id="web.assets_backend"> |
|
|
|
<xpath expr="." position="inside"> |
|
|
@ -7,4 +7,4 @@ |
|
|
|
</xpath> |
|
|
|
</template> |
|
|
|
</data> |
|
|
|
</openerp> |
|
|
|
</odoo> |