changeset 8c262e79d99b in modules/commission:default
details: 
https://hg.tryton.org/modules/commission?cmd=changeset;node=8c262e79d99b
description:
        Add help text

        issue7233
        review39231002
diffstat:

 commission.py |  59 ++++++++++++++++++++++++++++++++++++++++-------------------
 invoice.py    |   6 ++++--
 product.py    |   3 ++-
 sale.py       |   6 ++++--
 4 files changed, 50 insertions(+), 24 deletions(-)

diffs (201 lines):

diff -r f6311e5aa4d0 -r 8c262e79d99b commission.py
--- a/commission.py     Thu Mar 19 19:03:38 2020 +0100
+++ b/commission.py     Mon Apr 13 17:35:36 2020 +0200
@@ -28,13 +28,15 @@
 class Agent(ModelSQL, ModelView):
     'Commission Agent'
     __name__ = 'commission.agent'
-    party = fields.Many2One('party.party', 'Party', required=True)
+    party = fields.Many2One('party.party', "Party", required=True,
+        help="The party for whom the commission is calculated.")
     type_ = fields.Selection([
             ('agent', 'Agent Of'),
             ('principal', 'Principal Of'),
             ], 'Type')
     company = fields.Many2One('company.company', 'Company', required=True)
-    plan = fields.Many2One('commission.plan', 'Plan')
+    plan = fields.Many2One('commission.plan', "Plan",
+        help="The plan used to calculate the commission.")
     currency = fields.Many2One('currency.currency', 'Currency',
         states={
             'required': Bool(Eval('plan')),
@@ -122,7 +124,8 @@
                 ('start_date', '<=', Eval('end_date')),
                 ()),
             ],
-        depends=['end_date'])
+        depends=['end_date'],
+        help="The first date that the agent will be considered for selection.")
     end_date = fields.Date(
         "End Date",
         domain=[
@@ -130,7 +133,8 @@
                 ('end_date', '>=', Eval('start_date')),
                 ()),
             ],
-        depends=['start_date'])
+        depends=['start_date'],
+        help="The last date that the agent will be considered for selection.")
     party = fields.Many2One(
         'party.party', "Party", ondelete='CASCADE', select=True)
 
@@ -165,13 +169,16 @@
             ('default_uom', '=', Id('product', 'uom_unit')),
             ('template.type', '=', 'service'),
             ('template.default_uom', '=', Id('product', 'uom_unit')),
-            ])
+            ],
+        help="The product that is used on the invoice lines.")
     commission_method = fields.Selection([
             ('posting', 'On Posting'),
             ('payment', 'On Payment'),
             ], 'Commission Method',
-        help='When the commission is due.')
-    lines = fields.One2Many('commission.plan.line', 'plan', 'Lines')
+        help="When the commission is due.")
+    lines = fields.One2Many('commission.plan.line', 'plan', "Lines",
+        help="The formulas used to calculate the commission for different "
+        "criteria.")
 
     @staticmethod
     def default_commission_method():
@@ -211,13 +218,18 @@
     'Commission Plan Line'
     __name__ = 'commission.plan.line'
     plan = fields.Many2One('commission.plan', 'Plan', required=True,
-        ondelete='CASCADE')
+        ondelete='CASCADE',
+        help="The plan to which the line belongs.")
     category = fields.Many2One(
-        'product.category', "Category", ondelete='CASCADE')
-    product = fields.Many2One('product.product', 'Product', ondelete='CASCADE')
+        'product.category', "Category", ondelete='CASCADE',
+        help="Apply only to products in the category.")
+    product = fields.Many2One('product.product', "Product", ondelete='CASCADE',
+        help="Apply only to the product.")
     formula = fields.Char('Formula', required=True,
-        help=('Python expression that will be evaluated with:\n'
-            '- amount: the original amount'))
+        help="The python expression used to calculate the amount of "
+        "commission for the line.\n"
+        "It is evaluated with:\n"
+        "- amount: the original amount")
 
     @staticmethod
     def default_formula():
@@ -265,13 +277,16 @@
         }
     _readonly_depends = ['invoice_line']
     origin = fields.Reference('Origin', selection='get_origin', select=True,
-        readonly=True)
+        readonly=True,
+        help="The source of the commission.")
     date = fields.Date('Date', select=True, states=_readonly_states,
-        depends=_readonly_depends)
+        depends=_readonly_depends,
+        help="When the commission is due.")
     agent = fields.Many2One('commission.agent', 'Agent', required=True,
         states=_readonly_states, depends=_readonly_depends)
     product = fields.Many2One('product.product', 'Product', required=True,
-        states=_readonly_states, depends=_readonly_depends)
+        states=_readonly_states, depends=_readonly_depends,
+        help="The product that is used on the invoice line.")
     amount = fields.Numeric('Amount', required=True, digits=price_digits,
         domain=[('amount', '!=', 0)],
         states=_readonly_states, depends=_readonly_depends)
@@ -288,7 +303,10 @@
                 ('invoiced', 'Invoiced'),
                 ('paid', 'Paid'),
                 ('cancel', 'Canceled'),
-                ], 'Invoice State'), 'get_invoice_state')
+                ], "Invoice State",
+            help="The current state of the invoice "
+            "that the commission appears on."),
+        'get_invoice_state')
 
     @classmethod
     def __setup__(cls):
@@ -502,18 +520,21 @@
             If(Eval('to') & Eval('from_'), [('from_', '<=', Eval('to'))],
                 []),
             ],
-        depends=['to'])
+        depends=['to'],
+        help="Limit to commissions from this date.")
     to = fields.Date('To',
         domain=[
             If(Eval('from_') & Eval('to'), [('to', '>=', Eval('from_'))],
                 []),
             ],
-        depends=['from_'])
+        depends=['from_'],
+        help="Limit to commissions to this date.")
     type_ = fields.Selection([
             ('in', 'Incoming'),
             ('out', 'Outgoing'),
             ('both', 'Both'),
-            ], 'Type')
+            ], 'Type',
+        help="Limit to commissions of this type.")
 
     @staticmethod
     def default_type_():
diff -r f6311e5aa4d0 -r 8c262e79d99b invoice.py
--- a/invoice.py        Thu Mar 19 19:03:38 2020 +0100
+++ b/invoice.py        Mon Apr 13 17:35:36 2020 +0200
@@ -21,7 +21,8 @@
             'invisible': Eval('type') == 'in',
             'readonly': Eval('state', '') != 'draft',
             },
-        depends=['type', 'company', 'state'])
+        depends=['type', 'company', 'state'],
+        help="The agent who receives a commission for the invoice.")
 
     @classmethod
     @ModelView.button
@@ -113,7 +114,8 @@
             'invisible': If(Bool(Eval('_parent_invoice')),
                 Eval('_parent_invoice', {}).get('type') == 'in',
                 Eval('invoice_type') == 'in'),
-            }, depends=['invoice_type', 'company'])
+            }, depends=['invoice_type', 'company'],
+        help="The principal who pays a commission for the invoice line.")
     commissions = fields.One2Many('commission', 'origin', 'Commissions',
         readonly=True,
         states={
diff -r f6311e5aa4d0 -r 8c262e79d99b product.py
--- a/product.py        Thu Mar 19 19:03:38 2020 +0100
+++ b/product.py        Mon Apr 13 17:35:36 2020 +0200
@@ -11,7 +11,8 @@
         'template', 'agent', 'Commission Principals',
         domain=[
             ('type_', '=', 'principal'),
-            ])
+            ],
+        help="The principals who pay a commission when the product is sold.")
 
     @property
     def principal(self):
diff -r f6311e5aa4d0 -r 8c262e79d99b sale.py
--- a/sale.py   Thu Mar 19 19:03:38 2020 +0100
+++ b/sale.py   Mon Apr 13 17:35:36 2020 +0200
@@ -17,7 +17,8 @@
         states={
             'readonly': ~Eval('state').in_(['draft', 'quotation']),
             },
-        depends=['state', 'company'])
+        depends=['state', 'company'],
+        help="The agent who receives a commission for the sale.")
 
     def create_invoice(self):
         invoice = super(Sale, self).create_invoice()
@@ -72,7 +73,8 @@
         domain=[
             ('type_', '=', 'principal'),
             ('company', '=', Eval('_parent_sale', {}).get('company', -1)),
-            ])
+            ],
+        help="The principal who pays a commission for the line.")
 
     def get_invoice_line(self):
         lines = super().get_invoice_line()

Reply via email to