Package: odoo9-addon-base-custom-info
Base Custom InfoThis module allows you to attach custom information to records without the need
to alter the database structure too much.DefinitionsThis module defines several concepts that you have to understand.TemplatesAtemplateis a collection ofpropertiesthat a record should have.Templatesalways 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.I.e., This addon includes a demo template called “Smart partners”, that applies
to the modelres.partner, so if you edit any partner, you can choose that
template and get its properties autofilled.PropertiesApropertyis the “name” of the field.Templatescan have any amount ofproperties, and when you apply atemplateto a record, it automatically
gets all of itspropertiesfilled, empty (unless they have aDefault
value), ready to assignvalues.You can set a property to asrequiredto force it have a value, although you
should keep in mind that for yes/no properties, this would mean that onlyyescan be selected, and for numeric properties, zero would be forbidden.Also you can setMinimumandMaximumlimits for everyproperty, 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.Propertiesalways belong to a template, and as such, to a model.Propertiesdefine the data type (text, number, yes/no…), and when the type
is “Selection”, then you can define whatoptionsare available.I.e., the “Smart partners”templatehas the followingproperties:Name of his/her teacherAmount of people that hates him/her for being so smartAverage note on all subjectsDoes he/she believe he/she is the smartest person on earth?What weaknesses does he/she have?When you set that template to any partner, you will then be able to fill thesepropertieswithvalues.CategoriesPropertiescan also belong to acategory, which allows you to sort them in
a logical way, and makes further development easier.For example, thewebsite_sale_custom_infoaddon uses these to display a
technical datasheet per product in your online shop, sorted and separated by
category.You are not required to give acategoryto everyproperty.OptionsWhen aproperty’s type is “Selection”, then you define theoptionsavailable, so thevaluemust be one of theseoptions.I.e., the “What weaknesses does he/she have?”propertyhas some options:Loves junk foodNeeds videogamesHuge glassesThevaluewill always be one of these.Recursive templates using optionsOh dear customization lovers! Options can be used to customize the custom
information template!If you assign anadditional templateto an option, and while using the owner
form you choose that option, you can then pressreload custom information
templatesto 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.I.e., if you select the option “Needs videogames” for the property “What
weaknesses does he/she have?” of a smart partner and pressreload custom
information templates, you will get 2 new properties to fill: “Favourite
videogames genre” and “Favourite videogame”.ValueWhen you assign atemplateto a partner, and then you get thepropertiesit
should have, you still have to set avaluefor each property.Valuescan be of different types (whole numbers, constrained selection,
booleans…), depending on how thepropertywas defined. However, there is
always thevaluefield, that is a text string, and converts automatically
to/from the correct type.Why would I need this?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.In this case, you could define atemplatecalled “Foreign partners”, which
will be applied tores.partnerobjects, and defines somepropertiesthat
these are expected to have.Then you could assign thattemplateto a partner, and automatically you will
get a subtable of all the properties it should have, with tools to fill theirvaluescorrectly.Does this work with any model?Yes and no.Yes, because this is a base module that provides the tools to make this work
with any model.No, because, although the tools are provided, they are only applied to theres.partnermodel. This is by design, because different models can have
different needs, and we don’t want to depend on every possible model.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 theDevelopmentsection below.InstallationThis module serves as a base for other modules that implement this behavior in
concrete models.This module is a technical dependency and is to be installed in parallel to
other modules.ConfigurationTo enable the mainCustom Infomenu:EnableSettings > General Settings > Manage custom information.To enable partner’s custom info tab:EnableSettings > General Settings > Edit custom information in partners.UsageThis module definesCustom Info Templatesthat define what properties are
expected for a given record.To define a template, you need to:Go toCustom Info > Templates.Create one.Add somePropertiesto it.All database records with that template enabled will automatically fill those
properties.To manage the properties, you need to:Go toCustom Info > Properties.To manage the property categories, you need to:Go toCustom Info > Categories.Some properties can have a number of options to choose, to manage them:Go toCustom Info > Options.To manage their values, you need to:Go toCustom Info > Values.DevelopmentTo create a module that supports custom information, just depend on this module
and inherit from thecustom.infomodel.See an example in theproduct_custom_infoaddon.Known issues / RoadmapCustom properties cannot be shared among templates.Required attributes are for now only set in the UI, not in the ORM itself.Bug TrackerBugs are tracked onGitHub Issues. 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 feedback.CreditsContributorsRafael Blasco <rafael.blasco@tecnativa.com>Carlos Dauden <carlos.dauden@tecnativa.com>Sergio Teruel <sergio.teruel@tecnativa.com>Jairo Llopis <jairo.llopis@tecnativa.com>Pedro M. Baeza <pedro.baeza@tecnativa.com>MaintainerThis module is maintained by the OCA.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.To contribute to this module, please visithttps://odoo-community.org.