Store directly sequence type to sequence
issue10122 review351381002
This commit is contained in:
+6
-3
@@ -12,7 +12,7 @@ from trytond import backend
|
||||
from trytond.i18n import gettext
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.pyson import Eval, If, Bool
|
||||
from trytond.pyson import Eval, If, Bool, Id
|
||||
from trytond.wizard import (Wizard, StateView, StateAction, StateTransition,
|
||||
Button)
|
||||
from trytond.transaction import Transaction
|
||||
@@ -384,7 +384,9 @@ class Configuration(metaclass=PoolMeta):
|
||||
domain=[
|
||||
('company', 'in',
|
||||
[Eval('context', {}).get('company', -1), None]),
|
||||
('code', '=', 'account.payment.group'),
|
||||
('sequence_type', '=',
|
||||
Id('account_payment',
|
||||
'sequence_type_account_payment_group')),
|
||||
]))
|
||||
|
||||
@classmethod
|
||||
@@ -400,7 +402,8 @@ class ConfigurationPaymentGroupSequence(ModelSQL, CompanyValueMixin):
|
||||
'ir.sequence', "Payment Group Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('code', '=', 'account.payment.group'),
|
||||
('sequence_type', '=',
|
||||
Id('account_payment', 'sequence_type_account_payment_group')),
|
||||
],
|
||||
depends=['company'])
|
||||
|
||||
|
||||
+1
-4
@@ -111,16 +111,13 @@ class Group(ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def create(cls, vlist):
|
||||
pool = Pool()
|
||||
Sequence = pool.get('ir.sequence')
|
||||
Config = pool.get('account.configuration')
|
||||
|
||||
vlist = [v.copy() for v in vlist]
|
||||
config = Config(1)
|
||||
for values in vlist:
|
||||
if values.get('number') is None:
|
||||
values['number'] = Sequence.get_id(
|
||||
config.payment_group_sequence.id)
|
||||
|
||||
values['number'] = config.payment_group_sequence.get()
|
||||
return super(Group, cls).create(vlist)
|
||||
|
||||
@classmethod
|
||||
|
||||
+1
-2
@@ -174,7 +174,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.sequence.type"
|
||||
id="sequence_type_account_payment_group">
|
||||
<field name="name">Account Payment Group</field>
|
||||
<field name="code">account.payment.group</field>
|
||||
</record>
|
||||
<record model="ir.sequence.type-res.group"
|
||||
id="sequence_type_account_payment_group_group_admin">
|
||||
@@ -191,7 +190,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
<record model="ir.sequence" id="sequence_account_payment_group">
|
||||
<field name="name">Default Account Payment Group</field>
|
||||
<field name="code">account.payment.group</field>
|
||||
<field name="sequence_type" ref="sequence_type_account_payment_group"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="payment_view_form">
|
||||
|
||||
Reference in New Issue
Block a user