commited work or Eric Vernichon:

[IMP] possibility to create journal with different sequences when generating chart from chart template
[IMP] invoice printing improved: tax column

and removed print preview

bzr revid: qdp@tinyerp.com-20090121134051-ig56u4k2l4uz73dh
This commit is contained in:
qdp 2009-01-21 14:40:51 +01:00
commit a1ba5b269a
5 changed files with 69 additions and 52 deletions

View File

@ -21,6 +21,7 @@
##############################################################################
import time
import netsvc
from osv import fields, osv
from tools.misc import currency
@ -1175,8 +1176,10 @@ class account_tax_code(osv.osv):
'line_ids': fields.one2many('account.move.line', 'tax_code_id', 'Lines'),
'company_id': fields.many2one('res.company', 'Company', required=True),
'sign': fields.float('Sign for parent', required=True),
'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want that any vat related to this Tax Code appears on invoices"),
}
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
@ -1194,6 +1197,7 @@ class account_tax_code(osv.osv):
_defaults = {
'company_id': _default_company,
'sign': lambda *args: 1.0,
'notprintable': lambda *a: False,
}
def _check_recursion(self, cr, uid, ids):
level = 100
@ -1802,10 +1806,12 @@ class account_tax_code_template(osv.osv):
'parent_id': fields.many2one('account.tax.code.template', 'Parent Code', select=True),
'child_ids': fields.one2many('account.tax.code.template', 'parent_id', 'Childs Codes'),
'sign': fields.float('Sign for parent', required=True),
'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want that any vat related to this Tax Code appears on invoices"),
}
_defaults = {
'sign': lambda *args: 1.0,
'notprintable': lambda *a: False,
}
def name_get(self, cr, uid, ids, context=None):
@ -1990,6 +1996,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'chart_template_id': fields.many2one('account.chart.template','Chart Template',required=True),
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Bank Accounts',required=True),
'code_digits':fields.integer('# of Digits',required=True,help="No. of Digits to use for account code"),
'seq_journal':fields.boolean('Separated Journal Sequences',help="Check this box if you want to use a different sequence for each created journal. Otherwise, all will use the same sequence."),
}
def _get_chart(self, cr, uid, context={}):
@ -2008,6 +2015,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_acc = self.pool.get('account.account')
obj_acc_tax = self.pool.get('account.tax')
obj_journal = self.pool.get('account.journal')
obj_sequence = self.pool.get('ir.sequence')
obj_acc_template = self.pool.get('account.account.template')
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
obj_fiscal_position = self.pool.get('account.fiscal.position')
@ -2120,16 +2128,22 @@ class wizard_multi_charts_accounts(osv.osv_memory):
# Creating Journals
vals_journal={}
view_id = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Journal View')])[0]
seq_id = self.pool.get('ir.sequence').search(cr,uid,[('code','=','account.journal')])[0]
seq_code = self.pool.get('ir.sequence').get(cr, uid, 'account.journal')
seq_id = obj_sequence.search(cr,uid,[('name','=','Account Journal')])[0]
if obj_multi.seq_journal:
seq_id_sale = obj_sequence.search(cr,uid,[('name','=','Sale Journal')])[0]
seq_id_purchase = obj_sequence.search(cr,uid,[('name','=','Purchase Journal')])[0]
else:
seq_id_sale = seq_id
seq_id_purchase = seq_id
vals_journal['view_id']=view_id
vals_journal['sequence_id']=seq_id
vals_journal['view_id'] = view_id
#Sales Journal
vals_journal['name'] = _('Sales Journal')
vals_journal['type'] = 'sale'
vals_journal['code'] = _('SAJ')
vals_journal['sequence_id'] = seq_id_sale
if obj_multi.chart_template_id.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id]
@ -2138,9 +2152,10 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_journal.create(cr,uid,vals_journal)
# Purchase Journal
vals_journal['name']=_('Purchase Journal')
vals_journal['type']='purchase'
vals_journal['code']=_('EXJ')
vals_journal['name'] = _('Purchase Journal')
vals_journal['type'] = 'purchase'
vals_journal['code'] = _('EXJ')
vals_journal['sequence_id'] = seq_id_purchase
if obj_multi.chart_template_id.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
@ -2158,7 +2173,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
#create the account_account for this bank journal
tmp = self.pool.get('res.partner.bank').name_get(cr, uid, [line.acc_no.id])[0][1]
dig = obj_multi.code_digits
vals={
vals = {
'name': line.acc_no.bank and line.acc_no.bank.name+' '+tmp or tmp,
'currency_id': line.currency_id and line.currency_id.id or False,
'code': str(ref_acc_bank.code.ljust(dig,'0') + str(current_num)),
@ -2170,6 +2185,13 @@ class wizard_multi_charts_accounts(osv.osv_memory):
}
acc_cash_id = obj_acc.create(cr,uid,vals)
if obj_multi.seq_journal:
vals_seq={
'name': _('Bank Journal ') + vals['name'],
'code': 'account.journal',
}
seq_id = obj_sequence.create(cr,uid,vals_seq)
#create the bank journal
vals_journal['name']= vals['name']
vals_journal['code']= _('BNK') + str(current_num)
@ -2181,7 +2203,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
else:
vals_journal['view_id'] = view_id_cash
vals_journal['default_credit_account_id'] = acc_cash_id
vals_journal['default_debit_account_id']= acc_cash_id
vals_journal['default_debit_account_id'] = acc_cash_id
obj_journal.create(cr,uid,vals_journal)
current_num += 1

View File

@ -18,13 +18,6 @@
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/',''))"
attachment_use="1"/>
<report
auto="False"
id="account_invoices_preview"
model="account.invoice"
name="account.invoice.preview"
rml="account/report/invoice.rml"
string="Print Preview"/>
<report id="account_transfers" model="account.transfer" name="account.transfer" string="Transfers" xml="account/report/transfer.xml" xsl="account/report/transfer.xsl"/>
<report auto="False" id="account_intracom" menu="False" model="account.move.line" name="account.intracom" string="IntraCom"/>

View File

@ -461,6 +461,7 @@
<field name="code" select="1"/>
<field name="sequence"/>
<field name="sign"/>
<field name="close_method"/>
<field name="partner_account"/>
</form>
@ -539,8 +540,9 @@
<field name="arch" type="xml">
<form string="Account Tax Code">
<field name="name" select="1"/>
<field name="company_id"/>
<field name="code" select="1"/>
<field name="company_id"/>
<field name="notprintable"/>
<field name="parent_id" select="1"/>
<field name="sign"/>
<newline/>
@ -1659,7 +1661,8 @@
<label align="0.0" string="This will automatically configure your chart of accounts, bank accounts, taxes and journals according to the selected template" colspan="4"/>
<field name="company_id" />
<field name ="code_digits" />
<field name="chart_template_id" colspan="4"/>
<field name="chart_template_id"/>
<field name ="seq_journal" />
<field colspan="4" mode="tree" name="bank_accounts_id" nolabel="1" widget="one2many_list">
<form string="Bank Information">
<field name="acc_no"/>

View File

@ -35,10 +35,3 @@ report_sxw.report_sxw(
'addons/account/report/invoice.rml',
parser=account_invoice
)
report_sxw.report_sxw(
'report.account.invoice.preview',
'account.invoice',
'addons/account/report/invoice.rml',
parser=account_invoice
)

View File

@ -287,7 +287,7 @@
<para style="terp_default_Centre_9">[[ o.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ o.date_invoice ]]</para>
<para style="terp_default_Centre_9">[[ o.date_invoice or '' ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ o.address_invoice_id.partner_id.ref or '' ]]</para>
@ -327,22 +327,22 @@
<para style="terp_default_9">[[ l.name ]]</para>
</td>
<td>
<para style="terp_default_9">[[ ', '.join([lt.name for lt in l.invoice_line_tax_id]) or '' ]]</para>
<para style="terp_default_9">[[ ', '.join([ lt.description or '' for lt in l.invoice_line_tax_id ]) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.quantity) or '0.00' ]]</para>
<para style="terp_default_Right_9">[[ l.quantity or 0.00 ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ (l.uos_id and l.uos_id.name) or '' ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.price_unit) or '0.00' ]]</para>
<para style="terp_default_Right_9">[[ l.price_unit or 0.00 ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ l.discount and formatLang (l.discount) or '0.00' ]]</para>
<para style="terp_default_Right_9">[[ l.discount and l.discount or 0.00 ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.price_subtotal) or '0.00' ]]</para>
<para style="terp_default_Right_9">[[ l.price_subtotal or 0.00 ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
@ -418,7 +418,7 @@
<para style="P1">Net Total:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed) or '0.00' ]]</para>
<para style="terp_default_Right_9">[[ o.amount_untaxed or 0.00 ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
@ -434,7 +434,7 @@
<para style="P1">Taxes:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax) or '0.00']]</para>
<para style="terp_default_Right_9">[[ o.amount_tax or 0.00 ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
@ -450,7 +450,7 @@
<para style="P1">Total:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_total) or '0.00' ]]</para>
<para style="terp_default_Right_9">[[ o.amount_total or 0.00]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
@ -464,8 +464,8 @@
<tr>
<td>
<!-- <para style="terp_default_8">[[ format(o.amount_tax) or removeParentNode('blockTable') ]]</para> -->
<blockTable colWidths="54.0,58.0,67.0" style="Table_Tax_Header">
<tr>
<blockTable colWidths="85.0,58.0,67.0" style="Table_Tax_Header">
<tr >
<td>
<para style="terp_tblheader_Details_Centre">Tax</para>
</td>
@ -476,33 +476,39 @@
<para style="terp_tblheader_Details_Right">Amount</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_8">[[ repeatIn(o.tax_line,'t') ]]</para>
<blockTable colWidths="53.0,60.0,65.0" style="Table_Tax_Content">
<tr>
</blockTable>
<blockTable colWidths="85.0,60.0,65.0" style="Table_Tax_Content">
<tr>
<td>
<para style="terp_default_Centre_8">[[ t.name ]]</para>
<para style="terp_default_Centre_8"> </para>
</td>
<td>
<para style="terp_default_Right_8">[[ formatLang(t.base) or '0.00' ]]</para>
<para style="terp_default_Right_8"></para>
</td>
<td>
<para style="terp_default_Right_8">[[ formatLang(t.amount) or '0.00' ]]</para>
<para style="terp_default_Right_8"></para>
</td>
</tr>
</tr>
<tr>
<para style="terp_default_8">[[ repeatIn(o.tax_line,'t') ]]</para>
<td>
<para style="terp_default_Centre_8">[[ lt.description and t.name + ' - ' + lt.description or t.name ]] </para>
</td>
<td>
<para style="terp_default_Right_8">[[ t.base or 0.00 ]] </para>
</td>
<td>
<para style="terp_default_Right_8">[[ t.amount or 0.00 ]] [[ t.tax_code_id.notprintable and removeParentNode('tr') or '' ]]</para>
</td>
</tr>
</blockTable>
</td>
</tr>
<tr>
<td>
<blockTable colWidths="53.0,60.0,65.0" style="Table_Table_Border_White">
<blockTable colWidths="85.0,60.0,65.0" style="Table_Table_Border_White">
<tr>
<td>
<para style="terp_default_2">