Creación de secuencia por defectado para asientos borradores y mantener el consecutivo de las otras secuencias
This commit is contained in:
parent
fa61a1776e
commit
f380f6a45c
|
@ -2,6 +2,8 @@ from trytond.pool import Pool
|
||||||
from . import party
|
from . import party
|
||||||
from . import country
|
from . import country
|
||||||
from . import rut
|
from . import rut
|
||||||
|
from . import configuration
|
||||||
|
from . import account
|
||||||
|
|
||||||
__all__ = ['register']
|
__all__ = ['register']
|
||||||
|
|
||||||
|
@ -14,6 +16,8 @@ def register():
|
||||||
party.Address,
|
party.Address,
|
||||||
country.Subdivision,
|
country.Subdivision,
|
||||||
rut.TaxLevelCode,
|
rut.TaxLevelCode,
|
||||||
|
configuration.Configuration,
|
||||||
|
account.Move,
|
||||||
module='account_co_co', type_='model')
|
module='account_co_co', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
module='account_co_co', type_='wizard')
|
module='account_co_co', type_='wizard')
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
from trytond.pool import Pool, PoolMeta
|
||||||
|
|
||||||
|
__all__ = ['Move']
|
||||||
|
|
||||||
|
class Move(metaclass=PoolMeta):
|
||||||
|
__name__ = 'account.move'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, vlist):
|
||||||
|
pool = Pool()
|
||||||
|
Sequence = pool.get('ir.sequence')
|
||||||
|
Journal = pool.get('account.journal')
|
||||||
|
Account_Configuration = pool.get('account.configuration')
|
||||||
|
configuration = Account_Configuration(1)
|
||||||
|
draft_default = configuration.default_draft_sequence
|
||||||
|
|
||||||
|
vlist = [x.copy() for x in vlist]
|
||||||
|
for vals in vlist:
|
||||||
|
if not vals.get('number'):
|
||||||
|
journal_id = (vals.get('journal')
|
||||||
|
or Transaction().context.get('journal'))
|
||||||
|
if journal_id:
|
||||||
|
journal = Journal(journal_id)
|
||||||
|
if journal.sequence:
|
||||||
|
vals['number'] = Sequence.get_id(draft_default.id)
|
||||||
|
|
||||||
|
moves = super(Move, cls).create(vlist)
|
||||||
|
cls.validate_move(moves)
|
||||||
|
return moves
|
|
@ -0,0 +1,10 @@
|
||||||
|
from trytond.model import fields
|
||||||
|
from trytond.pool import PoolMeta
|
||||||
|
|
||||||
|
__all__ = ['Configuration']
|
||||||
|
|
||||||
|
class Configuration(metaclass=PoolMeta):
|
||||||
|
__name__ = 'account.configuration'
|
||||||
|
|
||||||
|
default_draft_sequence = fields.Many2One(
|
||||||
|
'ir.sequence', "Draft Sequence")
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
<record model="ir.ui.view" id="configuration_view_form">
|
||||||
|
<field name="model">account.configuration</field>
|
||||||
|
<field name="inherit" ref="account.configuration_view_form"/>
|
||||||
|
<field name="name">configuration_form</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</tryton>
|
|
@ -50,6 +50,10 @@ msgctxt "field:party.party,type_person:"
|
||||||
msgid "Type Person"
|
msgid "Type Person"
|
||||||
msgstr "Tipo de Persona"
|
msgstr "Tipo de Persona"
|
||||||
|
|
||||||
|
msgctxt "field:account.configuration,default_draft_sequence:"
|
||||||
|
msgid "Draft Sequence"
|
||||||
|
msgstr "Secuencia Borrador"
|
||||||
|
|
||||||
msgctxt "view:party.party:"
|
msgctxt "view:party.party:"
|
||||||
msgid "Economic Activity"
|
msgid "Economic Activity"
|
||||||
msgstr "Actividad Económica"
|
msgstr "Actividad Económica"
|
||||||
|
|
|
@ -4,6 +4,7 @@ depends:
|
||||||
ir
|
ir
|
||||||
party
|
party
|
||||||
country
|
country
|
||||||
|
account
|
||||||
xml:
|
xml:
|
||||||
party.xml
|
party.xml
|
||||||
address.xml
|
address.xml
|
||||||
|
@ -13,3 +14,4 @@ xml:
|
||||||
municipalities_colombia.xml
|
municipalities_colombia.xml
|
||||||
address_subdivision_types_colombia.xml
|
address_subdivision_types_colombia.xml
|
||||||
tipo_responsabilidad.xml
|
tipo_responsabilidad.xml
|
||||||
|
configuration.xml
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<data>
|
||||||
|
<xpath expr="/form/field[@name='default_supplier_tax_rule']"
|
||||||
|
position="after">
|
||||||
|
<label name="default_draft_sequence"/>
|
||||||
|
<field name="default_draft_sequence"/>
|
||||||
|
</xpath>
|
||||||
|
</data>
|
Loading…
Reference in New Issue