[IMP] base: Configure document layout

The onboarding modal for setting up the few base fields of a company
has now been moved to a wizard
It is accessible from the general settings, but also in the onboarding
section of sale and account modules.

The following company settings are editable with that wizard:

- Set report **layout**:
The user can chose the overall look of the report. The current choices
are : *Standard* (default), *Background*, *Boxed* and *Clean*.

- Set company **logo**:
Changes the company logo.

- Set report **colors**:
The user can set the primary and secondary colors of the report through
a newly added widget allowing to pick a custom color.
When changing the **logo**, colors are automatically set to its most dominant
colors.
> A "Reset colors" button also triggers the color calculation.

- Set report **font**:
Changes the overall font of the report. Only Google Fonts are used
for enhanced compatibility.

- Company **tagline**, also called "header"
- **Footer**
- **Paper format**
- Report **preview**:
A mockup of a final report
Automatically updates when changing **layout**, **logo**, **colors** or **font**

Co-authored by: Julien Mougenot <jum@odoo.com>

closes odoo/odoo#33863

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>


Co-authored-by: Lucas Perais <lpe@odoo.com>
This commit is contained in:
Julien Mougenot
2019-07-29 08:29:26 +00:00
committed by Vincent Schippefilt
co-authored by Lucas Perais
parent a8c93df9c8
commit ed18095127
123 changed files with 1960 additions and 243 deletions
@@ -23,6 +23,7 @@ var utils = require('web.utils');
var view_dialogs = require('web.view_dialogs');
var field_utils = require('web.field_utils');
var time = require('web.time');
var ColorpickerDialog = require('web.ColorpickerDialog');
require("web.zoomodoo");
@@ -373,11 +374,11 @@ var NumericField = InputField.extend({
// Private
//--------------------------------------------------------------------------
/**
/**
* Evaluate a string representing a simple formula,
* a formula is composed of numbers and arithmetic operations
* (ex: 4+3*2)
*
*
* Supported arithmetic operations: + - * / ^ ( )
* Since each number in the formula can be expressed in user locale,
* we parse each float value inside the formula using the user context
@@ -385,7 +386,7 @@ var NumericField = InputField.extend({
* We assume that this function is used as a calculator so operand ^ (xor)
* is replaced by operand ** (power) so that users that are used to
* excel or libreoffice are not confused
*
*
* @private
* @param expr
* @return a float representing the result of the evaluated formula
@@ -1756,7 +1757,7 @@ var FieldBinaryImage = AbstractFieldBinary.extend({
},
/**
* Returns the image URL from a model.
*
*
* @private
* @param {string} model model from which to retrieve the image
* @param {string} res_id id of the record
@@ -1769,7 +1770,7 @@ var FieldBinaryImage = AbstractFieldBinary.extend({
model: model,
id: JSON.stringify(res_id),
field: field,
// unique forces a reload of the image when the record has been updated
// unique forces a reload of the image when the record has been updated
unique: field_utils.format.datetime(unique).replace(/[^0-9]/g, ''),
});
},
@@ -1811,7 +1812,7 @@ var FieldBinaryImage = AbstractFieldBinary.extend({
},
/**
* Only enable the zoom on image in read-only mode, and if the option is enabled.
*
*
* @override
* @private
*/
@@ -3204,6 +3205,59 @@ var AceEditor = DebouncedField.extend({
},
});
/**
* The FieldColor widget give a visual representation of a color
* Clicking on it bring up an instance of ColorpickerDialog
*/
var FieldColor = AbstractField.extend({
template: 'FieldColor',
events: {
'click .o_field_color': '_onColorClick',
},
custom_events: {
'colorpicker:saved': '_onColorpickerSaved',
},
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @override
* @private
*/
_render: function () {
this._super.apply(this, arguments);
this.$('.o_field_color').data('value', this.value)
.css('background-color', this.value)
.attr('title', this.value);
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
/**
* @private
* @param {MouseEvent} ev
*/
_onColorClick: function (ev) {
new ColorpickerDialog(this, {
defaultColor: this.value,
noTransparency: true,
}).open();
},
/**
* @private
* @param {OdooEvent} ev
*/
_onColorpickerSaved: function (ev) {
this._setValue(ev.data.hex);
},
});
return {
TranslatableFieldMixin: TranslatableFieldMixin,
DebouncedField: DebouncedField,
@@ -3247,6 +3301,7 @@ return {
CharCopyClipboard: CharCopyClipboard,
JournalDashboardGraph: JournalDashboardGraph,
AceEditor: AceEditor,
FieldColor: FieldColor,
};
});