You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

603 lines
21 KiB

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Base Custom Info</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="base-custom-info">
<h1 class="title">Base Custom Info</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/12.0/base_custom_info"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_custom_info"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to attach custom information to records without the need
to alter the database structure too much.</p>
<p>This module defines several concepts that you have to understand.</p>
<div class="section" id="templates">
<h1>Templates</h1>
<p>A <em>template</em> is a collection of <em>properties</em> that a record should have.
<em>Templates</em> always apply to a given model, and then you can choose among the
current templates for the model you are using when you edit a record of that
model.</p>
<p>I.e., This addon includes a demo template called “Smart partners”, that applies
to the model <tt class="docutils literal">res.partner</tt>, so if you edit any partner, you can choose that
template and get its properties autofilled.</p>
</div>
<div class="section" id="properties">
<h1>Properties</h1>
<p>A <em>property</em> is the “name” of the field. <em>Templates</em> can have any amount of
<em>properties</em>, and when you apply a <em>template</em> to a record, it automatically
gets all of its <em>properties</em> filled, empty (unless they have a <em>Default
value</em>), ready to assign <em>values</em>.</p>
<p>You can set a property to as <em>required</em> to force it have a value, although you
should keep in mind that for yes/no properties, this would mean that only <em>yes</em>
can be selected, and for numeric properties, zero would be forbidden.</p>
<p>Also you can set <em>Minimum</em> and <em>Maximum</em> limits for every <em>property</em>, but those
limits are only used when the data type is text (to constrain its length) or
number. To skip this constraint, just set a maximum smaller than the minimum.</p>
<p><em>Properties</em> always belong to a template, and as such, to a model.</p>
<p><em>Properties</em> define the data type (text, number, yes/no…), and when the type
is “Selection”, then you can define what <em>options</em> are available.</p>
<p>I.e., the “Smart partners” <em>template</em> has the following <em>properties</em>:</p>
<ul class="simple">
<li>Name of his/her teacher</li>
<li>Amount of people that hates him/her for being so smart</li>
<li>Average note on all subjects</li>
<li>Does he/she believe he/she is the smartest person on earth?</li>
<li>What weaknesses does he/she have?</li>
</ul>
<p>When you set that template to any partner, you will then be able to fill these
<em>properties</em> with <em>values</em>.</p>
</div>
<div class="section" id="categories">
<h1>Categories</h1>
<p><em>Properties</em> can also belong to a <em>category</em>, which allows you to sort them in
a logical way, and makes further development easier.</p>
<p>For example, the <tt class="docutils literal">website_sale_custom_info</tt> addon uses these to display a
technical datasheet per product in your online shop, sorted and separated by
category.</p>
<p>You are not required to give a <em>category</em> to every <em>property</em>.</p>
</div>
<div class="section" id="options">
<h1>Options</h1>
<p>When a <em>property</em>’s type is “Selection”, then you define the <em>options</em>
available, so the <em>value</em> must be one of these <em>options</em>.</p>
<p>I.e., the “What weaknesses does he/she have?” <em>property</em> has some options:</p>
<ul class="simple">
<li>Loves junk food</li>
<li>Needs videogames</li>
<li>Huge glasses</li>
</ul>
<p>The <em>value</em> will always be one of these.</p>
</div>
<div class="section" id="value">
<h1>Value</h1>
<p>When you assign a <em>template</em> to a partner, and then you get the <em>properties</em> it
should have, you still have to set a <em>value</em> for each property.</p>
<p><em>Values</em> can be of different types (whole numbers, constrained selection,
booleans…), depending on how the <em>property</em> was defined. However, there is
always the <tt class="docutils literal">value</tt> field, that is a text string, and converts automatically
to/from the correct type.</p>
<div class="section" id="why-would-i-need-this">
<h2>Why would I need this?</h2>
<p>Imagine you have some partners that are foreign, and that for those partners
you need some extra information that is not needed for others, and you do not
want to fill the partners model with a lot of fields that will be empty most of
the time.</p>
<p>In this case, you could define a <em>template</em> called “Foreign partners”, which
will be applied to <tt class="docutils literal">res.partner</tt> objects, and defines some <em>properties</em> that
these are expected to have.</p>
<p>Then you could assign that <em>template</em> to a partner, and automatically you will
get a subtable of all the properties it should have, with tools to fill their
<em>values</em> correctly.</p>
</div>
<div class="section" id="does-this-work-with-any-model">
<h2>Does this work with any model?</h2>
<p>Yes and no.</p>
<p>Yes, because this is a base module that provides the tools to make this work
with any model.</p>
<p>No, because, although the tools are provided, they are only applied to the
<tt class="docutils literal">res.partner</tt> model. This is by design, because different models can have
different needs, and we don’t want to depend on every possible model.</p>
<p>So, if you want to apply this to other models, you will have to develop a
little additional addon that depends on this one. If you are a developer, refer
to the <em>Development</em> section below.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
<li><a class="reference internal" href="#configuration" id="id2">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
<li><a class="reference internal" href="#development" id="id4">Development</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id5">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id6">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id7">Credits</a></li>
</ul>
</div>
<div class="section" id="installation">
<h3><a class="toc-backref" href="#id1">Installation</a></h3>
<p>This module serves as a base for other modules that implement this behavior in
concrete models.</p>
<p>This module is a technical dependency and is to be installed in parallel to
other modules.</p>
</div>
<div class="section" id="configuration">
<h3><a class="toc-backref" href="#id2">Configuration</a></h3>
<p>To enable the main <em>Custom Info</em> menu:</p>
<ol class="arabic simple">
<li>Enable <em>Settings &gt; General Settings &gt; Manage custom information</em>.</li>
</ol>
<p>To enable partner’s custom info tab:</p>
<ol class="arabic simple">
<li>Enable <em>Settings &gt; General Settings &gt; Edit custom information in partners</em>.</li>
</ol>
</div>
<div class="section" id="usage">
<h3><a class="toc-backref" href="#id3">Usage</a></h3>
<p>This module defines <em>Custom Info Templates</em> that define what properties are
expected for a given record.</p>
<p>To define a template, you need to:</p>
<ul class="simple">
<li>Go to <em>Custom Info &gt; Templates</em>.</li>
<li>Create one.</li>
<li>Add some <em>Properties</em> to it.</li>
</ul>
<p>All database records with that template enabled will automatically fill those
properties.</p>
<p>To manage the properties, you need to:</p>
<ul class="simple">
<li>Go to <em>Custom Info &gt; Properties</em>.</li>
</ul>
<p>To manage the property categories, you need to:</p>
<ul class="simple">
<li>Go to <em>Custom Info &gt; Categories</em>.</li>
</ul>
<p>Some properties can have a number of options to choose, to manage them:</p>
<ul class="simple">
<li>Go to <em>Custom Info &gt; Options</em>.</li>
</ul>
<p>To manage their values, you need to:</p>
<ul class="simple">
<li>Go to <em>Custom Info &gt; Values</em>.</li>
</ul>
</div>
<div class="section" id="development">
<h3><a class="toc-backref" href="#id4">Development</a></h3>
<p>To create a module that supports custom information, just depend on this module
and inherit from the <tt class="docutils literal">custom.info</tt> model.</p>
<p>See an example in the <tt class="docutils literal">product_custom_info</tt> addon.</p>
</div>
<div class="section" id="known-issues-roadmap">
<h3><a class="toc-backref" href="#id5">Known issues / Roadmap</a></h3>
<ul>
<li><p class="first">Custom properties cannot be shared among templates.</p>
</li>
<li><p class="first">Required attributes are for now only set in the UI, not in the ORM itself.</p>
</li>
<li><p class="first">Support recursive templates using options</p>
<div class="figure">
<img alt="Customizations Everywhere" src="https://raw.githubusercontent.com/base_custom_info/static/description/customizations-everywhere.jpg" />
</div>
<p>If you assign an <em>additional template</em> to an option, and while using the owner
form you choose that option, you can then press <em>reload custom information
templates</em> to make the owner update itself to include all the properties in all
the involved templates. If you do not press the button, anyway the reloading
will be performed when saving the owner record.</p>
<div class="figure">
<img alt="Templateception" src="https://raw.githubusercontent.com/base_custom_info/static/description/templateception.jpg" />
</div>
<p>I.e., if you select the option “Needs videogames” for the property “What
weaknesses does he/she have?” of a smart partner and press <em>reload custom
information templates</em>, you will get 2 new properties to fill: “Favourite
videogames genre” and “Favourite videogame”.</p>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h3><a class="toc-backref" href="#id6">Bug Tracker</a></h3>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_custom_info%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h3><a class="toc-backref" href="#id7">Credits</a></h3>
</div>
</div>
<div class="section" id="authors">
<h2>Authors</h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2>Contributors</h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Rafael Blasco &lt;<a class="reference external" href="mailto:rafael.blasco&#64;tecnativa.com">rafael.blasco&#64;tecnativa.com</a>&gt;</li>
<li>Carlos Dauden &lt;<a class="reference external" href="mailto:carlos.dauden&#64;tecnativa.com">carlos.dauden&#64;tecnativa.com</a>&gt;</li>
<li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt;</li>
<li>Jairo Llopis &lt;<a class="reference external" href="mailto:jairo.llopis&#64;tecnativa.com">jairo.llopis&#64;tecnativa.com</a>&gt;</li>
<li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;tecnativa.com">pedro.baeza&#64;tecnativa.com</a>&gt;</li>
<li>Alexandre Díaz &lt;<a class="reference external" href="mailto:alexandre.diaz&#64;tecnativa.com">alexandre.diaz&#64;tecnativa.com</a>&gt;</li>
</ul>
</li>
<li>Creu Blanca:<ul>
<li>Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2>Maintainers</h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/12.0/base_custom_info">OCA/server-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>