mirror of
https://github.com/NaN-tic/trytond-account_invoice_multisequence-old.git
synced 2023-12-14 03:03:01 +01:00
Add field journal_sequences to fiscalyear
This commit is contained in:
parent
595c107cc8
commit
d772e5fd9d
|
@ -9,5 +9,6 @@ def register():
|
|||
Pool.register(
|
||||
AccountJournalInvoiceSequence,
|
||||
Journal,
|
||||
FiscalYear,
|
||||
Invoice,
|
||||
module='account_invoice_sequence', type_='model')
|
||||
|
|
16
account.py
16
account.py
|
@ -7,7 +7,7 @@ from trytond.pyson import Eval, If
|
|||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
__all__ = ['AccountJournalInvoiceSequence', 'Journal', 'Invoice']
|
||||
__all__ = ['AccountJournalInvoiceSequence', 'Journal', 'FiscalYear', 'Invoice']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
|
@ -72,6 +72,20 @@ class Journal:
|
|||
return getattr(sequence, invoice.type + '_sequence')
|
||||
|
||||
|
||||
class FiscalYear:
|
||||
__name__ = 'account.fiscalyear'
|
||||
journal_sequences = fields.Function(fields.One2Many('ir.sequence.strict',
|
||||
None, 'Journal Sequences'), 'get_journal_sequences')
|
||||
|
||||
def get_journal_sequences(self, name):
|
||||
pool = Pool()
|
||||
InvoiceSequences = pool.get('account.journal.invoice.sequence')
|
||||
sequences = InvoiceSequences.search([('fiscalyear', '=', self.id)])
|
||||
result = [s.out_invoice_sequence.id for s in sequences]
|
||||
result.extend([s.out_credit_note_sequence.id for s in sequences])
|
||||
return result
|
||||
|
||||
|
||||
class Invoice:
|
||||
__name__ = 'account.invoice'
|
||||
|
||||
|
|
|
@ -16,6 +16,12 @@ copyright notices and license terms. -->
|
|||
<field name="type">tree</field>
|
||||
<field name="name">account_journal_invoice_sequence_list</field>
|
||||
</record>
|
||||
<!-- account.fiscalyear -->
|
||||
<record model="ir.ui.view" id="fiscalyear_view_form">
|
||||
<field name="model">account.fiscalyear</field>
|
||||
<field name="inherit" ref="account.fiscalyear_view_form"/>
|
||||
<field name="name">fiscalyear_form</field>
|
||||
</record>
|
||||
<!-- account.journal -->
|
||||
<record model="ir.ui.view" id="journal_view_form">
|
||||
<field name="model">account.journal</field>
|
||||
|
|
12
view/fiscalyear_form.xml
Normal file
12
view/fiscalyear_form.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of the account_invoice_sequence module for Tryton.
|
||||
The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id='sequences']/field[@name='in_credit_note_sequence']"
|
||||
position="after">
|
||||
<newline/>
|
||||
<field name="journal_sequences" colspan="4"/>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in a new issue