invoice numbering module(from 4.2 addons) merge to account
bzr revid: mra@tinyerp.com-20090116062102-ceollow4a2eyc8d1
This commit is contained in:
parent
9f89106631
commit
81632ee871
|
@ -457,6 +457,7 @@ class account_journal(osv.osv):
|
|||
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
|
||||
'entry_posted': fields.boolean('Skip \'Draft\' State for Created Entries', help='Check this box if you don\'t want that new account moves pass through the \'draft\' state and goes direclty to the \'posted state\' without any manual validation.'),
|
||||
'company_id': fields.related('default_credit_account_id','company_id',type='many2one', relation="res.company", string="Company"),
|
||||
'fy_seq_id': fields.one2many('fiscalyear.seq', 'journal_id', 'Sequences'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -269,6 +269,16 @@
|
|||
<field name="group_invoice_lines"/>
|
||||
|
||||
<field name="update_posted"/>
|
||||
<field name="fy_seq_id" colspan="4" widget="one2many_list" >
|
||||
<tree string="Invoice Sequences">
|
||||
<field name="fiscalyear_id"/>
|
||||
<field name="sequence_id"/>
|
||||
</tree>
|
||||
<form string="Invoice Sequences">
|
||||
<field name="fiscalyear_id"/>
|
||||
<field name="sequence_id"/>
|
||||
</form>
|
||||
</field>
|
||||
<field name="entry_posted"/>
|
||||
</page>
|
||||
<page string="Entry Controls">
|
||||
|
|
|
@ -30,6 +30,18 @@ from mx.DateTime import RelativeDateTime
|
|||
from tools import config
|
||||
from tools.translate import _
|
||||
|
||||
class fiscalyear_seq(osv.osv):
|
||||
_name = "fiscalyear.seq"
|
||||
_description = "Maintains Invoice sequences with Fiscal Year"
|
||||
_rec_name = 'fiscalyear_id'
|
||||
_columns = {
|
||||
'journal_id': fields.many2one('account.journal', 'Journal'),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year',required=True),
|
||||
'sequence_id':fields.many2one('ir.sequence', 'Sequence',required=True),
|
||||
}
|
||||
|
||||
fiscalyear_seq()
|
||||
|
||||
class account_invoice(osv.osv):
|
||||
def _amount_all(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
|
@ -621,8 +633,16 @@ class account_invoice(osv.osv):
|
|||
cr.execute('SELECT id, type, number, move_id, reference ' \
|
||||
'FROM account_invoice ' \
|
||||
'WHERE id IN ('+','.join(map(str,ids))+')')
|
||||
obj_inv = self.browse(cr, uid, ids)[0]
|
||||
for (id, invtype, number, move_id, reference) in cr.fetchall():
|
||||
if not number:
|
||||
flag = True
|
||||
for seq in obj_inv.journal_id.fy_seq_id:
|
||||
if seq.fiscalyear_id.id == obj_inv.move_id.period_id.fiscalyear_id.id:
|
||||
number = self.pool.get('ir.sequence').get_id(cr, uid,seq.sequence_id.id)
|
||||
flag = False
|
||||
break
|
||||
if flag:
|
||||
number = self.pool.get('ir.sequence').get(cr, uid,
|
||||
'account.invoice.' + invtype)
|
||||
if invtype in ('in_invoice', 'in_refund'):
|
||||
|
|
Loading…
Reference in New Issue