Store directly sequence type to sequence
issue10122 review351381002
This commit is contained in:
1 parent
0cd5121549
commit
200cb740e8
3 files changed
+7
-7
No files matched your search
+5
-3
@@ -4,7 +4,7 @@ from trytond import backend
|
||||
from trytond.model import (ModelView, ModelSQL, ModelSingleton, ValueMixin,
|
||||
fields)
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, Id
|
||||
from trytond.tools.multivalue import migrate_property
|
||||
from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin)
|
||||
@@ -31,7 +31,8 @@ class Configuration(
|
||||
domain=[
|
||||
('company', 'in',
|
||||
[Eval('context', {}).get('company', -1), None]),
|
||||
('code', '=', 'purchase.purchase'),
|
||||
('sequence_type', '=',
|
||||
Id('purchase', 'sequence_type_purchase')),
|
||||
]))
|
||||
purchase_invoice_method = fields.MultiValue(purchase_invoice_method)
|
||||
get_purchase_invoice_method = get_purchase_methods('invoice_method')
|
||||
@@ -67,7 +68,8 @@ class ConfigurationSequence(ModelSQL, CompanyValueMixin):
|
||||
'ir.sequence', "Purchase Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('code', '=', 'purchase.purchase'),
|
||||
('sequence_type', '=',
|
||||
Id('purchase', 'sequence_type_purchase')),
|
||||
],
|
||||
depends=['company'])
|
||||
|
||||
|
||||
+1
-2
@@ -727,14 +727,13 @@ class Purchase(
|
||||
Fill the number field with the purchase sequence
|
||||
'''
|
||||
pool = Pool()
|
||||
Sequence = pool.get('ir.sequence')
|
||||
Config = pool.get('purchase.configuration')
|
||||
|
||||
config = Config(1)
|
||||
for purchase in purchases:
|
||||
if purchase.number:
|
||||
continue
|
||||
purchase.number = Sequence.get_id(config.purchase_sequence.id)
|
||||
purchase.number = config.purchase_sequence.get()
|
||||
cls.save(purchases)
|
||||
|
||||
@classmethod
|
||||
|
||||
+1
-2
@@ -338,7 +338,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
<record model="ir.sequence.type" id="sequence_type_purchase">
|
||||
<field name="name">Purchase</field>
|
||||
<field name="code">purchase.purchase</field>
|
||||
</record>
|
||||
<record model="ir.sequence.type-res.group"
|
||||
id="sequence_type_purchase_group_admin">
|
||||
@@ -353,7 +352,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
<record model="ir.sequence" id="sequence_purchase">
|
||||
<field name="name">Purchase</field>
|
||||
<field name="code">purchase.purchase</field>
|
||||
<field name="sequence_type" ref="sequence_type_purchase"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.report" id="report_purchase">
|
||||
|
||||
Reference in new issue
Block a user