From a437b3ed33ef05ded90f2edb4a9987dc542f982a Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Fri, 12 Nov 2021 12:11:31 +0000 Subject: [PATCH] [REF] account: make fields definition more readable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we don't have other docs for `account.tax.report.line`, let's just improve source readability closes odoo/odoo#79696 Signed-off-by: William André (wan) --- addons/account/models/account_tax_report.py | 70 +++++++++++++++++---- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/addons/account/models/account_tax_report.py b/addons/account/models/account_tax_report.py index 5371a2ed8a7..315b1e54577 100644 --- a/addons/account/models/account_tax_report.py +++ b/addons/account/models/account_tax_report.py @@ -98,22 +98,68 @@ class AccountTaxReportLine(models.Model): _order = 'sequence' _parent_store = True - name = fields.Char(string="Name", required=True, help="Complete name for this report line, to be used in report.") - tag_ids = fields.Many2many(string="Tags", comodel_name='account.account.tag', relation='account_tax_report_line_tags_rel', help="Tax tags populating this line") - report_action_id = fields.Many2one(string="Report Action", comodel_name='ir.actions.act_window', help="The optional action to call when clicking on this line in accounting reports.") - children_line_ids = fields.One2many(string="Children Lines", comodel_name='account.tax.report.line', inverse_name='parent_id', help="Lines that should be rendered as children of this one") - parent_id = fields.Many2one(string="Parent Line", comodel_name='account.tax.report.line') - sequence = fields.Integer(string='Sequence', required=True, - help="Sequence determining the order of the lines in the report (smaller ones come first). This order is applied locally per section (so, children of the same line are always rendered one after the other).") + name = fields.Char( + string="Name", + required=True, + help="Complete name for this report line, to be used in report.", + ) + tag_ids = fields.Many2many( + string="Tags", + comodel_name="account.account.tag", + relation="account_tax_report_line_tags_rel", + help="Tax tags populating this line", + ) + report_action_id = fields.Many2one( + string="Report Action", + comodel_name="ir.actions.act_window", + help="The optional action to call when clicking on this line in accounting reports.", + ) + children_line_ids = fields.One2many( + string="Children Lines", + comodel_name="account.tax.report.line", + inverse_name="parent_id", + help="Lines that should be rendered as children of this one", + ) + parent_id = fields.Many2one( + string="Parent Line", + comodel_name="account.tax.report.line" + ) + sequence = fields.Integer( + string="Sequence", + required=True, + help="Sequence determining the order of the lines in the report (smaller ones come first). " + "This order is applied locally per section " + "(so, children of the same line are always rendered one after the other).", + ) parent_path = fields.Char(index=True, unaccent=False) - report_id = fields.Many2one(string="Tax Report", required=True, comodel_name='account.tax.report', ondelete='cascade', help="The parent tax report of this line") + report_id = fields.Many2one( + string="Tax Report", + required=True, + comodel_name="account.tax.report", + ondelete="cascade", + help="The parent tax report of this line", + ) # helper to create tags (positive and negative) on report line creation - tag_name = fields.Char(string="Tag Name", help="Short name for the tax grid corresponding to this report line. Leave empty if this report line should not correspond to any such grid.") + tag_name = fields.Char( + string="Tag Name", + help="Short name for the tax grid corresponding to this report line. " + "Leave empty if this report line should not correspond to any such grid.", + ) - # fields used in specific localization reports, where a report line isn't simply the given by the sum of account.move.line with selected tags - code = fields.Char(string="Code", help="Optional unique code to refer to this line in total formulas") - formula = fields.Char(string="Formula", help="Python expression used to compute the value of a total line. This field is mutually exclusive with tag_name, setting it turns the line to a total line. Tax report line codes can be used as variables in this expression to refer to the balance of the corresponding lines in the report. A formula cannot refer to another line using a formula.") + # fields used in specific localization reports, + # where a report line isn't simply the given by the sum of account.move.line with selected tags + code = fields.Char( + string="Code", help="Optional unique code to refer to this line in total formulas" + ) + formula = fields.Char( + string="Formula", + help="Python expression used to compute the value of a total line. " + "This field is mutually exclusive with tag_name, setting it turns the line to a total line. " + "Tax report line codes can be used as variables in this expression " + "to refer to the balance of the corresponding lines in the report. " + "A formula cannot refer to another line using a formula.", + ) # fields used to carry over amounts between periods