[IMP]various: Improvement in model description

Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
This commit is contained in:
Nimesh Jethva
2018-09-21 11:45:15 +02:00
committed by Yannick Tivisse
parent 7eea263f36
commit 427ba08e0d
16 changed files with 78 additions and 0 deletions
@@ -110,6 +110,7 @@ class MailTestAlias(models.Model):
class MailModel(models.Model):
_name = 'test_performance.mail'
_description = 'Test Performance Mail'
_inherit = 'mail.thread'
name = fields.Char()
+2
View File
@@ -5,11 +5,13 @@ from odoo import fields, models
class SomeObj(models.Model):
_name = 'test_access_right.some_obj'
_description = 'Object For Test Access Right'
val = fields.Integer()
class Container(models.Model):
_name = 'test_access_right.container'
_description = 'Test Access Right Container'
some_ids = fields.Many2many('test_access_right.some_obj', 'test_access_right_rel', 'container_id', 'some_id')
+3
View File
@@ -5,6 +5,7 @@ from odoo import models, fields, api, SUPERUSER_ID
class test_model(models.Model):
_name = 'test_converter.test_model'
_description = 'Test Converter Model'
char = fields.Char()
integer = fields.Integer()
@@ -41,9 +42,11 @@ class test_model(models.Model):
class test_model_sub(models.Model):
_name = 'test_converter.test_model.sub'
_description = 'Subtraction For Test Model & Test Converter'
name = fields.Char()
class test_model_monetary(models.Model):
_name = 'test_converter.monetary'
_description = 'Test Converter Monetary'
value = fields.Float(digits=(16, 55))
@@ -5,16 +5,19 @@ from odoo import models, fields
class Child0(models.Model):
_name = 'delegation.child0'
_description = 'Delegation Child zero'
field_0 = fields.Integer()
class Child1(models.Model):
_name = 'delegation.child1'
_description = 'Delegation Child one'
field_1 = fields.Integer()
class Delegating(models.Model):
_name = 'delegation.parent'
_description = 'Delegation Parent'
_inherits = {
'delegation.child0': 'child0_id',
@@ -5,6 +5,7 @@ from odoo import models, fields
class Extension0(models.Model):
_name = 'extension.0'
_description = 'Extension zero'
name = fields.Char(default="A")
@@ -5,6 +5,7 @@ from odoo import models, fields
class Inheritance0(models.Model):
_name = 'inheritance.0'
_description = 'Inheritance Zero'
name = fields.Char()
@@ -17,6 +18,7 @@ class Inheritance0(models.Model):
class Inheritance1(models.Model):
_name = 'inheritance.1'
_inherit = 'inheritance.0'
_description = 'Inheritance One'
def call(self):
return self.check("model 1")
+1
View File
@@ -12,6 +12,7 @@ class m(models.Model):
and the clients.
"""
_name = 'test.exceptions.model'
_description = 'Test Exception Model'
@api.multi
def generate_except_osv(self):
+9
View File
@@ -58,6 +58,7 @@ for name, field in MODELS:
class One2ManyChild(models.Model):
_name = 'export.one2many.child'
_description = 'Export One to Many Child'
# FIXME: orm.py:1161, fix to name_get on m2o field
_rec_name = 'value'
@@ -80,6 +81,7 @@ class One2ManyChild(models.Model):
class One2ManyMultiple(models.Model):
_name = 'export.one2many.multiple'
_description = 'Export One To Many Multiple'
parent_id = fields.Many2one('export.one2many.recursive')
const = fields.Integer(default=36)
@@ -91,6 +93,7 @@ class One2ManyChildMultiple(models.Model):
_name = 'export.one2many.multiple.child'
# FIXME: orm.py:1161, fix to name_get on m2o field
_rec_name = 'value'
_description = 'Export One To Many Multiple Child'
parent_id = fields.Many2one('export.one2many.multiple')
str = fields.Char()
@@ -104,15 +107,18 @@ class One2ManyChildMultiple(models.Model):
class One2ManyChild1(models.Model):
_name = 'export.one2many.child.1'
_inherit = 'export.one2many.multiple.child'
_description = 'Export One to Many Child 1'
class One2ManyChild2(models.Model):
_name = 'export.one2many.child.2'
_inherit = 'export.one2many.multiple.child'
_description = 'Export One To Many Child 2'
class Many2ManyChild(models.Model):
_name = 'export.many2many.other'
_description = 'Export Many to Many Other'
# FIXME: orm.py:1161, fix to name_get on m2o field
_rec_name = 'value'
@@ -134,6 +140,7 @@ class Many2ManyChild(models.Model):
class SelectionWithDefault(models.Model):
_name = 'export.selection.withdefault'
_description = 'Export Selection With Default'
const = fields.Integer(default=4)
value = fields.Selection([(1, "Foo"), (2, "Bar")], default=2)
@@ -141,6 +148,7 @@ class SelectionWithDefault(models.Model):
class RecO2M(models.Model):
_name = 'export.one2many.recursive'
_description = 'Export One To Many Recursive'
value = fields.Integer()
child = fields.One2many('export.one2many.multiple', 'parent_id')
@@ -148,6 +156,7 @@ class RecO2M(models.Model):
class OnlyOne(models.Model):
_name = 'export.unique'
_description = 'Export Unique'
value = fields.Integer()
value2 = fields.Integer()
+5
View File
@@ -6,6 +6,7 @@ from odoo import models, fields, api
# We create a new model
class mother(models.Model):
_name = 'test.inherit.mother'
_description = 'Test Inherit Mother'
name = fields.Char(default='Foo')
state = fields.Selection([('a', 'A'), ('b', 'B')], default='a')
@@ -20,6 +21,7 @@ class mother(models.Model):
# We inherit from the parent model, and we add some fields in the child model
class daughter(models.Model):
_name = 'test.inherit.daughter'
_description = 'Test Inherit Daughter'
template_id = fields.Many2one('test.inherit.mother', 'Template',
delegate=True, required=True, ondelete='cascade')
@@ -78,6 +80,7 @@ class res_partner(models.Model):
# Contribution by Adrien Peiffer (ACSONE).
class test_inherit_property(models.Model):
_name = 'test.inherit.property'
_description = 'Test Inherit Property'
name = fields.Char('Name', required=True)
property_foo = fields.Integer(string='Foo', company_dependent=True)
@@ -104,6 +107,7 @@ class test_inherit_property(models.Model):
#
class Parent1(models.AbstractModel):
_name = 'test.inherit.parent'
_description = 'Test Inherit Parent'
def stuff(self):
return 'P1'
@@ -112,6 +116,7 @@ class Parent1(models.AbstractModel):
class Child(models.AbstractModel):
_name = 'test.inherit.child'
_inherit = 'test.inherit.parent'
_description = 'Test Inherit Child'
bar = fields.Integer()
+3
View File
@@ -5,6 +5,7 @@ from odoo import models, fields, api
# We just create a new model
class Unit(models.Model):
_name = 'test.unit'
_description = 'Test Unit'
name = fields.Char('Name', required=True)
state = fields.Selection([('a', 'A'), ('b', 'B')], string='State')
@@ -21,6 +22,7 @@ class Unit(models.Model):
class Box(models.Model):
_name = 'test.box'
_inherits = {'test.unit': 'unit_id'}
_description = 'Test Box'
unit_id = fields.Many2one('test.unit', 'Unit', required=True,
ondelete='cascade')
@@ -31,6 +33,7 @@ class Box(models.Model):
class Pallet(models.Model):
_name = 'test.pallet'
_inherits = {'test.box': 'box_id'}
_description = 'Test Pallet'
box_id = fields.Many2one('test.box', 'Box', required=True,
ondelete='cascade')
+1
View File
@@ -11,6 +11,7 @@ class m(models.Model):
resource' and 'a lot of resource'.
"""
_name = 'test.limits.model'
_description = 'Test Limits Model'
@api.model
def consume_nothing(self):
+22
View File
@@ -10,6 +10,7 @@ from odoo.tools import pycompat
class Category(models.Model):
_name = 'test_new_api.category'
_description = 'Test New API Category'
_order = 'name'
_parent_store = True
_parent_name = 'parent'
@@ -65,6 +66,7 @@ class Category(models.Model):
class Discussion(models.Model):
_name = 'test_new_api.discussion'
_description = 'Test New API Discussion'
name = fields.Char(string='Title', required=True,
help="General description of what this discussion is about.")
@@ -112,6 +114,7 @@ class Discussion(models.Model):
class Message(models.Model):
_name = 'test_new_api.message'
_description = 'Test New API Message'
discussion = fields.Many2one('test_new_api.discussion', ondelete='cascade')
body = fields.Text()
@@ -182,6 +185,7 @@ class Message(models.Model):
class EmailMessage(models.Model):
_name = 'test_new_api.emailmessage'
_description = 'Test New API Email Message'
_inherits = {'test_new_api.message': 'message'}
message = fields.Many2one('test_new_api.message', 'Message',
@@ -194,6 +198,7 @@ class Multi(models.Model):
one2many field several times.
"""
_name = 'test_new_api.multi'
_description = 'Test New API Multi'
name = fields.Char(related='partner.name', readonly=True)
partner = fields.Many2one('res.partner')
@@ -212,6 +217,7 @@ class Multi(models.Model):
class MultiLine(models.Model):
_name = 'test_new_api.multi.line'
_description = 'Test New API Multi Line'
multi = fields.Many2one('test_new_api.multi', ondelete='cascade')
name = fields.Char()
@@ -221,12 +227,14 @@ class MultiLine(models.Model):
class MultiTag(models.Model):
_name = 'test_new_api.multi.tag'
_description = 'Test New API Multi Tag'
name = fields.Char()
class Edition(models.Model):
_name = 'test_new_api.creativework.edition'
_description = 'Test New API Creative Work Edition'
name = fields.Char()
res_id = fields.Integer(required=True)
@@ -236,6 +244,7 @@ class Edition(models.Model):
class Book(models.Model):
_name = 'test_new_api.creativework.book'
_description = 'Test New API Creative Work Book'
name = fields.Char()
editions = fields.One2many(
@@ -245,6 +254,7 @@ class Book(models.Model):
class Movie(models.Model):
_name = 'test_new_api.creativework.movie'
_description = 'Test New API Creative Work Movie'
name = fields.Char()
editions = fields.One2many(
@@ -254,6 +264,7 @@ class Movie(models.Model):
class MixedModel(models.Model):
_name = 'test_new_api.mixed'
_description = 'Test New API Mixed'
number = fields.Float(digits=(10, 2), default=3.14)
date = fields.Date()
@@ -288,6 +299,7 @@ class MixedModel(models.Model):
class BoolModel(models.Model):
_name = 'domain.bool'
_description = 'Boolean Domain'
bool_true = fields.Boolean('b1', default=True)
bool_false = fields.Boolean('b2', default=False)
@@ -296,6 +308,7 @@ class BoolModel(models.Model):
class Foo(models.Model):
_name = 'test_new_api.foo'
_description = 'Test New API Foo'
name = fields.Char()
value1 = fields.Integer(change_default=True)
@@ -304,6 +317,7 @@ class Foo(models.Model):
class Bar(models.Model):
_name = 'test_new_api.bar'
_description = 'Test New API Bar'
name = fields.Char()
foo = fields.Many2one('test_new_api.foo', compute='_compute_foo')
@@ -318,6 +332,7 @@ class Bar(models.Model):
class Related(models.Model):
_name = 'test_new_api.related'
_description = 'Test New API Related'
name = fields.Char()
# related fields with a single field
@@ -330,6 +345,7 @@ class Related(models.Model):
class ComputeProtected(models.Model):
_name = 'test_new_api.compute.protected'
_description = 'Test New API Compute Protected'
foo = fields.Char(default='')
bar = fields.Char(compute='_compute_bar', store=True)
@@ -341,6 +357,7 @@ class ComputeProtected(models.Model):
class ComputeInverse(models.Model):
_name = 'test_new_api.compute.inverse'
_description = 'Test New API Compute Inversse'
foo = fields.Char()
bar = fields.Char(compute='_compute_bar', inverse='_inverse_bar', store=True)
@@ -360,6 +377,7 @@ class ComputeInverse(models.Model):
class MultiComputeInverse(models.Model):
""" Model with the same inverse method for several fields. """
_name = 'test_new_api.multi_compute_inverse'
_description = 'Test New API Multi Compute Inverse'
foo = fields.Char(default='', required=True)
bar1 = fields.Char(compute='_compute_bars', inverse='_inverse_bar1', store=True)
@@ -386,6 +404,7 @@ class MultiComputeInverse(models.Model):
class CompanyDependent(models.Model):
_name = 'test_new_api.company'
_description = 'Test New API Company'
foo = fields.Char(company_dependent=True)
tag_id = fields.Many2one('test_new_api.multi.tag', company_dependent=True)
@@ -393,6 +412,7 @@ class CompanyDependent(models.Model):
class CompanyDependentAttribute(models.Model):
_name = 'test_new_api.company.attr'
_description = 'Test New API Company Attribute'
company = fields.Many2one('test_new_api.company')
quantity = fields.Integer()
@@ -406,6 +426,7 @@ class CompanyDependentAttribute(models.Model):
class ComputeRecursive(models.Model):
_name = 'test_new_api.recursive'
_description = 'Test New API Recursive'
name = fields.Char(required=True)
parent = fields.Many2one('test_new_api.recursive', ondelete='cascade')
@@ -422,6 +443,7 @@ class ComputeRecursive(models.Model):
class ComputeCascade(models.Model):
_name = 'test_new_api.cascade'
_description = 'Test New API Cascade'
foo = fields.Char()
bar = fields.Char(compute='_compute_bar') # depends on foo
@@ -6,6 +6,7 @@ from odoo import models, fields, api
class BaseModel(models.Model):
_name = 'test_performance.base'
_description = 'Test Performance Base'
name = fields.Char()
value = fields.Integer()
@@ -29,6 +30,7 @@ class BaseModel(models.Model):
class LineModel(models.Model):
_name = 'test_performance.line'
_description = 'Test Performance Line'
base_id = fields.Many2one('test_performance.base', required=True, ondelete='cascade')
value = fields.Integer()
@@ -36,5 +38,6 @@ class LineModel(models.Model):
class TagModel(models.Model):
_name = 'test_performance.tag'
_description = 'Test Performance Tag'
name = fields.Char()
+5
View File
@@ -4,6 +4,7 @@ from odoo import fields, models
class GroupOnDate(models.Model):
_name = 'test_read_group.on_date'
_description = 'Group Test Read On Date'
date = fields.Date("Date")
value = fields.Integer("Value")
@@ -11,6 +12,7 @@ class GroupOnDate(models.Model):
class BooleanAggregate(models.Model):
_name = 'test_read_group.aggregate.boolean'
_description = 'Group Test Read Boolean Aggregate'
_order = 'key DESC'
key = fields.Integer()
@@ -22,6 +24,7 @@ class BooleanAggregate(models.Model):
class Aggregate(models.Model):
_name = 'test_read_group.aggregate'
_order = 'id'
_description = 'Group Test Aggregate'
key = fields.Integer()
value = fields.Integer("Value")
@@ -30,6 +33,7 @@ class Aggregate(models.Model):
class GroupOnSelection(models.Model):
_name = 'test_read_group.on_selection'
_description = 'Group Test Read On Selection'
state = fields.Selection([('a', "A"), ('b', "B")], group_expand='_expand_states')
value = fields.Integer()
@@ -41,6 +45,7 @@ class GroupOnSelection(models.Model):
class FillTemporal(models.Model):
_name = 'test_read_group.fill_temporal'
_description = 'Group Test Fill Temporal'
date = fields.Date()
datetime = fields.Datetime()
@@ -4,6 +4,7 @@ from odoo import api, fields, models
class A(models.Model):
_name = 'test_testing_utilities.a'
_description = 'Testing Utilities A'
f1 = fields.Integer(required=True)
f2 = fields.Integer(default=42)
@@ -21,6 +22,7 @@ class A(models.Model):
class B(models.Model):
_name = 'test_testing_utilities.readonly'
_description = 'Testing Utilities Readonly'
f1 = fields.Integer(default=1, readonly=True)
f2 = fields.Integer(compute='_compute_f2')
@@ -32,6 +34,7 @@ class B(models.Model):
class C(models.Model):
_name = 'test_testing_utilities.c'
_description = 'Testing Utilities C'
name = fields.Char("name", required=True)
f2 = fields.Many2one('test_testing_utilities.m2o')
@@ -42,11 +45,13 @@ class C(models.Model):
class M2O(models.Model):
_name = 'test_testing_utilities.m2o'
_description = 'Testing Utilities Many To One'
name = fields.Char(required=True)
class M2Onchange(models.Model):
_name = 'test_testing_utilities.d'
_description = 'Testing Utilities D'
# used to check that defaults & onchange to m2o work
f = fields.Many2one(
@@ -66,6 +71,7 @@ class M2Onchange(models.Model):
class M2MChange(models.Model):
_name = 'test_testing_utilities.e'
_description = 'Testing Utilities E'
m2m = fields.Many2many('test_testing_utilities.sub2')
count = fields.Integer(compute='_m2m_count')
@@ -77,11 +83,13 @@ class M2MChange(models.Model):
class M2MSub(models.Model):
_name = 'test_testing_utilities.sub2'
_description = 'Testing Utilities Subtraction 2'
name = fields.Char()
class M2MChange2(models.Model):
_name = 'test_testing_utilities.f'
_description = 'Testing Utilities F'
def _get_some(self):
r = self.env['test_testing_utilities.sub2'].search([], limit=2)
@@ -99,16 +107,19 @@ class M2MChange2(models.Model):
class M2MReadonly(models.Model):
_name = 'test_testing_utilities.g'
_description = 'Testing Utilities G'
m2m = fields.Many2many('test_testing_utilities.sub3', readonly=True)
class M2MSub3(models.Model):
_name = 'test_testing_utilities.sub3'
_description = 'Testing Utilities Subtraction 3'
name = fields.Char()
class O2MChange(models.Model):
_name = 'test_testing_utilities.parent'
_description = 'Testing Utilities Parent'
value = fields.Integer(default=1)
v = fields.Integer()
@@ -120,6 +131,7 @@ class O2MChange(models.Model):
class O2MSub(models.Model):
_name = 'test_testing_utilities.sub'
_description = 'Testing Utilities Subtraction'
name = fields.Char(compute='_compute_name')
value = fields.Integer(default=2)
@@ -144,6 +156,7 @@ class O2MSub(models.Model):
class O2MDefault(models.Model):
_name = 'test_testing_utilities.default'
_description = 'Testing Utilities Default'
def _default_subs(self):
return [
@@ -155,6 +168,7 @@ class O2MDefault(models.Model):
class O2MSub3(models.Model):
_name = 'test_testing_utilities.sub3'
_description = 'Testing Utilities Subtraction 3'
name = fields.Char(compute='_compute_name')
value = fields.Integer(default=2)
@@ -173,6 +187,7 @@ class O2MSub3(models.Model):
class O2MOnchangeParent(models.Model):
_name = 'test_testing_utilities.onchange_parent'
_description = 'Testing Utilities Onchange Parent'
line_ids = fields.One2many('test_testing_utilities.onchange_line', 'parent')
@@ -184,6 +199,7 @@ class O2MOnchangeParent(models.Model):
class M2OOnchangeLine(models.Model):
_name = 'test_testing_utilities.onchange_line'
_description = 'Testing Utilities Onchange Line'
parent = fields.Many2one('test_testing_utilities.onchange_parent')
dummy = fields.Float()
+1
View File
@@ -9,6 +9,7 @@ class test_uninstall_model(models.Model):
the uninstall feature of Odoo.
"""
_name = 'test_uninstall.model'
_description = 'Testing Uninstall Model'
name = fields.Char('Name')
ref = fields.Many2one('res.users', string='User')