Store directly sequence type to sequence
issue10122 review351381002
This commit is contained in:
+2
-1
@@ -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',
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user