bzr revid: fp@tinyerp.com-20090126212804-g5h7ksln2v5mmiga
This commit is contained in:
Fabien Pinckaers 2009-01-26 22:28:04 +01:00
parent c85a9033c6
commit 39ead43636
7 changed files with 13 additions and 52 deletions

View File

@ -29,8 +29,8 @@ import account_move_line
import account_analytic_line
import wizard
import report
import product
import sequence
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -58,7 +58,8 @@
'account_assert_test.xml',
'process/statement_process.xml',
'process/customer_invoice_process.xml',
'process/supplier_invoice_process.xml'
'process/supplier_invoice_process.xml',
'sequence_view.xml'
],
'demo_xml': [
'account_demo.xml',

View File

@ -460,7 +460,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'),
'invoice_sequence_id': fields.many2one('ir.sequence', 'Sequence'),
}
_defaults = {
@ -789,7 +789,8 @@ class account_move(osv.osv):
new_name = False
journal = move.journal_id
if journal.sequence_id:
new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c)
else:
raise osv.except_osv(_('Error'), _('No sequence defined in the journal !'))
if new_name:
@ -1529,11 +1530,7 @@ class account_model(osv.osv):
if not period_id:
raise osv.except_osv('No period found !', 'Unable to find a valid period !')
period_id = period_id[0]
name = model.name
if model.journal_id.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, model.journal_id.sequence_id.id)
move_id = self.pool.get('account.move').create(cr, uid, {
'name': name,
'ref': model.ref,
'period_id': period_id,
'journal_id': model.journal_id.id,
@ -1560,8 +1557,7 @@ class account_model(osv.osv):
c = context.copy()
c.update({'journal_id': model.journal_id.id,'period_id': period_id})
self.pool.get('account.move.line').create(cr, uid, val, context=c)
return move_ids
return move_ids
account_model()
class account_model_line(osv.osv):

View File

@ -610,14 +610,7 @@ class account_move_line(osv.osv):
})
]
name = 'Write-Off'
if writeoff_journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, writeoff_journal_id)
if journal.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
writeoff_move_id = self.pool.get('account.move').create(cr, uid, {
'name': name,
'period_id': writeoff_period_id,
'journal_id': writeoff_journal_id,

View File

@ -262,10 +262,11 @@
<notebook colspan="4">
<page string="General Information">
<field name="view_id"/>
<field name="currency"/>
<field name="sequence_id"/>
<field name="invoice_sequence_id"/>
<field name="default_debit_account_id" attrs="{'required':[('type','=','cash')]}" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="default_credit_account_id" attrs="{'required':[('type','=','cash')]}" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="currency"/>
<field name="user_id" groups="base.group_extended"/>
<newline/>
<field name="centralisation"/>
@ -273,16 +274,6 @@
<field name="update_posted"/>
<field name="entry_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>
</page>
<page string="Entry Controls">
<separator colspan="4" string="Accounts Type Allowed (empty for no control)"/>

View File

@ -635,9 +635,6 @@ class account_invoice(osv.osv):
for i in line:
i[2]['period_id'] = period_id
if not 'name' in move:
move['name'] = inv.name or '/'
move_id = self.pool.get('account.move').create(cr, uid, move)
new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name
# make the invoice point to that move
@ -673,13 +670,10 @@ class account_invoice(osv.osv):
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:
if obj_inv.journal_id.invoice_sequence_id:
sid = obj_inv.journal_id.invoice_sequence_id.id
number = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id=%s', {'fiscalyear_id': obj.period_id.fiscalyear_id.id})
else:
number = self.pool.get('ir.sequence').get(cr, uid,
'account.invoice.' + invtype)
if invtype in ('in_invoice', 'in_refund'):

View File

@ -54,21 +54,7 @@ def _create_entries(self, cr, uid, data, context):
if not period_id:
raise wizard.except_wizard('No period found !', 'Unable to find a valid period !')
period_id = period_id[0]
name = model.name
if model.journal_id.sequence_id:
name_seq = pool_obj.get('ir.sequence').get_id(cr, uid, model.journal_id.sequence_id.id)
if name.find("%(year)s") != -1:
name=name.decode('utf-8').replace("%(year)s",str(time.strftime("%Y")))
if name.find("%(month)s") != -1:
name=name.decode('utf-8').replace("%(month)s",str(time.strftime("%B")))
if name.find("%(date)s") != -1:
name=name.decode('utf-8').replace("%(date)s",str(time.strftime("%Y-%m-%d")))
move_id = pool_obj.get('account.move').create(cr, uid, {
'name': str(name_seq) + " : " +name,
'ref': model.ref,
'period_id': period_id,
'journal_id': model.journal_id.id,