Store directly sequence type to sequence

issue10122
review351381002
This commit is contained in:
Cédric Krier
2021-03-11 23:00:10 +01:00
parent c9630c442e
commit b8f4bee761
3 changed files with 4 additions and 5 deletions
+2 -1
View File
@@ -5,10 +5,11 @@ from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
from trytond.model import MultiValueMixin, ValueMixin
from trytond.pool import Pool
from trytond.tools.multivalue import migrate_property
from trytond.pyson import Id
party_sequence = fields.Many2One('ir.sequence', 'Party Sequence',
domain=[
('code', '=', 'party.party'),
('sequence_type', '=', Id('party', 'sequence_type_party')),
],
help="Used to generate the party code.")
party_lang = fields.Many2One("ir.lang", 'Party Language',
+1 -2
View File
@@ -172,12 +172,11 @@ class Party(DeactivableMixin, ModelSQL, ModelView, MultiValueMixin):
@classmethod
def _new_code(cls, **pattern):
pool = Pool()
Sequence = pool.get('ir.sequence')
Configuration = pool.get('party.configuration')
config = Configuration(1)
sequence = config.get_multivalue('party_sequence', **pattern)
if sequence:
return Sequence.get_id(sequence.id)
return sequence.get()
@classmethod
def create(cls, vlist):
+1 -2
View File
@@ -92,7 +92,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_party">
<field name="name">Party</field>
<field name="code">party.party</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_party_group_admin">
@@ -107,7 +106,7 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence" id="sequence_party">
<field name="name">Party</field>
<field name="code">party.party</field>
<field name="sequence_type" ref="sequence_type_party"/>
</record>
<record model="ir.ui.view" id="identifier_form">