[ADD] field sequence

This commit is contained in:
Stepan Savelyev 2019-12-28 15:09:32 +05:00
parent 6b8e5883cb
commit eab1d3b77a
2 changed files with 3 additions and 1 deletions

View File

@ -10,3 +10,4 @@ class ContractField(models.Model):
string="Technical Name", help="Name uses in template", required=True, string="Technical Name", help="Name uses in template", required=True,
) )
description = fields.Char(string="Description", translate=True, default="",) description = fields.Char(string="Description", translate=True, default="",)
sequence = fields.Integer(string="Sequence",)

View File

@ -5,6 +5,7 @@ import logging
from odoo import _, api, fields, models from odoo import _, api, fields, models
from odoo.exceptions import UserError from odoo.exceptions import UserError
from ..utils import MODULE_NAME
from ..utils.docxtpl import get_document_from_values_stream from ..utils.docxtpl import get_document_from_values_stream
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@ -97,7 +98,7 @@ class ContractWizard(models.TransientModel):
.id, .id,
0, 0,
) )
for field, value in sorted(contract_context_values.items()) for field, value in sorted(contract_context_values.items(), key=lambda tpl: self.env.ref("{}.contract_field_{}".format(MODULE_NAME, tpl[0])).sequence)
] ]
# Set up template domain # Set up template domain