[MEREG] Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons3

bzr revid: sbh@tinyerp.com-20100601062535-1lgp1ka1gg0t29tv
This commit is contained in:
sbh (Open ERP)
2010-06-01 11:55:35 +05:30
142 changed files with 7659 additions and 1733 deletions
+1
View File
@@ -32,5 +32,6 @@ import report
import product
import sequence
import company
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+4
View File
@@ -121,6 +121,10 @@ module named account_voucherss
'demo/account_minimal.xml',
'account_unit_test.xml',
],
'test': [
'test/account_customer_invoice.yml',
'test/account_supplier_invoice.yml',
],
'installable': True,
'active': False,
'certificate': '0080331923549',
+31 -8
View File
@@ -124,10 +124,10 @@ class account_account_type(osv.osv):
'sign': fields.selection([(-1, 'Negative'), (1, 'Positive')], 'Sign on Reports', required=True, help='Allows you to change the sign of the balance amount displayed in the reports, so that you can see positive figures instead of negative ones in expenses accounts.'),
'report_type':fields.selection([
('none','/'),
('income','Profilt & Loss (Income Accounts)'),
('expanse','Profilt & Loss (Expanse Accounts)'),
('income','Profit & Loss (Income Accounts)'),
('expense','Profit & Loss (Expense Accounts)'),
('asset','Balance Sheet (Assets Accounts)'),
('liabilities','Balance Sheet (Liabilities Accounts)')
('liability','Balance Sheet (Liability Accounts)')
],'Type Heads', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)"),
'parent_id':fields.many2one('account.account.type', 'Parent Type', required=False),
'child_ids':fields.one2many('account.account.type', 'parent_id', 'Child Types', required=False),
@@ -171,6 +171,19 @@ class account_account(osv.osv):
_description = "Account"
_parent_store = True
def _get_children_and_consol(self, cr, uid, ids, context={}):
ids2=[]
temp=[]
read_data= self.read(cr, uid, ids,['id','child_id'], context)
for data in read_data:
ids2.append(data['id'])
if data['child_id']:
temp=[]
for x in data['child_id']:
temp.append(x)
ids2 += self._get_children_and_consol(cr, uid, temp, context)
return ids2
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
if context is None:
@@ -297,6 +310,17 @@ class account_account(osv.osv):
return result
def _get_level(self, cr, uid, ids, field_name, arg, context={}):
res={}
accounts = self.browse(cr, uid, ids)
for account in accounts:
level = 0
if account.parent_id :
obj = self.browse(cr, uid, account.parent_id.id)
level = obj.level + 1
res[account.id] = level
return res
_columns = {
'name': fields.char('Name', size=128, required=True, select=True),
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
@@ -343,6 +367,7 @@ class account_account(osv.osv):
'check_history': fields.boolean('Display History',
help="Check this box if you want to print all entries when printing the General Ledger, "\
"otherwise it will only print its balance."),
'level': fields.function(_get_level, string='Level', method=True, store=True, type='integer'),
}
def _default_company(self, cr, uid, context={}):
@@ -534,7 +559,7 @@ class account_journal(osv.osv):
_columns = {
'name': fields.char('Journal Name', size=64, required=True, translate=True),
'code': fields.char('Code', size=16),
'type': fields.selection([('sale', 'Sale'), ('purchase', 'Purchase'), ('cash', 'Cash'), ('general', 'General'), ('situation', 'Situation')], 'Type', size=32, required=True,
'type': fields.selection([('sale', 'Sale'), ('purchase', 'Purchase'), ('expanse', 'Expanse'), ('cash', 'Cash'), ('bank', 'Bank'), ('general', 'General'), ('situation', 'Situation')], 'Type', size=32, required=True,
help="Select 'Sale' for Sale journal to be used at the time of making invoice."\
" Select 'Purchase' for Purchase Journal to be used at the time of approving purchase order."\
" Select 'Cash' to be used at the time of making payment."\
@@ -892,7 +917,7 @@ class account_move(osv.osv):
'to_check': fields.boolean('To Be Verified'),
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"),
'amount': fields.function(_amount_compute, method=True, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),
'date': fields.date('Date', required=True),
'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}),
'type': fields.selection([
('pay_voucher','Cash Payment'),
('bank_pay_voucher','Bank Payment'),
@@ -902,7 +927,7 @@ class account_move(osv.osv):
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
],'Type', readonly=True, select=True, states={'draft':[('readonly',False)]}),
],'Entry Type', select=True , size=128, readonly=True, states={'draft':[('readonly',False)]}),
'narration':fields.text('Narration', readonly=True, select=True, states={'draft':[('readonly',False)]}),
'company_id': fields.related('journal_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
}
@@ -1416,7 +1441,6 @@ class account_tax(osv.osv):
'include_base_amount': fields.boolean('Included in base amount', help="Indicates if the amount of tax must be included in the base amount for the computation of the next taxes"),
'company_id': fields.many2one('res.company', 'Company', required=True),
'description': fields.char('Tax Code',size=32),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Application', required=True)
}
@@ -1449,7 +1473,6 @@ class account_tax(osv.osv):
'applicable_type': lambda *a: 'true',
'type': lambda *a: 'percent',
'amount': lambda *a: 0,
'price_include': lambda *a: 0,
'active': lambda *a: 1,
'type_tax_use': lambda *a: 'all',
'sequence': lambda *a: 1,
+11 -11
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -43,22 +43,22 @@ class account_analytic_line(osv.osv):
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
}
}
_order = 'date'
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
if context.get('from_date',False):
args.append(['date', '>=',context['from_date']])
if context.get('to_date',False):
args.append(['date','<=',context['to_date']])
return super(account_analytic_line, self).search(cr, uid, args, offset, limit,
order, context=context, count=count)
def _check_company(self, cr, uid, ids):
lines = self.browse(cr, uid, ids)
for l in lines:
@@ -68,7 +68,7 @@ class account_analytic_line(osv.osv):
_constraints = [
# (_check_company, 'You can not create analytic line that is not in the same company than the account line', ['account_id'])
]
# Compute the cost based on the price type define into company
# property_valuation_price_type property
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id,
@@ -90,7 +90,7 @@ class account_analytic_line(osv.osv):
(prod.name, prod.id,))
if not company_id:
company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context)
# Compute based on pricetype
pricetype=self.pool.get('product.price.type').browse(cr,uid,company_obj.browse(cr,uid,company_id).property_valuation_price_type.id)
# Take the company currency as the reference one
@@ -164,10 +164,10 @@ timesheet_invoice()
class res_partner(osv.osv):
""" Inherits partner and adds contract information in the partner form """
_inherit = 'res.partner'
_columns = {
'contract_ids': fields.one2many('account.analytic.account', \
'partner_id', 'Contracts', readonly=True),
'partner_id', 'Contracts', readonly=True),
}
res_partner()
+41 -21
View File
@@ -141,11 +141,12 @@
<field name="priority">2</field>
<field name="arch" type="xml">
<form string="Supplier invoice">
<group col="6" colspan="4">
<group col="8" colspan="4">
<field domain="[('type', '=', 'purchase')]" name="journal_id"/>
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="gtk-apply" string="Change Currency"/>
<newline/>
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" context="{'default_customer': 0}"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
@@ -201,9 +202,11 @@
<field name="residual"/>
<group col="3" colspan="4">
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-apply"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='paid' icon="gtk-execute"/>
</group>
</group>
</page>
@@ -247,22 +250,22 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice">
<group colspan="4" col="6">
<field name="journal_id" groups="base.group_user"/>
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)"/>
<newline/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" groups="base.group_user"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="base.group_user"/>
<group colspan="2" col="1" groups="base.group_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
<group colspan="4" col="8">
<field name="journal_id" groups="base.group_user"/>
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="gtk-apply" string="Change Currency"/>
<newline/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" groups="base.group_user"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="base.group_user"/>
<group colspan="2" col="1" groups="base.group_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
</group>
<notebook colspan="4">
<page string="Invoice">
@@ -290,12 +293,14 @@
<field name="amount_total"/>
<field name="state"/>
<field name="residual"/>
<group col="3" colspan="4" groups="base.group_user">
<group col="4" colspan="4" groups="base.group_user">
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="gtk-print"/>
<button name="invoice_open" states="draft,proforma2" string="Create" icon="gtk-execute"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='paid' icon="gtk-execute"/>
</group>
</group>
</page>
@@ -478,8 +483,23 @@
<act_window domain="[('journal_id','=',active_id),('state','!=','draft'),('reconciled','=',False)]" id="act_account_journal_2_account_invoice_opened" name="Unpaid invoices" res_model="account.invoice" src_model="account.journal"/>
<act_window domain="[('account_analytic_id', '=', active_id)]" id="act_account_analytic_account_2_account_invoice_line" name="Invoice lines" res_model="account.invoice.line" src_model="account.analytic.account"/>
<act_window domain="[('partner_id', '=', partner_id), ('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id','=',False)]" id="act_account_invoice_account_move_unreconciled" name="Unreconciled Receivables &amp; Payables" res_model="account.move.line" src_model="account.invoice"/>
<act_window domain="[('partner_id', '=', partner_id), ('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id','=',False)]" id="act_account_invoice_account_move_unreconciled" name="Unreconciled Receivables &amp; Payables" res_model="account.move.line" src_model="account.invoice"/>
<!-- Partners inherited form -->
<record id="view_invoice_partner_info_form" model="ir.ui.view">
<field name="name">res.partner.invoice.info.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Account Info">
<field name="invoice_ids" colspan="4" nolabel="1" context="{'group_by':'product_id'}"/>
</page>
</notebook>
</field>
</record>
</data>
</openerp>
+32 -23
View File
@@ -23,21 +23,30 @@
<report auto="False" id="account_intracom" menu="False" model="account.move.line" name="account.intracom" string="IntraCom"/>
<report id="account_move_line_list" model="account.tax.code" name="account.tax.code.entries" rml="account/report/account_tax_code.rml" string="All Entries"/>
<report
auto="False"
id="account_vat_declaration"
menu="False"
model="account.tax.code"
name="account.vat.declaration"
rml="account/report/tax_report.rml"
string="Taxes Report"/>
auto="False"
id="account_vat_declaration"
menu="False"
model="account.tax.code"
name="account.vat.declaration"
rml="account/report/tax_report.rml"
string="Taxes Report"/>
<report id="report_account_voucher_new"
string="Print Voucher"
model="account.move"
name="account.move.voucher"
rml="account/report/voucher_print.rml"
auto="False"
header = "False"
menu="True"/>
<menuitem
id="menu_tax_report"
name="Taxes"
parent="account.menu_finance_generic_reporting" sequence="3"/>
<!-- <wizard
id="wizard_vat_declaration"
menu="False"
@@ -68,20 +77,20 @@
<report id="account_account_balance_compare"
string="Account balance"
model="account.account"
name="account.balance.account.balance"
rml="account/report/compare_account_balance.rml"
auto="False"
menu="False"/>
string="Account balance"
model="account.account"
name="account.balance.account.balance"
rml="account/report/compare_account_balance.rml"
auto="False"
menu="False"/>
<report id="account_account_balance_landscape"
string="Account balance"
model="account.account"
name="account.account.balance.landscape"
rml="account/report/account_balance_landscape.rml"
auto="False"
menu="False"/>
<report id="account_account_balance_landscape"
string="Account balance"
model="account.account"
name="account.account.balance.landscape"
rml="account/report/account_balance_landscape.rml"
auto="False"
menu="False"/>
<!--
+119 -86
View File
@@ -135,8 +135,10 @@
<field name="check_history"/>
<field name="type" select="1"/>
<newline/>
<field colspan="4" name="tax_ids" domain="[('parent_id','=',False)]"/>
<field name="child_consol_ids" colspan="4" attrs="{'readonly':[('type','!=','consolidation')]}"/>
<separator string="Default Taxes" colspan="4"/>
<field colspan="4" name="tax_ids" nolabel="1" domain="[('parent_id','=',False)]"/>
<separator string="Consolidated Children" colspan="4"/>
<field name="child_consol_ids" colspan="4" nolabel="1" attrs="{'readonly':[('type','!=','consolidation')]}"/>
</page>
<page string="Notes">
<field colspan="4" name="note" nolabel="1"/>
@@ -146,7 +148,7 @@
</field>
</record>
<record id="view_account_search" model="ir.ui.view">
<record id="view_account_search" model="ir.ui.view">
<field name="name">account.account.search</field>
<field name="model">account.account</field>
<field name="type">search</field>
@@ -239,7 +241,7 @@
<field name="arch" type="xml">
<form string="Journal View">
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="columns_id" widget="one2many_list"/>
<field colspan="4" name="columns_id" nolabel="1" widget="one2many_list"/>
</form>
</field>
</record>
@@ -277,20 +279,41 @@
<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="user_id" groups="base.group_extended"/>
<field name="allow_date" groups="base.group_extended"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<field name="centralisation"/>
<field name="group_invoice_lines"/>
<field name="update_posted"/>
<field name="entry_posted"/>
<group colspan="2" col="2">
<separator string="Journal View" colspan="4"/>
<field name="view_id"/>
</group>
<group colspan="2" col="2">
<separator string="Sequence" colspan="4"/>
<field name="sequence_id"/>
<field name="invoice_sequence_id"/>
</group>
<group colspan="2" col="2">
<separator string="Accounts" colspan="4"/>
<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')]"/>
</group>
<group colspan="2" col="2">
<separator string="Validations" colspan="4"/>
<field name="allow_date" groups="base.group_extended"/>
</group>
<group colspan="2" col="2">
<separator string="Company" colspan="4"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="user_id" groups="base.group_extended"/>
<field name="currency"/>
</group>
<group colspan="2" col="2">
<separator string="Other Configuration" colspan="4"/>
<field name="centralisation"/>
<field name="group_invoice_lines"/>
<field name="update_posted"/>
<field name="entry_posted"/>
</group>
</page>
<page string="Entry Controls">
<separator colspan="4" string="Accounts Type Allowed (empty for no control)"/>
@@ -342,7 +365,7 @@
<group colspan="2" col="3">
<!-- <button name="%(action_view_account_statement_from_invoice)d"-->
<!-- string="Import Invoice" type="action" attrs="{'invisible':[('state','=','confirm')]}" icon="gtk-open"/>-->
<button name="button_import_invoice" string="Import Invoice" attrs="{'invisible':[('state','=','confirm')]}" type="object" icon="gtk-apply"/>
<button name="button_import_invoice" string="Import Invoice" attrs="{'invisible':[('state','=','confirm')]}" type="object" icon="gtk-apply"/>
</group>
<newline/>
<field name="balance_start"/>
@@ -600,7 +623,6 @@
<field name="arch" type="xml">
<tree string="Account Tax">
<field name="name"/>
<field name="price_include"/>
<field name="description"/>
</tree>
</field>
@@ -632,7 +654,6 @@
<label colspan="2" nolabel="1" string="Keep empty to use the expense account"/>
<field groups="base.group_extended" name="child_depend"/>
<field groups="base.group_extended" name="sequence"/>
<field groups="base.group_extended" name="price_include"/>
<field name="type_tax_use"/>
<newline/>
<field colspan="4" groups="base.group_extended" name="child_ids"/>
@@ -806,7 +827,7 @@
</field>
</record>
<record id="view_account_move_line_filter" model="ir.ui.view">
<record id="view_account_move_line_filter" model="ir.ui.view">
<field name="name">Entry Lines</field>
<field name="model">account.move.line</field>
<field name="type">search</field>
@@ -860,6 +881,7 @@
<field name="ref"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="type" invisible=" not context.get('set_visible',True)"/>
<field name="partner_id"/>
<field name="line_id"/>
<field name="to_check" groups="base.group_extended"/>
@@ -874,72 +896,76 @@
<field name="model">account.move</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Entry">
<form string="Journal Entries">
<group colspan="4" col="6">
<field name="name" select="1" readonly="True"/>
<field name="period_id"/>
<field name="journal_id" select="1"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="date" select="1"/>
<field name="ref" select="1"/>
<field name="to_check"/>
<field name="type" groups="base.group_extended"/>
<field name="name" select="1" colspan="4" readonly="True"/>
<field name="journal_id" select="1"/>
<field name="period_id"/>
<field name="type"/>
<field name="ref" select="1"/>
</group>
<field name="partner_id" invisible="1" select="1"/>
<field name="amount" invisible="1" select="1"/>
<notebook colspan="4">
<page string="Journal Entries Lines">
<field colspan="4" height="200" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<form string="Account Entry Line">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
<field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,parent.date,parent.journal_id)"/>
<field colspan="4" height="250" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<form string="Account Entry Line">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
<field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,parent.date,parent.journal_id)"/>
<field name="debit" select="1"/>
<field name="credit" select="1"/>
<field name="date" select="1"/>
<field name="debit" select="1"/>
<field name="credit" select="1"/>
<field name="date" select="1"/>
<separator colspan="4" string="Optional Information"/>
<field name="currency_id"/>
<field name="amount_currency"/>
<field name="quantity" select="1"/>
<newline/>
<field name="date_maturity"/>
<field name="date_created"/>
<separator colspan="4" string="Optional Information"/>
<field name="currency_id"/>
<field name="amount_currency"/>
<field name="quantity" select="1"/>
<newline/>
<field name="date_maturity"/>
<field name="date_created"/>
<separator colspan="4" string="State"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
<field name="statement_id"/>
<field name="state"/>
</form>
<tree editable="top" string="Account Entry Line">
<field name="ref"/>
<field name="invoice"/>
<field name="name"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,parent.date,parent.journal_id)"/>
<field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
<field name="date_maturity"/>
<field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/>
<field name="analytic_account_id"/>
<field name="amount_currency" groups="base.group_extended"/>
<field name="currency_id" groups="base.group_extended"/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="state"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id" groups="base.group_extended"/>
</tree>
</field>
<separator colspan="4" string="Narration"/>
<field name="narration" colspan="4" nolabel="1"/>
<separator colspan="4" string="State"/>
<field name="state" select="1"/>
<group col="2" colspan="2">
<button name="button_validate" states="draft" string="Validate" type="object" icon="gtk-execute"/>
<button name="button_cancel" states="posted" string="Cancel" type="object" icon="gtk-cancel"/>
</group>
<separator colspan="4" string="State"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
<field name="statement_id"/>
<field name="state"/>
</form>
<tree editable="top" string="Account Entry Line">
<field name="ref"/>
<field name="invoice"/>
<field name="name"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,parent.date,parent.journal_id)"/>
<field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
<field name="date_maturity"/>
<field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/>
<field name="analytic_account_id"/>
<field name="amount_currency" groups="base.group_extended"/>
<field name="currency_id" groups="base.group_extended"/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="state"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id" groups="base.group_extended"/>
</tree>
</field>
<separator colspan="4" string="Narration"/>
<field name="narration" colspan="4" nolabel="1"/>
<field name="state" select="1"/>
<group col="2" colspan="2">
<button name="button_validate" states="draft" string="Validate" type="object" icon="gtk-execute"/>
<button name="button_cancel" states="posted" string="Cancel" type="object" icon="gtk-cancel"/>
</group>
</page>
<page string="Other Information">
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="date" select="1" groups="base.group_extended"/>
<field name="to_check" groups="base.group_extended"/>
<field name="partner_id" invisible="1" select="1"/>
<field name="amount" invisible="1" select="1"/>
</page>
</notebook>
</form>
</field>
</record>
@@ -959,6 +985,13 @@
<field name="journal_id" select='1'/>
<field name="partner_id" select='1'/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-account" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-account" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Type" icon="terp-account" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
<filter string="States" icon="terp-account" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
@@ -975,7 +1008,7 @@
<menuitem action="action_move_line_form" id="menu_action_move_line_form" parent="next_id_29"/>
<record id="action_move_line_form_encode_by_move" model="ir.actions.act_window">
<field name="name">Entries by Move</field>
<field name="name">Journal Entries</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
@@ -1085,8 +1118,8 @@
<!-- bank reconsilation -->
<menuitem action="action_account_bank_reconcile_tree"
id="menu_action_account_bank_reconcile_check_tree"
parent="account.next_id_30" />
id="menu_action_account_bank_reconcile_check_tree"
parent="account.next_id_30" />
<act_window
+1
View File
@@ -39,5 +39,6 @@ import account_analytic_report
import account_account_report
import account_entries_report
import account_analytic_entries_report
import voucher_print
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+32 -12
View File
@@ -36,10 +36,12 @@ class account_invoice_report(osv.osv):
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'product_qty':fields.float('Qty', readonly=True),
'uom_name': fields.char('Default UoM', size=128, readonly=True),
'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True),
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')],readonly=True),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position',readonly=True),
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
'categ_id': fields.many2one('product.category','Category of Product', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal',readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
@@ -81,46 +83,64 @@ class account_invoice_report(osv.osv):
to_char(s.date_invoice, 'MM') as month,
to_char(s.date_invoice, 'YYYY-MM-DD') as day,
l.product_id as product_id,
sum(l.quantity * u.factor) as product_qty,
sum(case when s.type in ('out_refund','in_invoice') then
l.quantity * u.factor * -1
else
l.quantity * u.factor
end) as product_qty,
s.partner_id as partner_id,
s.payment_term as payment_term,
s.period_id as period_id,
u.name as uom_name,
s.currency_id as currency_id,
s.journal_id as journal_id,
s.fiscal_position as fiscal_position,
s.user_id as user_id,
s.company_id as company_id,
sum(l.quantity*l.price_unit) as price_total,
(sum(l.quantity*l.price_unit)/sum(l.quantity * u.factor))::decimal(16,2) as price_average,
sum(case when s.type in ('out_refund','in_invoice') then
l.quantity*l.price_unit * -1
else
l.quantity*l.price_unit
end) as price_total,
sum(case when s.type in ('out_refund','in_invoice') then
l.quantity*l.price_unit * -1
else
l.quantity*l.price_unit
end) / sum(l.quantity * u.factor)::decimal(16,2) as price_average,
count(*) as nbr,
s.type as type,
s.state,
pt.categ_id,
s.date_due as date_due,
s.address_contact_id as address_contact_id,
s.address_invoice_id as address_invoice_id,
s.account_id as account_id,
s.partner_bank as partner_bank,
s.residual as residual,
sum(case when s.type in ('out_refund','in_invoice') then
s.residual * -1
else
s.residual
end) as residual,
case when s.state != 'paid' then null else
extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2)
extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2)
end as delay_to_pay
from
account_invoice_line l
left join
account_invoice s on (s.id=l.invoice_id)
left join product_uom u on (u.id=l.uos_id),
from account_invoice_line l
left join account_invoice s on (s.id=l.invoice_id)
left join product_template pt on (pt.id=l.product_id)
left join product_uom u on (u.id=l.uos_id),
account_move_line am left join account_invoice i on (i.move_id=am.move_id)
where
am.account_id=i.account_id
where am.account_id=i.account_id
group by
s.type,
s.date_invoice,
s.partner_id,
l.product_id,
u.name,
l.uos_id,
s.user_id,
s.state,
s.residual,
pt.categ_id,
s.company_id,
s.payment_term,
s.period_id,
@@ -16,8 +16,10 @@
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_qty" invisible="1"/>
<field name="uom_name" invisible="not context.get('set_visible',False)"/>
<field name="categ_id" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="product_qty"/>
<field name="price_average" avg="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="state" invisible="1"/>
@@ -97,16 +99,17 @@
<group expand="1" string="Group By...">
<filter string="Salesman" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id','set_visible':True}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<filter string="Type" icon="terp-account" context="{'group_by':'type'}"/>
<separator orientation="vertical"/>
<filter string="Default UoM" icon="terp-account" context="{'group_by':'uom_name'}"/>
<filter string="Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Account" icon="terp-account" context="{'group_by':'account_id'}"/>
<filter string="Bank Account" icon="terp-account" context="{'group_by':'partner_bank'}"/>
<separator orientation="vertical"/>
<filter string="Category of Product" icon="terp-account" context="{'group_by':'categ_id'}"/>
<filter string="Currency" icon="terp-account" context="{'group_by':'currency_id'}"/>
<filter string="Force Period" icon="terp-account" context="{'group_by':'period_id'}"/>
<newline/>
+62
View File
@@ -0,0 +1,62 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher_move(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher_move, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'convert':self.convert,
'debit':self.debit,
'credit':self.credit,
#'get_ref' : self._get_ref
})
self.user=uid
def convert(self,amount):
user_id = self.pool.get('res.users').browse(self.cr, self.user,[self.user])[0]
cur = user_id.company_id.currency_id.name
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
return amt_en
def debit(self, move_ids):
debit = 0.0
for move in move_ids:
debit +=move.debit
return debit
def credit(self, move_ids):
credit = 0.0
for move in move_ids:
credit +=move.credit
return credit
report_sxw.report_sxw(
'report.account.move.voucher',
'account.move',
'addons/account/report/voucher_print.rml',
parser=report_voucher_move,header=False
)
+436
View File
@@ -0,0 +1,436 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Heading1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="last_info">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,6" stop="0,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,6" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,6" stop="1,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,6" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,6" stop="2,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica-Bold" fontSize="22.0" leading="27" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P13" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P15" fontName="Helvetica" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P16" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P17" fontName="Helvetica-Bold" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P18" fontName="Helvetica" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P19" fontName="Helvetica" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P20" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P21" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P22" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P23" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P24" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P25" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P26" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P27" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P28" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Drawing" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Header" fontName="Helvetica"/>
<paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13"/>
<paraStyle name="Addressee" fontName="Helvetica" spaceBefore="0.0" spaceAfter="3.0"/>
<paraStyle name="Signature" fontName="Helvetica"/>
<paraStyle name="Heading 8" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 7" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 6" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 5" fontName="Helvetica-Bold" fontSize="85%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 4" fontName="Helvetica-BoldOblique" fontSize="85%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 10" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Salutation" fontName="Helvetica"/>
<paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_9_30" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="P5">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P6">[[ company.name ]]</para>
<para style="P8">[[ company.partner_id.address and company.partner_id.address[0].street ]]</para>
<para style="P8">[[ company.partner_id.address and company.partner_id.address[0].zip ]] [[ company.partner_id.address and company.partner_id.address[0].city ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name ]]</para>
<para style="P8">[[ company.partner_id.address and company.partner_id.address[0].phone ]]</para>
<para style="P8">[[ company.partner_id.address and company.partner_id.address[0].email ]]</para>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P21">Cash Receipt Voucher [[ (voucher.type == 'rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Cash Payment Voucher [[ (voucher.type == 'pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P21">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Bank Payment Voucher [[ (voucher.type == 'bank_pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Contra Voucher [[ (voucher.type == 'cont_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Journal Sale Voucher [[ (voucher.type == 'journal_sale_vou' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Journal Purchase Voucher [[ (voucher.type == 'journal_pur_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Journal Voucher [[ (voucher.type == 'journal_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P20">
<font color="white"> </font>
</para>
<blockTable colWidths="49.0,143.0,116.0,69.0,106.0" style="Table1">
<tr>
<td>
<para style="P12">Name:</para>
</td>
<td>
<para style="P13">[[ voucher.name ]]</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P12">Dated :</para>
</td>
<td>
<para style="P13">[[ time.strftime('%d %B,%Y', time.strptime(voucher.date , '%Y-%m-%d')) or '' ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P12">State :</para>
</td>
<td>
<para style="P3">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P3">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P3">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P3">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P12">Ref. :</para>
</td>
<td>
<para style="P13">[[ voucher.ref]]</para>
</td>
</tr>
</blockTable>
<para style="P15">
<font color="white"> </font>
</para>
<para style="P15">
<font color="white"> </font>
</para>
<blockTable colWidths="275.0,106.0,102.0" style="Heading1">
<tr>
<td>
<para style="terp_tblheader_Details">Particulars</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Debit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Credit</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_8">[[ repeatIn(voucher.line_id,'line_id') ]]</para>
<blockTable colWidths="274.0,106.0,102.0" style="Table2">
<tr>
<td>
<para style="terp_default_Bold_9">[[ (line_id.partner_id and line_id.partner_id.name) or 'Account']]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(line_id.debit) ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(line_id.credit) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_30">[[ line_id.account_id.name ]] </para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_30">[[ line_id.name ]]-[[voucher.ref]]</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="275.0,106.0,102.0" style="last_info">
<tr>
<td>
<para style="P16">Through : </para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P22">[[ voucher.narration or '']]</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P16">On Account of : </para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P25">[[ voucher.line_id and voucher.line_id.name and voucher.line_id.name[1] or removeParentNode('para') ]]</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P16">Amount (in words) : </para>
</td>
<td>
<para style="P16">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P16">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P26">[[ convert(voucher.amount) ]]</para>
</td>
<td>
<para style="P15">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P15">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P17">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ formatLang(debit(voucher.line_id))]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ formatLang(credit(voucher.line_id)) ]]</para>
</td>
</tr>
</blockTable>
<para style="P18">
<font color="white"> </font>
</para>
<blockTable colWidths="142.0,99.0,105.0,136.0" style="Table3">
<tr>
<td>
<para style="P9">
<font color="white"> </font>
</para>
<para style="P9">
<font color="white"> </font>
</para>
<para style="P9">
<font color="white"> </font>
</para>
<para style="P9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P11">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P20">Receiver's Signature</para>
</td>
<td>
<para style="P20">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P20">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P20">Authorised Signatory</para>
</td>
</tr>
</blockTable>
<para style="P1">
<font color="white"> </font>
</para>
</story>
</document>
+166
View File
@@ -0,0 +1,166 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from report import report_sxw
import xml.dom.minidom
import os, time
import osv
import re
import tools
import pooler
import re
import sys
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(rml_parse, self).__init__(cr, uid, name, context=None)
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
'strip_name' : self._strip_name,
'explode_name' : self._explode_name,
})
def comma_me(self,amount):
#print "#" + str(amount) + "#"
if not amount:
amount = 0.0
if type(amount) is float :
amount = str('%.2f'%amount)
else :
amount = str(amount)
if (amount == '0'):
return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
return new
else:
return self.comma_me(new)
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
ellipsis = ellipsis or ''
try:
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
except Exception, e:
return False
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, '...')
def _get_and_change_date_format_for_swiss (self,date_to_format):
date_formatted=''
if date_to_format:
date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
return date_formatted
def _explode_name(self,chaine,length):
# We will test if the size is less then account
full_string = ''
if (len(str(chaine)) <= length):
return chaine
#
else:
chaine = unicode(chaine,'utf8').encode('iso-8859-1')
rup = 0
for carac in chaine:
rup = rup + 1
if rup == length:
full_string = full_string + '\n'
full_string = full_string + carac
rup = 0
else:
full_string = full_string + carac
return full_string
def makeAscii(self,str):
try:
Stringer = str.encode("utf-8")
except UnicodeDecodeError:
try:
Stringer = str.encode("utf-16")
except UnicodeDecodeError:
print "UTF_16 Error"
Stringer = str
else:
return Stringer
else:
return Stringer
return Stringer
def explode_this(self,chaine,length):
#chaine = self.repair_string(chaine)
chaine = rstrip(chaine)
ast = list(chaine)
i = length
while i <= len(ast):
ast.insert(i,'\n')
i = i + length
chaine = str("".join(ast))
return chaine
def repair_string(self,chaine):
ast = list(chaine)
UnicodeAst = []
_previouslyfound = False
i = 0
#print str(ast)
while i < len(ast):
elem = ast[i]
try:
Stringer = elem.encode("utf-8")
except UnicodeDecodeError:
to_reencode = elem + ast[i+1]
print str(to_reencode)
Good_char = to_reencode.decode('utf-8')
UnicodeAst.append(Good_char)
i += i +2
else:
UnicodeAst.append(elem)
i += i + 1
return "".join(UnicodeAst)
def ReencodeAscii(self,str):
print sys.stdin.encoding
try:
Stringer = str.decode("ascii")
except UnicodeEncodeError:
print "REENCODING ERROR"
return str.encode("ascii")
except UnicodeDecodeError:
print "DECODING ERROR"
return str.encode("ascii")
else:
print Stringer
return Stringer
def _add_header(self, node, header=1):
if header==2:
rml_head = self.rml_header2
else:
rml_head = self.rml_header
rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="770.0" width="1120.0" >[[company.logo]] </image> ''')
return True
@@ -0,0 +1,143 @@
-
In order to test account invoice i create a new customer invoice
-
Creating a account.invoice record
-
!record {model: account.invoice, id: account_invoice_0}:
account_id: account.a_recv
address_contact_id: base.res_partner_address_zen
address_invoice_id: base.res_partner_address_zen
company_id: base.main_company
currency_id: base.EUR
date_invoice: '2010-05-26'
invoice_line:
- account_id: account.a_sale
name: '[PC3] Medium PC'
price_unit: 900.0
quantity: 10.0
product_id: product.product_product_pc3
uos_id: product.product_uom_unit
journal_id: account.sales_journal
partner_id: base.res_partner_3
reference_type: none
-
I check that Initially customer invoice is in the draft state
-
!assert {model: account.invoice, id: account_invoice_0}:
- state == 'draft'
-
I change the state of invoice to proforma2 by clicking PRO-FORMA button
-
Performing a workflow action invoice_proforma2 on module account.invoice
-
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_0}
-
I check that the invoice state is now proforma2
-
!assert {model: account.invoice, id: account_invoice_0}:
- state == 'proforma2'
-
I create invoice by clicking on Create button
-
Performing a workflow action invoice_open on module account.invoice
-
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0}
-
I check that the invoice state is now open
-
!assert {model: account.invoice, id: account_invoice_0}:
- state == 'open'
-
I make a partial payment of 1000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
-
!record {model: account.invoice.pay, id: account_invoice_pay_first0}:
amount: 1000.0
date: '2010-05-26'
journal_id: account.sales_journal
name: First payment for [PC3] Medium PC to Distrib PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_first0")], {"lang":
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
})
-
I check that the invoice state is still open
-
!assert {model: account.invoice, id: account_invoice_0}:
- state == 'open'
-
I make second partial payment of 6000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
-
!record {model: account.invoice.pay, id: account_invoice_pay_second0}:
amount: 6000.0
date: '2010-05-28'
journal_id: account.sales_journal
name: Second payment for [PC3] Medium PC to Distrib PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_second0")], {"lang":
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
})
-
I make final partial payment of 2000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
-
!record {model: account.invoice.pay, id: account_invoice_pay_final0}:
amount: 2000.0
date: '2010-05-30'
journal_id: account.sales_journal
name: Final payment for [PC3] Medium PC to Distrib PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_final0")], {"lang":
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
})
-
I check that the invoice state is now Done
-
!assert {model: account.invoice, id: account_invoice_0}:
- state == 'paid'
-
I check that an payment entry gets created in the account.move.line
-
!python {model: account.invoice}: |
acc_id=self.browse(cr, uid, ref("account_invoice_0"))
assert(acc_id.move_id)
#-
# I refund the invoice
#-
# Creating a account.invoice.refund record
#-
# !record {model: account.invoice.refund, id: account_invoice_refund_0}:
# description: Refund
#
#-
# Performing an osv_memory action invoice_refund on module account.invoice.refund
#-
# !python {model: account.invoice.refund}: |
# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")], "type": "out_invoice", "active_id": ref("account.account_invoice_0"), })
# return self.compute_refund(cr, uid, [ref("account_invoice_refund_0")], "refund" {"lang": 'en_US',"tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")], "type": "out_invoice", "active_id": ref("account.account_invoice_0"), })
@@ -0,0 +1,117 @@
-
In order to test account invoice i create a new supplier invoice
-
Creating a account.invoice record
-
!record {model: account.invoice, id: account_invoice_1}:
account_id: account.a_pay
address_contact_id: base.res_partner_address_3000
address_invoice_id: base.res_partner_address_3000
check_total: 3000.0
company_id: base.main_company
currency_id: base.EUR
invoice_line:
- account_id: account.a_expense
name: '[PC1] Basic PC'
price_unit: 300.0
product_id: product.product_product_pc1
quantity: 10.0
uos_id: product.product_uom_unit
journal_id: account.expenses_journal
partner_id: base.res_partner_desertic_hispafuentes
reference_type: none
type: in_invoice
-
I check that Initially supplier invoice is in the draft state
-
!assert {model: account.invoice, id: account_invoice_1}:
- state == 'draft'
-
I change the state of invoice to open by clicking Validate button
-
Performing a workflow action invoice_open on module account.invoice
-
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_1}
-
I check that the invoice state is now open
-
!assert {model: account.invoice, id: account_invoice_1}:
- state == 'open'
-
I make a partial payment of 2000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
-
!record {model: account.invoice.pay, id: account_invoice_pay_firstpaymenttoaxelorforbasicpc0}:
amount: 2000.0
date: '2010-05-29'
journal_id: account.sales_journal
name: First Payment to Axelor for Basic PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_firstpaymenttoaxelorforbasicpc0")],
{"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id":
ref("account_invoice_1"), })
-
I check that the invoice state is still open
-
!assert {model: account.invoice, id: account_invoice_1}:
- state == 'open'
-
I make final partial payment of 1000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
-
!record {model: account.invoice.pay, id: account_invoice_pay_finalpaymenttoaxelorforbasicpc0}:
amount: 1000.0
date: '2010-06-17'
journal_id: account.sales_journal
name: Final Payment to Axelor for Basic PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_finalpaymenttoaxelorforbasicpc0")],
{"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id":
ref("account_invoice_1"), })
-
I check that the invoice state is now Done
-
!assert {model: account.invoice, id: account_invoice_1}:
- state == 'paid'
-
I check that an payment entry gets created in the account.move.line
-
!python {model: account.invoice}: |
acc_id=self.browse(cr, uid, ref("account_invoice_1"))
assert(acc_id.move_id)
#-
# I refund the invoice
#-
# Creating a account.invoice.refund record
#-
# !record {model: account.invoice.refund, id: account_invoice_refund_0}:
# date: '2010-06-22'
# description: 'Refund By Axelor '
#
#
#-
# Performing an osv_memory action invoice_refund on module account.invoice.refund
#-
# !python {model: account.invoice.refund}: |
# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US',
# "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_1")],
# "type": "in_invoice", "active_id": ref("account_invoice_1"), })
@@ -48,27 +48,24 @@ class account_change_currency(osv.osv_memory):
data = self.read(cr, uid, ids)[0]
new_currency = data['currency_id']
for invoice in obj_inv.browse(cr, uid, context['active_ids'], context=context):
if invoice.currency_id.id == new_currency:
continue
invoice = obj_inv.browse(cr, uid, context['active_id'], context=context)
if invoice.currency_id.id == new_currency:
return {}
rate = obj_currency.browse(cr, uid, new_currency).rate
for line in invoice.invoice_line:
new_price = 0
if invoice.company_id.currency_id.id == invoice.currency_id.id:
new_price = line.price_unit * rate
for line in invoice.invoice_line:
rate = obj_currency.browse(cr, uid, new_currency).rate
new_price = 0
if invoice.company_id.currency_id.id == invoice.currency_id.id:
new_price = line.price_unit * rate
if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id == new_currency:
old_rate = invoice.currency_id.rate
new_price = line.price_unit / old_rate
if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id == new_currency:
old_rate = invoice.currency_id.rate
new_price = line.price_unit / old_rate
if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id != new_currency:
old_rate = invoice.currency_id.rate
new_price = (line.price_unit / old_rate ) * rate
obj_inv_line.write(cr, uid, [line.id], {'price_unit' : new_price})
invoice_ids.append(invoice.id)
obj_inv.write(cr, uid, invoice_ids, {'currency_id' : new_currency}, context=context)
if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id != new_currency:
old_rate = invoice.currency_id.rate
new_price = (line.price_unit / old_rate ) * rate
obj_inv_line.write(cr, uid, [line.id], {'price_unit' : new_price})
obj_inv.write(cr, uid, [invoice.id], {'currency_id' : new_currency}, context=context)
return {}
account_change_currency()
@@ -8,6 +8,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice Currency">
<separator colspan="4" string="This wizard will change the currency of the invoice"/>
<field name="currency_id"/>
<separator colspan="4"/>
<group colspan="2" col="4">
@@ -29,7 +30,7 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="account_change_currency">
<!-- <record model="ir.values" id="account_change_currency">
<field name="model_id" ref="account.model_account_invoice" />
<field name="object" eval="1" />
<field name="name">Change Currency</field>
@@ -37,7 +38,7 @@
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_change_currency'))"/>
<field name="key">action</field>
<field name="model">account.invoice</field>
</record>
</record>-->
</data>
</openerp>
+13 -14
View File
@@ -18,10 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import fields, osv
from tools.translate import _
import netsvc
import time
class account_invoice_refund(osv.osv_memory):
@@ -30,16 +31,15 @@ class account_invoice_refund(osv.osv_memory):
_name = "account.invoice.refund"
_description = "Invoice Refund"
_columns = {
'date': fields.date('Operation date', required=False, help='This date will be used as the invoice date for Refund Invoice and Period will be chosen accordingly!'),
'period': fields.many2one('account.period', 'Force period', required=False),
'description': fields.char('Description', size=150, required=True),
'date': fields.date('Operation date', help='This date will be used as the invoice date for Refund Invoice and Period will be chosen accordingly!'),
'period': fields.many2one('account.period', 'Force period'),
'description': fields.char('Description', size=128, required=True),
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
}
}
def compute_refund(self, cr, uid, ids, mode, context=None):
def compute_refund(self, cr, uid, ids, mode='refund', context=None):
"""
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -51,6 +51,7 @@ class account_invoice_refund(osv.osv_memory):
account_m_line_obj = self.pool.get('account.move.line')
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
wf_service = netsvc.LocalService('workflow')
if context is None:
context = {}
@@ -77,21 +78,20 @@ class account_invoice_refund(osv.osv_memory):
result_query = cr.fetchone()
if result_query:
cr.execute("""SELECT id
from account_period where date('%s')
from account_period where date(%s)
between date_start AND date_stop \
and company_id = %s limit 1 """,
(form['date'], self.pool.get('res.users').browse(cr, uid, uid,context=context).company_id.id,))
(date, self.pool.get('res.users').browse(cr, uid, uid,context=context).company_id.id,))
else:
cr.execute("""SELECT id
from account_period where date('%s')
from account_period where date(%s)
between date_start AND date_stop \
limit 1 """, (form['date'],))
limit 1 """, (date,))
res = cr.fetchone()
if res:
period = res[0]
else:
date = inv.date_invoice
if form['description'] :
description = form['description']
else:
@@ -116,7 +116,6 @@ class account_invoice_refund(osv.osv_memory):
to_reconcile_ids[line.account_id.id] = [line.id]
if type(line.reconcile_id) != osv.orm.browse_null :
reconcile_obj.unlink(cr, uid, line.reconcile_id.id)
wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'account.invoice', \
refund.id, 'invoice_open', cr)
refund = inv_obj.browse(cr, uid, refund_id[0],context=context)
@@ -129,7 +128,7 @@ class account_invoice_refund(osv.osv_memory):
writeoff_journal_id=inv.journal_id.id,
writeoff_acc_id=inv.account_id.id
)
if mode == 'modify' :
if mode == 'modify':
invoice = inv_obj.read(cr, uid, [inv.id],
['name', 'type', 'number', 'reference',
'comment', 'date_due', 'partner_id',
@@ -8,6 +8,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Credit Note">
<separator string="This wizard is used to refund the invoice" colspan="4"/>
<group colspan="4" >
<label string="Are you sure you want to refund this invoice ?" colspan="2"/>
<newline/>
@@ -15,7 +16,7 @@
<field name="period"/>
<field name="description"/>
</group>
<separator string="" colspan="4" />
<separator colspan="4"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
@@ -36,10 +37,10 @@
<field name="target">new</field>
</record>
<act_window id="action_account_invoice_refund"
<!-- <act_window id="action_account_invoice_refund"
key2 = "client_action_multi" name="Credit Note"
res_model="account.invoice.refund" src_model="account.invoice"
view_mode="form" target="new" view_type="form" />
view_mode="form" target="new" view_type="form" /> -->
</data>
</openerp>
@@ -25,14 +25,25 @@
</field>
</record>
<record id="action_account_invoice_pay" model="ir.actions.act_window">
<field name="name">Pay Invoice</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.invoice.pay</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_account_invoice_pay"/>
<field name="context">{'record_id' : active_id}</field>
<field name="target">new</field>
</record>
<act_window name="Pay Invoice"
<!-- <act_window name="Pay Invoice"
res_model="account.invoice.pay"
src_model="account.invoice"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_account_invoice_pay"/>
id="action_view_account_invoice_pay"/> -->
<record id="view_account_invoice_pay_writeoff" model="ir.ui.view">
<field name="name">account.invoice.pay.writeoff.form</field>
+3 -3
View File
@@ -29,7 +29,7 @@ class account_unreconcile(osv.osv_memory):
obj_move_reconcile = self.pool.get('account.move.reconcile')
if context is None:
context = {}
recs = pool.get('account.move.line').read(cr, uid, data['ids'], ['reconcile_id','reconcile_partial_id'])
recs = obj_move_line.read(cr, uid, context['active_ids'], ['reconcile_id','reconcile_partial_id'])
unlink_ids = []
full_recs = filter(lambda x: x['reconcile_id'], recs)
rec_ids = [rec['reconcile_id'][0] for rec in full_recs]
@@ -37,9 +37,9 @@ class account_unreconcile(osv.osv_memory):
part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs]
unlink_ids += rec_ids
unlink_ids += part_rec_ids
if len(unlink_ids):
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, unlink_ids)
self.pool.get('account.move.reconcile').unlink(cr, uid, unlink_ids)
return {}
account_unreconcile()
+3
View File
@@ -0,0 +1,3 @@
import report
import wizard
@@ -0,0 +1,47 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "Accounting Reports",
"version" : "1.0",
"depends" : [
"account"
],
"author" : "Tiny ERP",
"description": """Accounting Reports
Modules gives the 2 most Important Reports for the Accounting
* Profit and Loss Account
* Balance Sheet
""",
"website" : "http://tinyerp.com/module_account.html",
"category" : "Generic Modules/Accounting",
"init_xml" : [
],
"demo_xml" : [
],
"update_xml" : [
"wizard/account_pl_report_view.xml",
"wizard/account_bs_report_view.xml"
],
"active": False,
"installable": True
}
+3
View File
@@ -0,0 +1,3 @@
import report_bs
import report_pl
@@ -0,0 +1,245 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Heading">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Company_Name">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Date_from_To">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Account_Line_Title">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Net_Profit_Loss">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<images/>
<story>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="539.0" style="Table_Heading">
<tr>
<td>
<para style="terp_header_Centre">[[ get_company(data['form']) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="539.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Centre">Balance Sheet</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="539.0" style="Table_Date_from_To">
<tr>
<td>
<para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_8">[[ get_data(data['form']) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="100.0,326.0,113.0" style="Table_Account_Line_Title" repeatRows="1">
<tr>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Liabilities</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9"><font face="Times-Roman">[[ repeatIn(get_lines_another('liability'), 'a') ]]</font>[[ a['code'] ]]<font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font></para>
</td>
<td>
<para style="terp_default_9"><font color="white">[[ '. '*(a['level']-1) ]]</font><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font></para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr()) ]]</u></para>
</td>
</tr>
</blockTable>
<condPageBreak height="20cm"/>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="100.0,326.0,113.0" style="Table1" repeatRows="1">
<tr>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Assets</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9"><font face="Times-Roman">[[ repeatIn(get_lines_another('asset'), 'a') ]]</font>[[ a['code'] ]]<font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font></para>
</td>
<td>
<para style="terp_default_9">[[ a['code'] ]]<font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font></para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table3">
<tr>
<td>
<para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr()) ]]</u></para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
</story>
</document>
@@ -0,0 +1,234 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(1120.0,770.0)" title="Test" author="Martin Simon" allowSplitting="20" >
<pageTemplate id="first">
<frame id="first" x1="22.0" y1="15.0" width="1080" height="680"/>
<pageGraphics>
<setFont name="Helvetica-Bold" size="9"/>
<!--COL 1-->
<drawString x="1.3cm" y="25.50cm">[[ get_company(data['form']) ]]</drawString>
<!--COL 2-->
<setFont name="Helvetica" size="9"/>
<drawString x="1.3cm" y="0.50cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString>
<drawString x="37.20cm" y="0.50cm">Page <pageNumber/></drawString>
<lineMode width="0.7"/>
<lines>1.3cm 24.9cm 38.3cm 24.9cm</lines>
<setFont name="Helvetica" size="8"/>
</pageGraphics>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Heading">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Company_Name">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Date_from_To">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Account_Line_Title">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,0" stop="7,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_Main_Content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Liability_side">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Asset_Side_Content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Net_Profit_Loss">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" rightIndent="0.0" leftIndent="1.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" rightIndent="121.0" leftIndent="-1.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<images/>
<story>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="1049.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Centre">Balance Sheet </para>
</td>
</tr>
</blockTable>
<blockTable colWidths="1049.0" style="Table_Date_from_To">
<tr>
<td>
<para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_8">[[ get_data(data['form']) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="100.0,308.16,116.32,100.0,308.16,116.32" style="Table_Account_Line_Title" repeatRows="1">
<tr>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Liabilities</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Assets</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9"><font face="Times-Roman">[[ repeatIn(get_lines(), 'a') ]]</font> <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font><font>[[ a['code'] ]]</font></para>
</td>
<td>
<para style="terp_default_9"><font color="white">[[ '. '*(a['level']-1) ]]</font><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font></para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
</td>
<td>
<para style="terp_default_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font><font>[[ a['code1'] ]]</font></para>
</td>
<td>
<para style="terp_default_9"><font color="white">[[ '. '*(a['level1']-1) ]]</font><font>[[ a['level1']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name1'] ]]</font></para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance1'])) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="408.16,116.32,408.16,116.32" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]]</u></para>
</td>
<td>
<para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]]</u></para>
</td>
</tr>
</blockTable>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</story>
</document>
@@ -0,0 +1,203 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import pooler
import time
import mx.DateTime
import rml_parse
from report import report_sxw
from account_report_india.report import report_pl
class report_balancesheet_horizontal(rml_parse.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context)
self.obj_pl=report_pl.report_pl_account_horizontal(cr, uid, name, context)
self.result_sum_dr=0.0
self.result_sum_cr=0.0
self.result = {}
self.res_pl={}
self.result_temp=[]
self.localcontext.update({
'time': time,
'get_lines' : self.get_lines,
'get_lines_another' : self.get_lines_another,
'get_company': self.get_company,
'get_currency': self._get_currency,
'sum_dr' : self.sum_dr,
'sum_cr' : self.sum_cr,
'get_data':self.get_data,
'get_pl_balance':self.get_pl_balance,
})
self.context = context
def sum_dr(self):
if self.res_pl['type'] == 'Net Profit':
self.result_sum_dr += self.res_pl['balance']
return self.result_sum_dr or 0.0
def sum_cr(self):
if self.res_pl['type'] == 'Net Loss':
self.result_sum_cr += self.res_pl['balance']
return self.result_sum_cr or 0.0
def get_pl_balance(self):
return self.res_pl or 0.0
def get_data(self,form):
cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
#Getting Profit or Loss Balance from profit and Loss report
result_pl=self.obj_pl.get_data(form)
self.res_pl=self.obj_pl.final_result()
type_pool = db_pool.get('account.account.type')
account_pool = db_pool.get('account.account')
year_pool = db_pool.get('account.fiscalyear')
types = [
'liability',
'asset'
]
ctx = self.context.copy()
ctx['state'] = form['context'].get('state','all')
ctx['fiscalyear'] = form['fiscalyear']
if form['state']=='byperiod' :
ctx['periods'] = form['periods']
elif form['state']== 'bydate':
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
elif form['state'] == 'all' :
ctx['periods'] = form['periods']
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
cal_list={}
pl_dict = {}
account_dict = {}
account_id = [form['Account_list']]
account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx)
accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
if self.res_pl['type'] == 'Net Profit C.F.B.L.':
self.res_pl['type'] = 'Net Profit'
else:
self.res_pl['type'] = 'Net Loss'
pl_dict = {
'code' : False,
'name' : self.res_pl['type'],
'level': False,
'balance':self.res_pl['balance'],
}
for typ in types:
accounts_temp = []
for account in accounts:
if (account.user_type.report_type) and (account.user_type.report_type == typ):
account_dict = {
'id' : account.id,
'code' : account.code,
'name' : account.name,
'level': account.level,
'balance':account.balance,
}
if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += abs(account.debit - account.credit)
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += abs(account.debit - account.credit)
if form['display_account'] == 'bal_mouvement':
if account.credit > 0 or account.debit > 0 or account.balance > 0 :
accounts_temp.append(account_dict)
elif form['display_account'] == 'bal_solde':
if account.balance != 0:
accounts_temp.append(account_dict)
else:
accounts_temp.append(account_dict)
if account.id == form['reserve_account_id']:
pl_dict['level'] = account['level'] + 1
accounts_temp.append(pl_dict)
self.result[typ] = accounts_temp
cal_list[typ]=self.result[typ]
if cal_list:
temp={}
for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))):
if i < len(cal_list['liability']) and i < len(cal_list['asset']):
temp={
'code' : cal_list['liability'][i]['code'],
'name' : cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'],
'code1' : cal_list['asset'][i]['code'],
'name1' : cal_list['asset'][i]['name'],
'level1': cal_list['asset'][i]['level'],
'balance1':cal_list['asset'][i]['balance'],
}
self.result_temp.append(temp)
else:
if i < len(cal_list['asset']):
temp={
'code' : '',
'name' : '',
'level': False,
'balance':False,
'code1' : cal_list['asset'][i]['code'],
'name1' : cal_list['asset'][i]['name'],
'level1': cal_list['asset'][i]['level'],
'balance1':cal_list['asset'][i]['balance'],
}
self.result_temp.append(temp)
if i < len(cal_list['liability']):
temp={
'code' : cal_list['liability'][i]['code'],
'name' : cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'],
'code1' : '',
'name1' : '',
'level1': False,
'balance1':False,
}
self.result_temp.append(temp)
return None
def get_lines(self):
return self.result_temp
def get_lines_another(self, group):
return self.result.get(group, [])
def _get_currency(self, form):
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.code
def get_company(self,form):
comp_obj=pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr,self.uid,form['company_id'])
return comp_obj.name
report_sxw.report_sxw('report.account.balancesheet.horizontal', 'account.account',
'addons/account_report_india/report/report_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
header=False)
report_sxw.report_sxw('report.account.balancesheet', 'account.account',
'addons/account_report_india/report/report_balance_sheet.rml',parser=report_balancesheet_horizontal,
header=False)
@@ -0,0 +1,177 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import pooler
import time
import mx.DateTime
import rml_parse
from report import report_sxw
class report_pl_account_horizontal(rml_parse.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_pl_account_horizontal, self).__init__(cr, uid, name, context)
self.result_sum_dr=0.0
self.result_sum_cr=0.0
self.res_pl ={}
self.result = {}
self.result_temp=[]
self.localcontext.update( {
'time': time,
'get_lines' : self.get_lines,
'get_lines_another' : self.get_lines_another,
'get_company': self.get_company,
'get_currency': self._get_currency,
'get_data': self.get_data,
'sum_dr' : self.sum_dr,
'sum_cr' : self.sum_cr,
'final_result' : self.final_result,
})
self.context = context
def final_result(self):
return self.res_pl
def sum_dr(self):
if self.res_pl['type'] == 'Net Profit C.F.B.L.':
self.result_sum_dr += self.res_pl['balance']
return self.result_sum_dr or 0.0
def sum_cr(self):
if self.res_pl['type'] == 'Net Loss C.F.B.L.':
self.result_sum_cr += self.res_pl['balance']
return self.result_sum_cr or 0.0
def get_data(self,form):
cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
type_pool = db_pool.get('account.account.type')
account_pool = db_pool.get('account.account')
year_pool = db_pool.get('account.fiscalyear')
types = [
'expense',
'income'
]
ctx = self.context.copy()
ctx['state'] = form['context'].get('state','all')
ctx['fiscalyear'] = form['fiscalyear']
if form['state']=='byperiod' :
ctx['periods'] = form['periods']
elif form['state']== 'bydate':
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
elif form['state'] == 'all' :
ctx['periods'] = form['periods']
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
cal_list={}
account_id = [form['Account_list']]
account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx)
accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
for typ in types:
accounts_temp = []
for account in accounts:
if (account.user_type.report_type) and (account.user_type.report_type == typ):
if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += abs(account.debit - account.credit)
if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += abs(account.debit - account.credit)
if form['display_account'] == 'bal_mouvement':
if account.credit > 0 or account.debit > 0 or account.balance > 0 :
accounts_temp.append(account)
elif form['display_account'] == 'bal_solde':
if account.balance != 0:
accounts_temp.append(account)
else:
accounts_temp.append(account)
if self.result_sum_dr > self.result_sum_cr:
self.res_pl['type'] = 'Net Loss C.F.B.L.'
self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
else:
self.res_pl['type'] = 'Net Profit C.F.B.L.'
self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr)
self.result[typ] = accounts_temp
cal_list[typ]=self.result[typ]
if cal_list:
temp={}
for i in range(0,max(len(cal_list['expense']),len(cal_list['income']))):
if i < len(cal_list['expense']) and i < len(cal_list['income']):
temp={
'code' : cal_list['expense'][i].code,
'name' : cal_list['expense'][i].name,
'level': cal_list['expense'][i].level,
'balance':cal_list['expense'][i].balance,
'code1' : cal_list['income'][i].code,
'name1' : cal_list['income'][i].name,
'level1': cal_list['income'][i].level,
'balance1':cal_list['income'][i].balance,
}
self.result_temp.append(temp)
else:
if i < len(cal_list['income']):
temp={
'code' : '',
'name' : '',
'level': False,
'balance':False,
'code1' : cal_list['income'][i].code,
'name1' : cal_list['income'][i].name,
'level1': cal_list['income'][i].level,
'balance1':cal_list['income'][i].balance,
}
self.result_temp.append(temp)
if i < len(cal_list['expense']):
temp={
'code' : cal_list['expense'][i].code,
'name' : cal_list['expense'][i].name,
'level': cal_list['expense'][i].level,
'balance':cal_list['expense'][i].balance,
'code1' : '',
'name1' : '',
'level1': False,
'balance1':False,
}
self.result_temp.append(temp)
return None
def get_lines(self):
return self.result_temp
def get_lines_another(self, group):
return self.result.get(group, [])
def _get_currency(self, form):
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.code
def get_company(self,form):
comp_obj=pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr,self.uid,form['company_id'])
return comp_obj.name
report_sxw.report_sxw('report.pl.account.horizontal', 'account.account',
'addons/account_report_india/report/report_pl_account_horizontal.rml',parser=report_pl_account_horizontal, header=False)
report_sxw.report_sxw('report.pl.account', 'account.account',
'addons/account_report_india/report/report_pl_account.rml',parser=report_pl_account_horizontal, header=False)
@@ -0,0 +1,293 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Heading">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Company_Name">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Date_from_To">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Account_Line_Title">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Net_Profit_Loss">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_Final_Result">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" rightIndent="2.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<images/>
<story>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="539.0" style="Table_Heading">
<tr>
<td>
<para style="terp_header_Centre">[[ get_company(data['form']) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="539.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Centre">Profit And Loss Account</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="539.0" style="Table_Date_from_To">
<tr>
<td>
<para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P2">[[ get_data(data['form']) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="100.0,326.0,113.0" style="Table_Account_Line_Title" repeatRows="1">
<tr>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Expenses</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">
<font face="Times-Roman">[[ repeatIn(get_lines_another('expense'),'a' ) ]] </font>[[ a.code ]]<font>[[ a.level&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white">[[ '. '*(a.level-1) ]]</font><font>[[ a.level&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a.name ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a.balance)) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="100.0,326.0,113.0" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9"></para>
</td>
<td>
<para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and final_result()['type'] or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]]</u></para>
</td>
</tr>
</blockTable>
<condPageBreak height="20cm"/>
<para style="terp_default_Right_9_Bold">
<font color="white"> </font>
</para>
<blockTable colWidths="100.0,326.0,113.0" style="Table2" repeatRows="1">
<tr>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Incomes</para>
</td>
<td>
<para style="P1">Total Amount([[ get_currency(data['form']) ]])</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">
<font face="Times-Roman">[[ repeatIn(get_lines_another('income'),'a') ]] </font>[[ a.code ]]<font>[[ a.level&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white">[[ '. '*(a.level-1) ]]</font><font>[[ a.level&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a.name ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a.balance)) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="100.0,326.0,113.0" style="Table4">
<tr>
<td>
<para style="terp_default_Bold_9"></para>
</td>
<td>
<para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and final_result()['type'] or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table4">
<tr>
<td>
<para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]]</u></para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="terp_default_Right_9_Bold">
<font color="white"> </font>
</para>
</story>
</document>
@@ -0,0 +1,278 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(1120.0,770.0)" title="Test" author="Martin Simon" allowSplitting="20" >
<pageTemplate id="first">
<frame id="first" x1="22.0" y1="15.0" width="1080" height="680"/>
<pageGraphics>
<setFont name="Helvetica-Bold" size="9"/>
<!--COL 1-->
<drawString x="1.3cm" y="25.50cm">[[ get_company(data['form']) ]]</drawString>
<!--COL 2-->
<setFont name="Helvetica" size="9"/>
<drawString x="1.3cm" y="0.50cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString>
<drawString x="37.20cm" y="0.50cm">Page <pageNumber/></drawString>
<lineMode width="0.7"/>
<lines>1.3cm 24.9cm 38.3cm 24.9cm</lines>
<setFont name="Helvetica" size="8"/>
</pageGraphics>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Heading">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Company_Name">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Date_from_To">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_debit_credit">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Account_Line_Title">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,0" stop="7,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_Main_Content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Expense_Content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Income_Content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Net_Profit_Loss">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_Final_Result">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" rightIndent="2.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<images/>
<story>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="1049.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Centre">Profit And Loss Account </para>
</td>
</tr>
</blockTable>
<blockTable colWidths="1049.0" style="Table_Date_from_To">
<tr>
<td>
<para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">[[ get_data(data['form']) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="100.0,308.16,116.32,100.0,308.16,116.32" style="Table_Account_Line_Title" repeatRows="1">
<tr>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Perticular</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form'])]])</para>
</td>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Perticular</para>
</td>
<td>
<para style="P1">Total Amount([[ get_currency(data['form'])]])</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">
<font face="Times-Roman">[[ repeatIn(get_lines(),'a' ) ]] </font>[[ a['code'] ]]<font>[[ a['level']&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white">[[ '. '*(a['level']-1) ]]</font><font>[[ a['level']&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
</td>
<td>
<para style="terp_default_9">
[[ a['code1'] ]]<font>[[ a['level1']&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white">[[ '. '*(a['level1']-1) ]]</font><font>[[ a['level1']&lt;3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name1'] ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance1'])) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="100.0,308.16,116.32,100.0,308.16,116.32" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9"></para>
</td>
<td>
<para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and final_result()['type'] or '' ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
</td>
<td>
<para style="terp_default_Bold_9"></para>
</td>
<td>
<para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and final_result()['type'] or '' ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="408.16,116.32,408.16,116.32" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]]</u></para>
</td>
<td>
<para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]]</u></para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</story>
</document>
+165
View File
@@ -0,0 +1,165 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from report import report_sxw
import xml.dom.minidom
import os, time
import osv
import re
import tools
import pooler
import re
import sys
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(rml_parse, self).__init__(cr, uid, name, context=None)
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
'strip_name' : self._strip_name,
'explode_name' : self._explode_name,
})
def comma_me(self,amount):
#print "#" + str(amount) + "#"
if not amount:
amount = 0.0
if type(amount) is float :
amount = str('%.2f'%amount)
else :
amount = str(amount)
if (amount == '0'):
return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
return new
else:
return self.comma_me(new)
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
ellipsis = ellipsis or ''
try:
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
except Exception, e:
return False
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, '...')
def _get_and_change_date_format_for_swiss (self,date_to_format):
date_formatted=''
if date_to_format:
date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
return date_formatted
def _explode_name(self,chaine,length):
# We will test if the size is less then account
full_string = ''
if (len(str(chaine)) <= length):
return chaine
#
else:
chaine = unicode(chaine,'utf8').encode('iso-8859-1')
rup = 0
for carac in chaine:
rup = rup + 1
if rup == length:
full_string = full_string + '\n'
full_string = full_string + carac
rup = 0
else:
full_string = full_string + carac
return full_string
def makeAscii(self,str):
try:
Stringer = str.encode("utf-8")
except UnicodeDecodeError:
try:
Stringer = str.encode("utf-16")
except UnicodeDecodeError:
print "UTF_16 Error"
Stringer = str
else:
return Stringer
else:
return Stringer
return Stringer
def explode_this(self,chaine,length):
#chaine = self.repair_string(chaine)
chaine = rstrip(chaine)
ast = list(chaine)
i = length
while i <= len(ast):
ast.insert(i,'\n')
i = i + length
chaine = str("".join(ast))
return chaine
def repair_string(self,chaine):
ast = list(chaine)
UnicodeAst = []
_previouslyfound = False
i = 0
#print str(ast)
while i < len(ast):
elem = ast[i]
try:
Stringer = elem.encode("utf-8")
except UnicodeDecodeError:
to_reencode = elem + ast[i+1]
print str(to_reencode)
Good_char = to_reencode.decode('utf-8')
UnicodeAst.append(Good_char)
i += i +2
else:
UnicodeAst.append(elem)
i += i + 1
return "".join(UnicodeAst)
def ReencodeAscii(self,str):
print sys.stdin.encoding
try:
Stringer = str.decode("ascii")
except UnicodeEncodeError:
print "REENCODING ERROR"
return str.encode("ascii")
except UnicodeDecodeError:
print "DECODING ERROR"
return str.encode("ascii")
else:
print Stringer
return Stringer
def _add_header(self, node, header=1):
if header==2:
rml_head = self.rml_header2
else:
rml_head = self.rml_header
rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="770.0" width="1120.0" >[[company.logo]] </image> ''')
return True
+23
View File
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_bs_report
import account_pl_report
@@ -0,0 +1,158 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import osv, fields
from tools.translate import _
class account_bs_report(osv.osv_memory):
"""
This wizard will provide the account balance sheet report by periods, between any two dates.
"""
_name = 'account.bs.report'
_description = 'Account Balance Sheet Report'
_columns = {
'Account_list': fields.many2one('account.account', 'Chart account',
required=True, domain = [('parent_id','=',False)]),
'company_id': fields.many2one('res.company', 'Company', required=True),
'display_account': fields.selection([('bal_movement','With movements'),
('bal_solde','With balance is not equal to 0'),
('bal_all','All'),
],'Display accounts'),
'display_type': fields.boolean("Landscape Mode"),
'reserve_account_id': fields.many2one('account.account', 'Reserve & Surplus Account',required = True,
help='This Account is used for trasfering Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be duducted.), Which is calculated from Profilt & Loss Report', domain = [('type','=','payable')]),
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
'state': fields.selection([('bydate','By Date'),
('byperiod','By Period'),
('all','By Date and Period'),
('none','No Filter')
],'Date/Period Filter'),
'periods': fields.many2many('account.period', 'period_account_balance_rel',
'report_id', 'period_id', 'Periods',
help='Keep empty for all open fiscal year'),
'date_from': fields.date('Start date', required=True),
'date_to': fields.date('End date', required=True),
}
def _get_company(self, cr, uid, context=None):
user_obj = self.pool.get('res.users')
company_obj = self.pool.get('res.company')
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
else:
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
_defaults={
'state' : 'none',
'date_from' : time.strftime('%Y-01-01'),
'date_to' : time.strftime('%Y-%m-%d'),
'company_id' : _get_company,
'fiscalyear' : False,
'display_account': 'bal_all',
'display_type': True,
}
def next_view(self, cr, uid, ids, context=None):
obj_model = self.pool.get('ir.model.data')
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
context.update({'Account_list': data['Account_list'],'reserve_account_id':data['reserve_account_id']})
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_bs_report_view')])
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.bs.report',
'views': [(resource_id,'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'context': context
}
def check_state(self, cr, uid, ids, context=None):
if context is None:
context = {}
data={}
data['ids'] = context['active_ids']
data['form'] = self.read(cr, uid, ids, ['date_from', 'company_id', 'state', 'periods', 'date_to', 'display_account', 'display_type', 'fiscalyear'])[0]
data['form']['Account_list'] = context.get('Account_list',[])
data['form']['reserve_account_id'] = context.get('reserve_account_id',[])
data['form']['context'] = context
if data['form']['Account_list']:
data['model'] = 'ir.ui.menu'
else:
data['model'] = 'account.account'
if data['form']['state'] == 'bydate' :
return self._check_date(cr, uid, data, context)
elif data['form']['state'] == 'byperiod':
if not data['form']['periods']:
raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
if data['form']['display_type']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet.horizontal',
'datas': data,
'nodestroy':True,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet',
'datas': data,
'nodestroy':True,
}
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date_from'],))
res = cr.dictfetchall()
if res:
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
else:
if data['form']['display_type']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet.horizontal',
'datas': data,
'nodestroy':True,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet',
'datas': data,
'nodestroy':True,
}
else:
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
account_bs_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_bs_report_view" model="ir.ui.view">
<field name="name">Select period</field>
<field name="model">account.bs.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select period">
<field name="company_id"/>
<field name="display_account" required = "True"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<field name="display_type"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
<newline/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_bs_report" model="ir.actions.act_window">
<field name="name">Account Balance Sheet</field>
<field name="res_model">account.bs.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_bs_report_view"/>
<field name="target">new</field>
</record>
<record id="account_bs_report_account_view" model="ir.ui.view">
<field name="name">Account Chart</field>
<field name="model">account.bs.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Chart">
<field name="Account_list" />
<field name="reserve_account_id"/>
<separator colspan="4"/>
<button icon="gtk-cancel" special="cancel" string="Cancel" colspan="2"/>
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1" colspan="2"/>
</form>
</field>
</record>
<record id="action_bs_balance_account_report" model="ir.actions.act_window">
<field name="name">Select Account</field>
<field name="res_model">account.bs.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_bs_report_account_view"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
<menuitem icon="STOCK_PRINT"
name="Balance Sheet"
action="action_bs_balance_account_report"
id="menu_account_bs_report"
parent="final_accounting_reports"/>
</data>
</openerp>
@@ -0,0 +1,155 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import osv, fields
from tools.translate import _
class account_pl_report(osv.osv_memory):
"""
This wizard will provide the account profit and loss report by periods, between any two dates.
"""
_name = 'account.pl.report'
_description = 'Account Profit And Loss Report'
_columns = {
'Account_list': fields.many2one('account.account', 'Chart account',
required=True, domain = [('parent_id','=',False)]),
'company_id': fields.many2one('res.company', 'Company', required=True),
'display_account': fields.selection([('bal_movement','With movements'),
('bal_solde','With balance is not equal to 0'),
('bal_all','All'),
],'Display accounts'),
'display_type': fields.boolean("Landscape Mode"),
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
'state': fields.selection([('bydate','By Date'),
('byperiod','By Period'),
('all','By Date and Period'),
('none','No Filter')
],'Date/Period Filter'),
'periods': fields.many2many('account.period', 'period_account_balance_rel',
'report_id', 'period_id', 'Periods',
help='Keep empty for all open fiscal year'),
'date_from': fields.date('Start date', required=True),
'date_to': fields.date('End date', required=True),
}
def _get_company(self, cr, uid, context=None):
user_obj = self.pool.get('res.users')
company_obj = self.pool.get('res.company')
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
else:
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
_defaults={
'state' : 'none',
'date_from' : time.strftime('%Y-01-01'),
'date_to' : time.strftime('%Y-%m-%d'),
'company_id' : _get_company,
'fiscalyear' : False,
'display_account': 'bal_all',
'display_type': True,
}
def next_view(self, cr, uid, ids, context=None):
obj_model = self.pool.get('ir.model.data')
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
context.update({'Account_list': data['Account_list']})
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_pl_report_view')])
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.pl.report',
'views': [(resource_id,'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'context': context
}
def check_state(self, cr, uid, ids, context=None):
if context is None:
context = {}
data={}
data['ids'] = context['active_ids']
data['form'] = self.read(cr, uid, ids, ['date_from', 'company_id', 'state', 'periods', 'date_to', 'display_account', 'display_type', 'fiscalyear'])[0]
data['form']['Account_list'] = context.get('Account_list',[])
data['form']['context'] = context
if data['form']['Account_list']:
data['model'] = 'ir.ui.menu'
else:
data['model'] = 'account.account'
if data['form']['state'] == 'bydate' :
return self._check_date(cr, uid, data, context)
elif data['form']['state'] == 'byperiod':
if not data['form']['periods']:
raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
if data['form']['display_type']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'pl.account.horizontal',
'datas': data,
'nodestroy':True,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'pl.account',
'datas': data,
'nodestroy':True,
}
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date_from'],))
res = cr.dictfetchall()
if res:
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
else:
if data['form']['display_type']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'pl.account.horizontal',
'datas': data,
'nodestroy':True,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'pl.account',
'datas': data,
'nodestroy':True,
}
else:
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
account_pl_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_pl_report_view" model="ir.ui.view">
<field name="name">Select period</field>
<field name="model">account.pl.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select period">
<field name="company_id"/>
<field name="display_account" required = "True"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<field name="display_type"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
<newline/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_pl_report" model="ir.actions.act_window">
<field name="name">Account Profit And Loss</field>
<field name="res_model">account.pl.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_pl_report_view"/>
<field name="target">new</field>
</record>
<record id="account_pl_report_account_view" model="ir.ui.view">
<field name="name">Account Chart</field>
<field name="model">account.pl.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Chart">
<field name="Account_list"/>
<separator colspan="4"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
</form>
</field>
</record>
<record id="action_pl_balance_account_report" model="ir.actions.act_window">
<field name="name">Select Account</field>
<field name="res_model">account.pl.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_pl_report_account_view"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"
name="Accounting Reports"/>
<menuitem icon="STOCK_PRINT"
name="Profit And Loss"
action="action_pl_balance_account_report"
id="menu_account_pl_report"
parent="final_accounting_reports"/>
</data>
</openerp>
+3 -3
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,11 +15,11 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import invoice_tax_incl
import account_tax_include
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+4 -4
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -26,14 +26,14 @@
'category': 'Generic Modules/Accounting',
'description': """Allow the user to work tax included prices.
Especially useful for b2c businesses.
This module implement the modification on the invoice form.
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['account'],
'init_xml': [],
'update_xml': ['invoice_tax_incl.xml'],
'update_xml': ['account_tax_include_view.xml'],
'demo_xml': [],
'installable': True,
'active': False,
@@ -18,14 +18,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import netsvc
from osv import fields, osv
import ir
from tools import config
import decimal_precision as dp
class account_tax(osv.osv):
_inherit = 'account.tax'
_description = 'Account Tax'
_columns = {
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
}
_defaults = {
'price_include': 0,
}
account_tax()
class account_invoice(osv.osv):
_inherit = "account.invoice"
_columns = {
@@ -35,7 +44,7 @@ class account_invoice(osv.osv):
states={'draft':[('readonly',False)]}),
}
_defaults = {
'price_type': lambda *a: 'tax_excluded',
'price_type': 'tax_excluded',
}
def refund(self, cr, uid, ids, date=None, period_id=None, description=None):
@@ -55,6 +64,7 @@ account_invoice()
class account_invoice_line(osv.osv):
_inherit = "account.invoice.line"
def _amount_line2(self, cr, uid, ids, name, args, context=None):
"""
Return the subtotal excluding taxes with respect to price_type.
@@ -62,6 +72,7 @@ class account_invoice_line(osv.osv):
res = {}
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
dec_obj = self.pool.get('decimal.precision')
for line in self.browse(cr, uid, ids):
cur = line.invoice_id and line.invoice_id.currency_id or False
res_init = super(account_invoice_line, self)._amount_line(cr, uid, [line.id], name, args, context)
@@ -85,7 +96,7 @@ class account_invoice_line(osv.osv):
else:
res[line.id]['price_subtotal'] = cur and cur_obj.round(cr, uid, cur, res_init[line.id]) or res_init[line.id]
for tax in tax_obj.compute_inv(cr, uid, product_taxes, res_init[line.id]/line.quantity, line.quantity):
res[line.id]['price_subtotal'] = res[line.id]['price_subtotal'] - round(tax['amount'], self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))
res[line.id]['price_subtotal'] = res[line.id]['price_subtotal'] - round(tax['amount'], dec_obj.precision_get(cr, uid, 'Account'))
else:
res[line.id]['price_subtotal'] = cur and cur_obj.round(cr, uid, cur, res_init[line.id]) or res_init[line.id]
@@ -93,15 +104,15 @@ class account_invoice_line(osv.osv):
res[line.id]['price_subtotal_incl'] = res[line.id]['price_subtotal']
for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, res[line.id]['price_subtotal']/line.quantity, line.quantity):
res[line.id]['price_subtotal_incl'] = res[line.id]['price_subtotal_incl'] + tax['amount']
res[line.id]['data'].append( tax)
res[line.id]['data'].append(tax)
else:
res[line.id]['price_subtotal'] = res[line.id]['price_subtotal_incl']
for tax in tax_obj.compute_inv(cr, uid, line.invoice_line_tax_id, res[line.id]['price_subtotal_incl']/line.quantity, line.quantity):
res[line.id]['price_subtotal'] = res[line.id]['price_subtotal'] - tax['amount']
res[line.id]['data'].append( tax)
res[line.id]['price_subtotal']= round(res[line.id]['price_subtotal'], self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))
res[line.id]['price_subtotal_incl']= round(res[line.id]['price_subtotal_incl'], self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))
res[line.id]['price_subtotal']= round(res[line.id]['price_subtotal'], dec_obj.precision_get(cr, uid, 'Account'))
res[line.id]['price_subtotal_incl']= round(res[line.id]['price_subtotal_incl'], dec_obj.precision_get(cr, uid, 'Account'))
return res
def _price_unit_default(self, cr, uid, context=None):
@@ -124,16 +135,17 @@ class account_invoice_line(osv.osv):
for line in inv.invoice_line:
result[line.id] = True
return result.keys()
_columns = {
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
}
}
_defaults = {
'price_unit': _price_unit_default,
}
}
def move_line_get_item(self, cr, uid, line, context=None):
return {
@@ -146,7 +158,7 @@ class account_invoice_line(osv.osv):
'product_id': line.product_id.id,
'uos_id':line.uos_id.id,
'account_analytic_id':line.account_analytic_id.id,
}
}
def product_id_change_unit_price_inv(self, cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=None):
if context is None:
@@ -167,23 +179,26 @@ class account_invoice_line(osv.osv):
ctx = (context and context.copy()) or {}
ctx.update({'price_type': ctx.get('price_type','tax_excluded')})
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id=currency_id, context=ctx)
account_invoice_line()
class account_invoice_tax(osv.osv):
_inherit = "account.invoice.tax"
def compute(self, cr, uid, invoice_id, context=None):
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
line_ids = map(lambda x: x.id, inv.invoice_line)
tax_grouped = {}
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
line_obj = self.pool.get('account.invoice.line')
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
line_ids = map(lambda x: x.id, inv.invoice_line)
cur = inv.currency_id
company_currency = inv.company_id.currency_id.id
for line in inv.invoice_line:
data = self.pool.get('account.invoice.line')._amount_line2(cr, uid, [line.id], [], [], context)[line.id]
data = line_obj._amount_line2(cr, uid, [line.id], [], [], context)[line.id]
for tax in data['data']:
val={}
val['invoice_id'] = inv.id
@@ -221,8 +236,7 @@ class account_invoice_tax(osv.osv):
t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount'])
return tax_grouped
account_invoice_tax()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,7 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Add price include (boolean) on tax form/tree view -->
<record id="view_tax_tree_inherit" model="ir.ui.view">
<field name="name">account.tax.tree.inherit.tree</field>
<field name="type">tree</field>
<field name="model">account.tax</field>
<field name="inherit_id" ref="account.view_tax_tree"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="price_include"/>
</field>
</field>
</record>
<record id="view_tax_form_inherit" model="ir.ui.view">
<field name="name">account.tax.tree.inherit.form</field>
<field name="type">form</field>
<field name="model">account.tax</field>
<field name="inherit_id" ref="account.view_tax_form"/>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field groups="base.group_extended" name="price_include"/>
</field>
</field>
</record>
<!-- End -->
<record id="account_tax_view_price" model="ir.ui.view">
<field name="name">account.tax.exlcuded.view.form</field>
<field name="type">form</field>
@@ -14,7 +40,7 @@
</field>
</field>
</record>
<record id="account_invoice_view_price" model="ir.ui.view">
<field name="name">account.invoice.vat.exlcuded.view.form</field>
<field name="type">form</field>
@@ -26,7 +52,7 @@
</field>
</field>
</record>
<record id="invoice_supplier_form_tax_include" model="ir.ui.view">
<field name="name">account.invoice.supplier.tax_include</field>
<field name="type">form</field>
@@ -38,7 +64,7 @@
</field>
</field>
</record>
<record id="invoice_supplier_form_tax_include2" model="ir.ui.view">
<field name="name">account.invoice.supplier.tax_include2</field>
<field name="type">form</field>
@@ -50,7 +76,7 @@
</field>
</field>
</record>
<record id="invoice_supplier_form_tax_include3" model="ir.ui.view">
<field name="name">account.invoice.supplier.tax_include3</field>
<field name="type">form</field>
@@ -62,7 +88,7 @@
</field>
</field>
</record>
<record id="view_invoice_line_tree" model="ir.ui.view">
<field name="name">account.invoice.line.tree</field>
<field name="model">account.invoice.line</field>
@@ -74,6 +100,6 @@
</field>
</field>
</record>
</data>
</openerp>
-1
View File
@@ -20,6 +20,5 @@
##############################################################################
import voucher
import account
import report
import wizard
+7 -3
View File
@@ -36,7 +36,10 @@
""",
"category" : "Generic Modules/Accounting",
"website" : "http://tinyerp.com",
"depends" : ["base", "account"],
"depends" : [
"base",
"account"
],
"init_xml" : [
],
@@ -46,11 +49,12 @@
"update_xml" : [
"security/ir.model.access.csv",
"voucher_sequence.xml",
"account_report.xml",
"voucher_workflow.xml",
"voucher_report.xml",
"voucher_view.xml",
"voucher_wizard.xml",
"account_view.xml",
"wizard/account_voucher_open_view.xml",
],
'certificate': '0037580727101',
"active": False,
-219
View File
@@ -1,219 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import netsvc
from osv import fields, osv
import ir
import pooler
import mx.DateTime
from mx.DateTime import RelativeDateTime
from tools import config
class account_account(osv.osv):
_inherit = "account.account"
def _get_level(self, cr, uid, ids, field_name, arg, context={}):
res={}
acc_obj=self.browse(cr,uid,ids)
for aobj in acc_obj:
level = 0
if aobj.parent_id :
obj=self.browse(cr,uid,aobj.parent_id.id)
level= obj.level + 1
res[aobj.id] = level
return res
def _get_children_and_consol(self, cr, uid, ids, context={}):
ids2=[]
temp=[]
read_data= self.read(cr, uid, ids,['id','child_id'], context)
for data in read_data:
ids2.append(data['id'])
if data['child_id']:
temp=[]
for x in data['child_id']:
temp.append(x)
ids2 += self._get_children_and_consol(cr, uid, temp, context)
return ids2
_columns = {
'journal_id':fields.many2one('account.journal', 'Journal',domain=[('type','=','situation')]),
'open_bal' : fields.float('Opening Balance',digits=(16,2)),
'level': fields.function(_get_level, string='Level', method=True, store=True, type='integer'),
'type1':fields.selection([('dr','Debit'),('cr','Credit'),('none','None')], 'Dr/Cr',store=True),
}
def compute_total(self, cr, uid, ids, yr_st_date, yr_end_date, st_date, end_date, field_names, context={}):
if not (st_date >= yr_st_date and end_date <= yr_end_date):
return {}
query = "l.date >= '%s' AND l.date <= '%s'" % (st_date, end_date)
return self.__compute(cr, uid, ids, field_names, context=context, query=query)
def create(self, cr, uid, vals, context={}):
name=self.search(cr,uid,[('name','ilike',vals['name']),('company_id','=',vals['name'])])
if name:
raise osv.except_osv('Error', 'Account is Already Created !')
obj=self.pool.get('account.account.type').browse(cr,uid,vals['user_type'])
if obj.code in ('cash','asset','expense'):
vals['type1'] = 'dr'
elif obj.code in ('equity','income','liability') :
vals['type1'] = 'cr'
else:
vals['type1'] = 'none'
journal_ids=self.pool.get('account.journal').search(cr,uid,[('name','=','Opening Journal')])
vals['journal_id'] = journal_ids and journal_ids[0] or False
account_id = super(account_account, self).create(cr, uid, vals, context)
if vals.get('type1', False) != False:
journal_id = vals.get('journal_id',False)
if journal_id and vals.has_key('open_bal'):
if vals['open_bal'] != 0.0:
journal = self.pool.get('account.journal').browse(cr, uid, [journal_id])
if journal and journal[0].sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal[0].sequence_id.id)
move=self.pool.get('account.move').search(cr,uid,[('journal_id','=',journal_id)])
if not move:
move = False
move_data = {'name': name, 'journal_id': journal_id}
move_id=self.pool.get('account.move').create(cr,uid,move_data)
move_obj=self.pool.get('account.move').browse(cr,uid,move_id)
else:
move_obj=self.pool.get('account.move').browse(cr,uid,move[0])
self_obj=self.browse(cr,uid,account_id)
move_line = {
'name':journal[0].name,
'debit':self_obj.debit or False,
'credit':self_obj.credit or False,
'account_id':account_id or False,
'move_id':move and move[0] or move_id,
'journal_id':journal_id ,
'period_id':move_obj.period_id.id,
}
if vals['type1'] == 'dr':
move_line['debit'] = vals['open_bal'] or False
elif vals['type1'] == 'cr':
move_line['credit'] = vals['open_bal'] or False
self.pool.get('account.move.line').create(cr,uid,move_line)
return account_id
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
res_temp={}
if vals.has_key('name'):
if not vals.has_key('company_id'):
vals['company_id']=self.browse(cr,uid,ids)[0].company_id.id
name=self.search(cr,uid,[('name','ilike',vals['name']),('company_id','=',vals['company_id'])])
if name:
raise osv.except_osv('Error', 'Same Account Name is Already present !')
if vals.has_key('user_type'):
obj=self.pool.get('account.account.type').browse(cr,uid,vals['user_type'])
if obj.code in ('asset','expense'):
vals['type1'] = 'dr'
elif obj.code in ('income','liability') :
vals['type1'] = 'cr'
else:
vals['type1'] = 'none'
super(account_account, self).write(cr, uid,ids, vals, context)
if vals.has_key('open_bal'):
self_obj= self.browse(cr,uid,ids)
move_pool=self.pool.get('account.move')
if vals:
for obj in self_obj:
flg=0
if obj.journal_id and obj.journal_id.type == 'situation':
move=move_pool.search(cr,uid,[('journal_id','=',obj.journal_id.id)])
if move:
move_obj=move_pool.browse(cr,uid,move[0])
move=move[0]
else:
name = self.pool.get('ir.sequence').get_id(cr, uid, obj.journal_id.sequence_id.id)
move_data = {'name': name, 'journal_id': obj.journal_id.id}
move=self.pool.get('account.move').create(cr,uid,move_data)
move_obj=move_pool.browse(cr,uid,move)
move_line_data={'name':obj.journal_id.name,
'debit':obj.debit or 0.0,
'credit':obj.credit or 0.0,
'account_id':obj.id,
'move_id':move,
'journal_id':obj.journal_id.id,
'period_id':move_obj.period_id.id,
}
if obj.type1:
if obj.type1 == 'dr':
move_line_data['debit'] = obj.open_bal
elif obj.type1 == 'cr':
move_line_data['credit'] = obj.open_bal
if move_obj and move:
for move_line in move_obj.line_id:
if move_line.account_id.id == obj.id:
if move_line_data['debit'] == 0.0 and move_line_data['credit']== 0.0:
self.pool.get('account.move.line').unlink(cr,uid,[move_line.id])
else:
self.pool.get('account.move.line').write(cr,uid,[move_line.id],move_line_data)
flg=1
if not flg:
self.pool.get('account.move.line').create(cr,uid,move_line_data)
return True
def onchange_type(self, cr, uid, ids,user_type,type1):
if not user_type:
return {'value' : {}}
type_obj=self.pool.get('account.account.type').browse(cr,uid,user_type)
if type_obj.code in ('asset','expense'):
type1 = 'dr'
elif type_obj.code in ('income','liability') :
type1 = 'cr'
else:
type1 = 'none'
return {
'value' : {'type1' : type1}
}
account_account()
class account_move(osv.osv):
_inherit = "account.move"
_columns = {
'name':fields.char('Name', size=256, required=True, readonly=True, states={'draft':[('readonly',False)]}),
}
account_move()
class res_currency(osv.osv):
_inherit = "res.currency"
_columns = {
'sub_name': fields.char('Sub Currency', size=32, required=True)
}
_defaults = {
'sub_name': lambda *a: 'cents',
}
res_currency()
class account_account_template(osv.osv):
_inherit = "account.account.template"
_columns = {
'type1':fields.selection([('dr','Debit'),('cr','Credit'),('none','None')], 'Dr/Cr',store=True),
}
account_account_template()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<report id="report_account_voucher"
string="Voucher Report (Cr/Dr)"
model="account.voucher"
name="voucher.cash_receipt.drcr"
rml="account_voucher/report/report_voucher.rml"
auto="False"
header = "False"
menu="True"/>
<report id="report_account_voucher_amt"
string="Voucher Report"
model="account.voucher"
name="voucher.cash_amount"
rml="account_voucher/report/report_voucher_amount.rml"
auto="False"
header = "False"
menu="True"/>
</data>
</openerp>
-76
View File
@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="account_form1">
<field name="name">account.form1</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="user_type" position="after">
<field name="balance" string="Closing Balance"/>
<field name="type1" />
<field name="open_bal"/>
<field name="journal_id"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_form2">
<field name="name">account.form2</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="user_type" position="replace">
<field name="user_type" select="1" on_change="onchange_type(user_type,type1)"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_tree1">
<field name="name">account.tree1</field>
<field name="inherit_id" ref="account.view_account_tree"/>
<field name="model">account.account</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="open_bal" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_tree2">
<field name="name">account.tree2</field>
<field name="inherit_id" ref="account.view_account_tree"/>
<field name="model">account.account</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<field name="company_currency_id" position="before">
<field name="type1"/>
</field>
</field>
</record>
<!-- sub_currency -->
<record model="ir.ui.view" id="sub_currency_form">
<field name="name">sub.currency.form</field>
<field name="inherit_id" ref="base.view_currency_form" />
<field name="model">res.currency</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="sub_name" />
</field>
</field>
</record>
<act_window name="Opening Balance Entry"
domain="[('journal_id', '=', journal_id)]"
res_model="account.move.line"
src_model="account.account"
id="act_account_acount_move_line_open1"/>
</data>
</openerp>
@@ -23,7 +23,6 @@ import time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher, self).__init__(cr, uid, name, context)
+185 -185
View File
@@ -26,24 +26,20 @@
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="voucher_lines">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="last_info">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,7" stop="0,7"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,6" stop="0,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,7" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,7" stop="1,7"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,6" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,6" stop="1,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,7" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,7" stop="2,7"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,6" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,6" stop="2,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
@@ -53,48 +49,42 @@
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="22.0" leading="27" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P13" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P14" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P16" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P17" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P18" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P19" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P20" fontName="Helvetica" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P21" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P22" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P23" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P24" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P25" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P26" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P27" rightIndent="0.0" leftIndent="71.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P28" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P29" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P30" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P31" fontName="Helvetica" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P32" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P33" rightIndent="0.0" leftIndent="71.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="Standard" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica-Bold" fontSize="22.0" leading="27" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P14" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P15" fontName="Helvetica" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P16" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P17" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P18" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P19" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P20" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P21" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P22" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P23" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P24" fontName="Helvetica" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P25" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P26" rightIndent="0.0" leftIndent="71.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P27" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Italic" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Table Contents" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Table Contents" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
@@ -103,26 +93,26 @@
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Drawing" fontName="Times-Italic" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Header" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="Addressee" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
<paraStyle name="Signature" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="terp_default_8_Italic" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Drawing" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Header" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="Addressee" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
<paraStyle name="Signature" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading 8" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 7" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 6" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
@@ -131,266 +121,281 @@
<paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 10" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Salutation" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Salutation" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_9_with_indent_10" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9_50" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<images/>
<story>
<para style="P29">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P4">[[ company.name ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].street ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].zip ]] [[ company.partner_id.address and company.partner_id.address[0].city ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].phone ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].email ]]</para>
<para style="P5">
<para style="P22">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P3">[[ company.name ]]</para>
<para style="P5">[[ company.partner_id.address and company.partner_id.address[0].street ]]</para>
<para style="P5">[[ company.partner_id.address and company.partner_id.address[0].zip ]] [[ company.partner_id.address and company.partner_id.address[0].city ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name ]]</para>
<para style="P5">[[ company.partner_id.address and company.partner_id.address[0].phone ]]</para>
<para style="P5">[[ company.partner_id.address and company.partner_id.address[0].email ]]</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P23">Cash Receipt Voucher [[ (voucher.type == 'rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Cash Payment Voucher [[ (voucher.type == 'pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P23">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Bank Payment Voucher [[ (voucher.type == 'bank_pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P22">
<para style="P18">Cash Receipt Voucher [[ (voucher.type == 'rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P1">Cash Payment Voucher [[ (voucher.type == 'pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P18">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P1">Bank Payment Voucher [[ (voucher.type == 'bank_pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P17">
<font color="white"> </font>
</para>
<blockTable colWidths="49.0,143.0,116.0,69.0,106.0" style="Table1">
<tr>
<td>
<para style="P10">No.</para>
<para style="P9">No.</para>
</td>
<td>
<para style="P11">[[ voucher.number ]]</para>
<para style="P10">[[ voucher.number ]]</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">Dated :</para>
<para style="P9">Dated :</para>
</td>
<td>
<para style="P11">[[ time.strftime('%d %B,%Y', time.strptime(voucher.date , '%Y-%m-%d')) or '' ]]</para>
<para style="P10">[[ time.strftime('%d %B,%Y', time.strptime(voucher.date , '%Y-%m-%d')) or '' ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P10">State :</para>
<para style="P9">State :</para>
</td>
<td>
<para style="P21">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P21">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P21">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P21">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
<para style="P16">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P16">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P16">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P16">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">Ref. :</para>
<para style="P9">Ref. :</para>
</td>
<td>
<para style="P11">[[ voucher.reference ]]</para>
<para style="P10">[[ voucher.reference ]]</para>
</td>
</tr>
</blockTable>
<para style="P13">
<para style="P11">
<font color="white"> </font>
</para>
<para style="P13">
<para style="P11">
<font color="white"> </font>
</para>
<blockTable colWidths="255.0,114.0,114.0" style="Heading1">
<blockTable colWidths="255.0,114.0,113.0" style="Heading1">
<tr>
<td>
<para style="P15">Particulars</para>
<para style="terp_header">Particulars</para>
</td>
<td>
<para style="P16">Debit</para>
<para style="terp_header_Right">Debit</para>
</td>
<td>
<para style="P16">Credit</para>
<para style="terp_header_Right">Credit</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1"/>
<blockTable colWidths="482.0" style="voucher_lines">
<tr>
<td>
<para style="terp_default_1">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_8">[[ repeatIn(voucher.move_ids,'move_ids') ]] </para>
<blockTable colWidths="251.0,114.0,111.0" style="Table4">
<tr>
<td>
<para style="P12">[[ (move_ids.partner_id and move_ids.partner_id.name) or '']] :</para>
<para style="P24">[[ move_ids.account_id.name ]] </para>
<para style="P27">[[ get_ref(voucher.id,move_ids) ]]</para>
</td>
<td>
<para style="P20">[[ move_ids.debit ]]</para>
</td>
<td>
<para style="P20">[[ move_ids.credit ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<para style="terp_default_1">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_8">[[ repeatIn(voucher.move_ids,'move_ids') ]] </para>
<blockTable colWidths="254.0,115.0,113.0" style="Table2">
<tr>
<td>
<para style="terp_default_Bold_9">
<font face="Helvetica" size="10.0">[[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(move_ids.debit) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(move_ids.credit) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_with_indent_10">
<font face="Helvetica">[[ move_ids.account_id.name ]] </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</section>
<para style="P28">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]</para>
</td>
<td>
<para style="terp_default_9_50">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9_50">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="253.0,114.0,114.0" style="last_info">
<tr>
<td>
<para style="P14">
<para style="P12">Through : </para>
</td>
<td>
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P14">Through : </para>
<para style="P19">[[ voucher.narration or '']]</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P25">[[ voucher.narration or '']]</para>
<para style="P12">On Account of : </para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P14">On Account of : </para>
<para style="P20">[[ voucher.name ]]</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<para style="P2">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P26">[[ voucher.name ]]</para>
<para style="P12">Amount (in words) : </para>
</td>
<td>
<para style="P3">
<para style="P12">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<para style="P12">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P14">Amount (in words) : </para>
<para style="P20">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
</td>
<td>
<para style="P14">
<para style="P11">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P14">
<para style="P11">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P26">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
</td>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P17">
<font color="white"> </font>
</para>
<para style="P25">[[ debit(voucher.move_ids)]]</para>
</td>
<td>
<para style="P18">[[ debit(voucher.move_ids)]]</para>
</td>
<td>
<para style="P18">[[ credit(voucher.move_ids) ]]</para>
<para style="P25">[[ credit(voucher.move_ids) ]]</para>
</td>
</tr>
</blockTable>
<para style="P19">
<para style="P14">
<font color="white"> </font>
</para>
<blockTable colWidths="142.0,99.0,105.0,136.0" style="Table3">
<tr>
<td>
<para style="P7">
<para style="P6">
<font color="white"> </font>
</para>
<para style="P7">
<para style="P6">
<font color="white"> </font>
</para>
<para style="P7">
<para style="P6">
<font color="white"> </font>
</para>
<para style="P7">
<para style="P6">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P6">
<font color="white"> </font>
</para>
</td>
@@ -404,32 +409,27 @@
<font color="white"> </font>
</para>
</td>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P22">Receiver's Signature</para>
<para style="P17">Receiver's Signature</para>
</td>
<td>
<para style="P22">
<para style="P17">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P22">
<para style="P17">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P22">Authorised Signatory</para>
<para style="P17">Authorised Signatory</para>
</td>
</tr>
</blockTable>
<para style="P1">
<para style="terp_default_8">
<font color="white"> </font>
</para>
</story>
@@ -23,7 +23,6 @@ import time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher_amount(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher_amount, self).__init__(cr, uid, name, context)
@@ -42,4 +41,4 @@ report_sxw.report_sxw(
'account.voucher',
'addons/account_voucher/report/report_voucher_amount.rml',
parser=report_voucher_amount,header=False
)
)
@@ -34,10 +34,10 @@
<blockTableStyle id="last_info">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,7" stop="0,7"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,6" stop="0,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,7" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,7" stop="1,7"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,6" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,6" stop="1,6"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
@@ -60,31 +60,27 @@
<paraStyle name="P11" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P14" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P16" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P17" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P18" fontName="Helvetica" fontSize="5.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P19" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P20" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P21" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P22" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P23" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P24" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P25" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P26" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P27" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P28" rightIndent="0.0" leftIndent="71.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P29" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="Standard" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P14" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P15" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P16" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P17" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P18" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P19" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P20" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P21" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P22" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P23" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P24" rightIndent="0.0" leftIndent="71.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P25" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Italic" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Table Contents" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Table Contents" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
@@ -93,26 +89,26 @@
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Drawing" fontName="Times-Italic" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Header" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="Addressee" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
<paraStyle name="Signature" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Drawing" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Header" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="Addressee" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
<paraStyle name="Signature" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading 8" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 7" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 6" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
@@ -121,17 +117,19 @@
<paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 10" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Salutation" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Salutation" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_9_30" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9_50" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<images/>
<story>
<para style="P24">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P20">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P4">[[ company.name ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].street ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].zip ]] [[ company.partner_id.address and company.partner_id.address[0].city ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name ]]</para>
@@ -140,11 +138,11 @@
<para style="P5">
<font color="white"> </font>
</para>
<para style="P21">Cash Receipt Voucher [[ (voucher.type == 'rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P17">Cash Receipt Voucher [[ (voucher.type == 'rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Cash Payment Voucher [[ (voucher.type == 'pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P21">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P17">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Bank Payment Voucher [[ (voucher.type == 'bank_pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P20">
<para style="P16">
<font color="white"> </font>
</para>
<blockTable colWidths="68.0,124.0,122.0,62.0,106.0" style="Table1">
@@ -172,10 +170,10 @@
<para style="P10">State :</para>
</td>
<td>
<para style="P19">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P19">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P19">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P19">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
<para style="P15">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P15">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P15">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P15">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="P3">
@@ -194,7 +192,7 @@
<para style="P10">Account :</para>
</td>
<td>
<para style="P19">[[ voucher.account_id.name ]]</para>
<para style="P15">[[ voucher.account_id.name ]]</para>
</td>
<td>
<para style="P3">
@@ -222,10 +220,10 @@
<blockTable colWidths="344.0,138.0" style="Heading1">
<tr>
<td>
<para style="P14">Particulars</para>
<para style="terp_header">Particulars</para>
</td>
<td>
<para style="P15">Amount</para>
<para style="terp_header_Right">Amount</para>
</td>
</tr>
</blockTable>
@@ -237,41 +235,60 @@
</para>
<section>
<para style="terp_default_8">[[ repeatIn(voucher.payment_ids,'payment_ids') ]] </para>
<blockTable colWidths="340.0,136.0" style="Table3">
<blockTable colWidths="342.0,135.0" style="Table3">
<tr>
<td>
<para style="P25">[[ payment_ids.partner_id.name ]] :</para>
<para style="P27">[[ payment_ids.account_id.name ]] </para>
<para style="P28">[[ payment_ids.ref ]] [[ payment_ids.amount ]] [[ payment_ids.type ]]</para>
<para style="terp_header">[[ payment_ids.partner_id and payment_ids.partner_id.name or '' ]] </para>
</td>
<td>
<para style="P26">[[ payment_ids.amount ]]</para>
<para style="terp_header_Right">[[ payment_ids.amount ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_30">[[ payment_ids.account_id.name ]] </para>
</td>
<td>
<para style="P22">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_50">[[ payment_ids.ref ]] [[ payment_ids.amount ]] </para>
</td>
<td>
<para style="terp_default_9_50">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_50">[[ payment_ids.type ]]</para>
</td>
<td>
<para style="terp_default_9_50">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<para style="terp_default_9">
<font color="white"> </font>
</para>
</section>
<para style="P29">
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="P25">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="344.0,138.0" style="last_info">
<tr>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P13">Through : </para>
@@ -284,7 +301,7 @@
</tr>
<tr>
<td>
<para style="P22">[[ voucher.narration or '' ]] </para>
<para style="P18">[[ voucher.narration or '' ]] </para>
</td>
<td>
<para style="P11">
@@ -304,7 +321,7 @@
</tr>
<tr>
<td>
<para style="P23">[[ voucher.name ]]</para>
<para style="P19">[[ voucher.name ]]</para>
</td>
<td>
<para style="P11">
@@ -324,7 +341,7 @@
</tr>
<tr>
<td>
<para style="P23">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
<para style="P19">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
</td>
<td>
<para style="P12">
@@ -339,11 +356,11 @@
</para>
</td>
<td>
<para style="P16">[[ voucher.amount ]]</para>
<para style="terp_header_Right">[[ voucher.amount ]]</para>
</td>
</tr>
</blockTable>
<para style="P17">
<para style="P14">
<font color="white"> </font>
</para>
<blockTable colWidths="142.0,99.0,105.0,136.0" style="Table5">
@@ -380,20 +397,20 @@
</tr>
<tr>
<td>
<para style="P20">Receiver's Signature</para>
<para style="P16">Receiver's Signature</para>
</td>
<td>
<para style="P20">
<para style="P16">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P20">
<para style="P16">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P20">Authorised Signatory</para>
<para style="P16">Authorised Signatory</para>
</td>
</tr>
</blockTable>
+105 -102
View File
@@ -21,13 +21,25 @@
import time
import netsvc
from osv import fields, osv
from osv import fields
from osv import osv
import ir
import pooler
import mx.DateTime
from mx.DateTime import RelativeDateTime
from tools import config
type2journal = {
'rec_voucher': 'cash',
'bank_rec_voucher': 'bank',
'pay_voucher': 'cash',
'bank_pay_voucher': 'bank',
'cont_voucher': 'cash',
'journal_sale_vou': 'sale',
'journal_pur_voucher': 'purchase',
'journal_voucher':'general'
}
class ir_sequence_type(osv.osv):
_inherit = "ir.sequence.type"
_columns = {
@@ -36,8 +48,19 @@ class ir_sequence_type(osv.osv):
}
ir_sequence_type()
class account_journal(osv.osv):
_inherit = "account.journal"
_columns = {
'max_amount': fields.float('Verify Transection', digits=(16, int(config['price_accuracy'])), help="Validate voucher entry twice before posting it, if transection amount more then entered here"),
}
account_journal()
class account_voucher(osv.osv):
def _get_period(self, cr, uid, context):
def _get_period(self, cr, uid, context={}):
if context.get('period_id', False):
return context.get('period_id')
periods = self.pool.get('account.period').find(cr, uid)
if periods:
return periods[0]
@@ -45,34 +68,22 @@ class account_voucher(osv.osv):
return False
def _get_type(self, cr, uid, context={}):
type = context.get('type', 'rec_voucher')
type = context.get('type', 'bank_rec_voucher')
return type
def _get_reference_type(self, cursor, user, context=None):
return [('none', 'Free Reference')]
def _get_journal(self, cr, uid, context):
type_inv = 'rec_voucher'
if type(context) == type(''):
type_inv = context
elif type(context) == type({}):
type_inv = context.get('type', 'rec_voucher')
type2journal = {
'rec_voucher': 'cash',
'bank_rec_voucher': 'cash',
'pay_voucher': 'cash',
'bank_pay_voucher': 'cash',
'cont_voucher': 'cash',
'journal_sale_vou': 'sale',
'journal_pur_voucher': 'purchase',
'journal_voucher':'expanse'
}
journal_obj = self.pool.get('account.journal')
ttype = type2journal.get(type_inv, 'cash')
res = journal_obj.search(cr, uid, [('type', '=', ttype)], limit=1)
def _get_journal(self, cr, uid, context={}):
journal_pool = self.pool.get('account.journal')
if context.get('journal_id', False):
return context.get('journal_id')
type_inv = context.get('type', 'rec_voucher')
ttype = type2journal.get(type_inv, type_inv)
res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
if res:
return res[0]
@@ -80,7 +91,7 @@ class account_voucher(osv.osv):
return False
def _get_currency(self, cr, uid, context):
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0]
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
if user.company_id:
return user.company_id.currency_id.id
else:
@@ -92,15 +103,15 @@ class account_voucher(osv.osv):
_columns = {
'name':fields.char('Name', size=256, required=True, readonly=True, states={'draft':[('readonly',False)]}),
'type': fields.selection([
('pay_voucher','Cash Payment Voucher'),
('bank_pay_voucher','Bank Payment Voucher'),
('rec_voucher','Cash Receipt Voucher'),
('bank_rec_voucher','Bank Receipt Voucher'),
('cont_voucher','Contra Voucher'),
('journal_sale_vou','Journal Sale Voucher'),
('journal_pur_voucher','Journal Purchase Voucher'),
('pay_voucher','Cash Payment'),
('bank_pay_voucher','Bank Payment'),
('rec_voucher','Cash Receipt'),
('bank_rec_voucher','Bank Receipt'),
('cont_voucher','Contra'),
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
],'Type', readonly=True, select=True , size=128),
],'Entry Type', select=True , size=128, readonly=True, states={'draft':[('readonly',False)]}),
'date':fields.date('Date', readonly=True, states={'draft':[('readonly',False)]}),
'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, domain=[('type','<>','view')]),
@@ -110,16 +121,17 @@ class account_voucher(osv.osv):
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state':fields.selection(
[('draft','Draft'),
('proforma','Pro-forma'),
('posted','Posted'),
('cancel','Cancel')
], 'State',
readonly=True,
help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Voucher. \
[('draft','Draft'),
('proforma','Pro-forma'),
('posted','Posted'),
('recheck','Waiting for Re-checking'),
('cancel','Cancel'),
('audit','Audit Complete')
], 'State', readonly=True, size=32,
help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Voucher. \
\n* The \'Pro-forma\' when voucher is in Pro-forma state,voucher does not have an voucher number. \
\n* The \'Posted\' state is used when user create voucher,a voucher number is generated and voucher entries are created in account \
\n* The \'Cancelled\' state is used when user cancel voucher.'),
\n* The \'Cancelled\' state is used when user cancel voucher.'),
'amount':fields.float('Amount', readonly=True),
'number':fields.char('Number', size=32, readonly=True),
'reference': fields.char('Voucher Reference', size=64),
@@ -131,43 +143,60 @@ class account_voucher(osv.osv):
}
_defaults = {
'state': lambda *a: 'draft',
'date' : lambda *a: time.strftime('%Y-%m-%d'),
'period_id': _get_period,
'type': _get_type,
'reference_type': lambda *a: 'none',
'journal_id':_get_journal,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher', context=c),
'currency_id': _get_currency,
'state': lambda *a: 'draft',
'date' : lambda *a: time.strftime('%Y-%m-%d'),
'reference_type': lambda *a: "none",
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
}
def _get_analityc_lines(self, cr, uid, id):
inv = self.browse(cr, uid, [id])[0]
cur_obj = self.pool.get('res.currency')
# def _get_analityc_lines(self, cr, uid, id):
# inv = self.browse(cr, uid, [id])[0]
# cur_obj = self.pool.get('res.currency')
def onchange_account(self, cr, uid, ids, account_id):
if not account_id:
return {'value':{'amount':False}}
account = self.pool.get('account.account').browse(cr,uid,account_id)
return {
'value':{'amount':False}
}
account = self.pool.get('account.account').browse(cr, uid, account_id)
balance=account.balance
return {'value':{'amount':balance}}
return {
'value':{'amount':balance}
}
def onchange_journal(self, cr, uid, ids, journal_id, type):
if not journal_id:
return {'value':{'account_id':False}}
return {
'value':{'account_id':False}
}
journal = self.pool.get('account.journal')
if journal_id and (type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher','journal_voucher')):
account_id = journal.browse(cr, uid, journal_id).default_debit_account_id
return {'value':{'account_id':account_id.id}}
return {
'value':{'account_id':account_id.id}
}
elif journal_id and (type in ('pay_voucher','bank_pay_voucher','journal_sale_vou')) :
account_id = journal.browse(cr, uid, journal_id).default_credit_account_id
return {'value':{'account_id':account_id.id}}
return {
'value':{'account_id':account_id.id}
}
else:
account_id = journal.browse(cr, uid, journal_id).default_credit_account_id
return {'value':{'account_id':account_id.id}}
return {
'value':{'account_id':account_id.id}
}
def open_voucher(self, cr, uid, ids, context={}):
obj = self.pool.get('account.voucher').browse(cr,uid,ids)
obj = self.pool.get('account.voucher').browse(cr, uid, ids)
total = 0
for i in obj[0].payment_ids:
total += i.amount
@@ -200,8 +229,7 @@ class account_voucher(osv.osv):
unlink_ids.append(t['id'])
else:
raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !')
osv.osv.unlink(self, cr, uid, unlink_ids)
return True
return super(account_voucher, self).unlink(self, cr, uid, unlink_ids)
def _get_analytic_lines(self, cr, uid, id):
inv = self.browse(cr, uid, [id])[0]
@@ -234,9 +262,12 @@ class account_voucher(osv.osv):
return iml
def action_move_line_create(self, cr, uid, ids, *args):
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
company_currency = inv.company_id.currency_id.id
line_ids = self.read(cr, uid, [inv.id], ['payment_ids'])[0]['payment_ids']
@@ -304,7 +335,8 @@ class account_voucher(osv.osv):
'name' : name,
'journal_id': journal_id,
'type' : inv.type,
'narration' : inv.narration
'narration' : inv.narration,
'date':inv.date
}
if inv.period_id:
move['period_id'] = inv.period_id.id
@@ -354,13 +386,14 @@ class account_voucher(osv.osv):
elif line.type == 'cr':
move_line['credit'] = line.amount or False
amount=line.amount * (-1)
move_line['analytic_account_id'] = line.account_analytic_id.id or False
ml_id=self.pool.get('account.move.line').create(cr, uid, move_line)
if inv.narration:
line.name=inv.narration
line.name = inv.narration
else:
line.name=line.name
line.name = line.name
if line.account_analytic_id:
an_line = {
@@ -385,7 +418,6 @@ class account_voucher(osv.osv):
def line_get_convert(self, cr, uid, x, date, context={}):
return {
'date':date,
'date_maturity': x.get('date_maturity', False),
@@ -401,6 +433,7 @@ class account_voucher(osv.osv):
'tax_amount': x.get('tax_amount', False),
'ref':x.get('ref',False)
}
def _convert_ref(self, cr, uid, ref):
return (ref or '').replace('/','')
@@ -433,14 +466,14 @@ class account_voucher(osv.osv):
if not len(ids):
return []
types = {
'pay_voucher': 'CPV: ',
'rec_voucher': 'CRV: ',
'cont_voucher': 'CV: ',
'bank_pay_voucher': 'BPV: ',
'bank_rec_voucher': 'BRV: ',
'journal_sale_vou': 'JSV: ',
'journal_pur_voucher': 'JPV: ',
'journal_voucher':'JV'
'pay_voucher': 'CPV: ',
'rec_voucher': 'CRV: ',
'cont_voucher': 'CV: ',
'bank_pay_voucher': 'BPV: ',
'bank_rec_voucher': 'BRV: ',
'journal_sale_vou': 'JSV: ',
'journal_pur_voucher': 'JPV: ',
'journal_voucher':'JV'
}
return [(r['id'], types[r['type']]+(r['number'] or '')+' '+(r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')]
@@ -539,7 +572,6 @@ class account_voucher_line(osv.osv):
if not amount:
return {'value' : {}}
if partner_id:
obj = self.pool.get('res.partner')
if type1 in ('rec_voucher', 'bank_rec_voucher', 'journal_voucher'):
if amount < 0 :
@@ -575,34 +607,23 @@ class account_voucher_line(osv.osv):
else:
if type1 in ('rec_voucher', 'bank_rec_voucher', 'journal_voucher'):
if amount < 0 :
type = 'dr'
else:
type = 'cr'
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
if amount < 0 :
type = 'cr'
else:
type = 'dr'
elif type1 in ('journal_sale_vou') :
if amount < 0 :
type = 'cr'
else:
type = 'dr'
elif type1 in ('journal_pur_voucher') :
if amount< 0 :
type = 'dr'
else:
type = 'cr'
return {
@@ -611,9 +632,7 @@ class account_voucher_line(osv.osv):
def onchange_type(self, cr, uid, ids,partner_id,amount,type,type1):
if partner_id:
obj = self.pool.get('res.partner')
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
if type == 'dr' :
account_id = obj.browse(cr, uid, partner_id).property_account_payable
@@ -637,7 +656,6 @@ class account_voucher_line(osv.osv):
else:
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
total=amount*(-1)
elif type1 in ('journal_pur_voucher') :
if type == 'dr' :
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
@@ -648,34 +666,25 @@ class account_voucher_line(osv.osv):
else:
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
if type == 'dr' :
total=amount*(-1)
else:
total=amount*(-1)
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
if type == 'cr' :
total=amount*(-1)
else:
total=amount*(-1)
elif type1 in ('journal_sale_vou') :
if type == 'cr' :
total=amount*(-1)
else:
total=amount*(-1)
elif type1 in ('journal_pur_voucher') :
if type == 'dr' :
total=amount*(-1)
else:
total=amount*(-1)
return {
@@ -694,9 +703,3 @@ class account_voucher_line(osv.osv):
}
account_voucher_line()
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<openerp>
<data>
<report id="report_account_voucher"
string="Print Voucher"
model="account.voucher"
name="voucher.cash_receipt.drcr"
rml="account_voucher/report/report_voucher.rml"
auto="False"
header = "False"
menu="True"/>
<report id="report_account_voucher_amt"
string="Print Receipt"
model="account.voucher"
name="voucher.cash_amount"
rml="account_voucher/report/report_voucher_amount.rml"
auto="False"
header = "False"
menu="True"/>
</data>
</openerp>
+85 -105
View File
@@ -1,110 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<record model="res.request.link" id="req_link_voucher">
<field name="name">Voucher</field>
<field name="object">account.voucher</field>
</record>
<!--
Sequences types for vouchers
-->
<record model="ir.sequence.type" id="seq_type_cash_rec_voucher">
<field name="name">Cash Receipt</field>
<field name="code">rec_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_cash_pay_voucher">
<field name="name">Cash Payment</field>
<field name="code">pay_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_bank_rec_voucher">
<field name="name">Bank Receipt</field>
<field name="code">bank_rec_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_bank_pay_voucher">
<field name="name">Bank Payment</field>
<field name="code">bank_pay_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_contra_voucher">
<field name="name">Contra Entry</field>
<field name="code">cont_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_jou_sale_voucher">
<field name="name">Sales Entry</field>
<field name="code">journal_sale_vou</field>
</record>
<record model="ir.sequence.type" id="seq_type_jou_pur_voucher">
<field name="name">Purchase Entry</field>
<field name="code">journal_pur_vou</field>
</record>
<!--
Sequences for vouchers
-->
<record model="ir.sequence" id="seq_cash_rec_voucher">
<field name="name">Cash Receipt</field>
<field name="code">rec_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_cash_pay_voucher">
<field name="name">Cash Payment</field>
<field name="code">pay_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_bank_rec_voucher">
<field name="name">Bank Receipt</field>
<field name="code">bank_rec_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_bank_pay_voucher">
<field name="name">Bank Payment</field>
<field name="code">bank_pay_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_contra_voucher">
<field name="name">Contra Entry</field>
<field name="code">cont_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_jou_sale_voucher">
<field name="name">Sales Entry</field>
<field name="code">journal_sale_vou</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_jou_pur_voucher">
<field name="name">Purchase Entry</field>
<field name="code">journal_pur_vou</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<data noupdate="1">
<record model="res.request.link" id="req_link_voucher">
<field name="name">Voucher</field>
<field name="object">account.voucher</field>
</record>
<!--
Sequences types for vouchers
-->
<record model="ir.sequence.type" id="seq_type_cash_rec_voucher">
<field name="name">Account Cash Received Voucher</field>
<field name="code">rec_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_cash_pay_voucher">
<field name="name">Account Cash Payble Voucher</field>
<field name="code">pay_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_bank_rec_voucher">
<field name="name">Account Bank Received Voucher</field>
<field name="code">bank_rec_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_bank_pay_voucher">
<field name="name">Account Bank Payble Voucher</field>
<field name="code">bank_pay_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_contra_voucher">
<field name="name">Account Contra Voucher</field>
<field name="code">cont_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_jou_sale_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">journal_sale_vou</field>
</record>
<record model="ir.sequence.type" id="seq_type_jou_pur_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">journal_pur_vou</field>
</record>
<!--
Sequences for vouchers
-->
<record model="ir.sequence" id="seq_cash_rec_voucher">
<field name="name">Account Cash Received Voucher</field>
<field name="code">rec_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_cash_pay_voucher">
<field name="name">Account Cash Payble Voucher</field>
<field name="code">pay_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_bank_rec_voucher">
<field name="name">Account Bank Received Voucher</field>
<field name="code">bank_rec_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_bank_pay_voucher">
<field name="name">Account Bank Payble Voucher</field>
<field name="code">bank_pay_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_contra_voucher">
<field name="name">Account Contra Voucher</field>
<field name="code">cont_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_jou_sale_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">journal_sale_vou</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_jou_pur_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">journal_pur_vou</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<!--
Sequences types for analytic account
<record model="ir.sequence.type" id="seq_type_analytic_account">
<field name="name">Analytic account</field>
<field name="code">account.analytic.account</field>
</record>
Sequence for analytic account
<record model="ir.sequence" id="seq_analytic_account">
<field name="name">Analytic account sequence</field>
<field name="code">account.analytic.account</field>
<field name="padding" eval="3" />
<field name="number_next" eval="2708" />
</record>
-->
</data>
</data>
</openerp>
+187 -140
View File
@@ -6,13 +6,16 @@
<field name="model">account.voucher</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Vouchers">
<tree string="Accounting Vouchers">
<field name="date"/>
<field name="number"/>
<field name="name"/>
<field name="journal_id"/>
<field name="type" invisible=" not context.get('set_visible',True)"/>
<field name="account_id" />
<field name="amount"/>
<field name="date"/>
<field name="amount" sum="Total Amount"/>
<field name="period_id"/>
<field name="state"/>
</tree>
</field>
</record>
@@ -22,19 +25,17 @@
<field name="model">account.voucher</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Voucher">
<form string="Accounting Voucher">
<group col="6" colspan="4">
<field name="name" select="1" colspan="4"/>
<field name="name" colspan="4"/>
<field name="number"/>
<field name="journal_id" select="1" on_change="onchange_journal(journal_id,type)"/>
<field name="account_id" on_change="onchange_account(account_id)"/>
<field name="type" on_change="onchange_journal(journal_id,type)"/>
<field name="number"/>
<!--field name="amount" select="1" invisible="1"/-->
<!--field name="partner_id"/-->
</group>
<notebook colspan="4">
<page string="Entry Lines">
<field name="payment_ids" colspan="4" nolabel="1" height="275">
<page string="Journal Entries">
<field name="payment_ids" colspan="4" nolabel="1" height="260">
<tree string="Voucher Lines" editable="top">
<field name="account_analytic_id"/>
<field name="partner_id" on_change="onchange_partner(partner_id,type,parent.type)"/>
@@ -46,13 +47,14 @@
</tree>
</field>
<separator string="Narration" colspan="4"/>
<field name="narration" colspan="4" nolabel="1"/>
<field name="narration" colspan="4" nolabel="1" height="50"/>
<group col="6" colspan="6">
<field name="state"/>
<button name="open_voucher" string="Pro-forma" states="draft" type="object" icon="gtk-open"/>
<button name="proforma_voucher" string="Create" states="proforma" type="object" icon="gtk-go-forward"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma,posted" type="object" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" type="object" string="Set to Draft" icon="gtk-convert"/>
<button name="open_voucher" string="Pro-forma" states="draft"/>
<button name="proforma_voucher" string="Create" states="proforma"/>
<button name="recheck_voucher" string="Validate" states="recheck"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma,recheck" type="object"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
</group>
</page>
<page string="Other Info">
@@ -69,155 +71,200 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_voucher_list">
<field name="name">Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<record id="view_account_move_filter" model="ir.ui.view">
<field name="name">account.voucher.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
<filter icon="terp-account" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter icon="terp-account" string="Proforma" domain="[('state','=','proforma')]" help="Proforma Vouchers"/>
<filter icon="terp-account" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<filter icon="terp-account" string="Cancel" domain="[('state','=','cancel')]" help="Cancel Vouchers"/>
<separator orientation="vertical"/>
<field name="date" select='1'/>
<field name="name" select='1'/>
<field name="number" select='1'/>
<field name="journal_id" select='1'/>
<field name="partner_id" select='1'/>
<field name="period_id" select='1'/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-account" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-account" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Type" icon="terp-account" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
<filter string="States" icon="terp-account" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="1" string="Extended options...">
<field name="journal_id" widget="selection" context="{'journal_id': self}" />
<field name="period_id" widget="selection" context="{'period_id': self}" groups="base.group_extended"/>
<field name="type" context="{'type': self}" />
</group>
</search>
</field>
</record>
<menuitem action="action_voucher_list" id="menu_action_voucher_list"
name="Voucher Entries" parent="account.menu_finance_entries" sequence="60"/>
<!-- Receipt Vouchers -->
<record model="ir.actions.act_window" id="action_receipt_vou_voucher_list">
<field name="name">Receipt Vouchers</field>
<field name="name">Voucher Entries</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','like','rec_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
<!-- <field name="domain">[('type','like','rec_voucher')]</field>-->
<!-- <field name="context">{'type':'rec_voucher'}</field>-->
</record>
<menuitem name="Receipt Vouchers" id="menu_action_receipt_vou_voucher_list"
action="action_receipt_vou_voucher_list" parent="menu_action_voucher_list"/>
<menuitem id="menu_action_receipt_vou_voucher_list"
action="action_receipt_vou_voucher_list" parent="account.menu_finance_entries" sequence="8"/>
<record model="ir.actions.act_window" id="action_receipt_cashreceipt_voucher_list">
<field name="name">Cash Receipt</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','rec_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Cash Receipts" id="menu_action_receipt_cashreceipt_voucher_list"
action="action_receipt_cashreceipt_voucher_list" parent="menu_action_receipt_vou_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_receipt_cashreceipt_voucher_list">-->
<!-- <field name="name">Cash Receipt</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','rec_voucher')]</field>-->
<!-- <field name="context">{'type':'rec_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_receipt_cashreceipt_voucher_list"-->
<!-- action="action_receipt_cashreceipt_voucher_list" parent="menu_action_receipt_vou_voucher_list"/>-->
<record model="ir.actions.act_window" id="action_receipt_bakreceipt_voucher_list">
<field name="name">Bank Receipt</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','bank_rec_voucher')]</field>
<field name="context">{'type':'bank_rec_voucher'}</field>
</record>
<menuitem name="Bank Receipts" id="menu_action_receipt_bakreceipt_voucher_list"
action="action_receipt_bakreceipt_voucher_list" parent="menu_action_receipt_vou_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_receipt_bakreceipt_voucher_list">-->
<!-- <field name="name">Bank Receipt</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','bank_rec_voucher')]</field>-->
<!-- <field name="context">{'type':'bank_rec_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_receipt_bakreceipt_voucher_list"-->
<!-- action="action_receipt_bakreceipt_voucher_list" parent="menu_action_receipt_vou_voucher_list"/>-->
<!-- End Receipt Vouchers -->
<!-- Payment Vouchers -->
<record model="ir.actions.act_window" id="action_payments_voucher_list">
<field name="name">Payment Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','like','pay_voucher')]</field>
<field name="context">{'type':'pay_voucher'}</field>
</record>
<menuitem name="Payment Vouchers" id="menu_action_payments_voucher_list"
action="action_payments_voucher_list" parent="menu_action_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_payments_voucher_list">-->
<!-- <field name="name">Payable Entries</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','like','pay_voucher')]</field>-->
<!-- <field name="context">{'type':'pay_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_payments_voucher_list"-->
<!-- action="action_payments_voucher_list" parent="account.menu_finance_entries" sequence="8"/>-->
<record model="ir.actions.act_window" id="action_payments_cashpay_voucher_list">
<field name="name">Payment Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','pay_voucher')]</field>
<field name="context">{'type':'pay_voucher'}</field>
</record>
<menuitem name="Cash Payments" id="menu_action_payments_cashpay_voucher_list"
action="action_payments_cashpay_voucher_list" parent="menu_action_payments_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_payments_cashpay_voucher_list">-->
<!-- <field name="name">Cash Payment</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','pay_voucher')]</field>-->
<!-- <field name="context">{'type':'pay_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_payments_cashpay_voucher_list"-->
<!-- action="action_payments_cashpay_voucher_list" parent="menu_action_payments_voucher_list"/>-->
<record model="ir.actions.act_window" id="action_payments_bankpay_voucher_list">
<field name="name">Payment Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','bank_pay_voucher')]</field>
<field name="context">{'type':'bank_pay_voucher'}</field>
</record>
<menuitem name="Bank Payments" id="menu_action_payments_bankpay_voucher_list"
action="action_payments_bankpay_voucher_list" parent="menu_action_payments_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_payments_bankpay_voucher_list">-->
<!-- <field name="name">Bank Payment</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','bank_pay_voucher')]</field>-->
<!-- <field name="context">{'type':'bank_pay_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_payments_bankpay_voucher_list"-->
<!-- action="action_payments_bankpay_voucher_list" parent="menu_action_payments_voucher_list"/>-->
<!-- End Payment Vouchers -->
<!-- End Payment Vouchers -->
<!-- Other Voucher Enries -->
<record model="ir.actions.act_window" id="action_other_voucher_list">
<field name="name">Other Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
</record>
<menuitem name="Other Vouchers" id="menu_action_other_voucher_list"
action="action_other_voucher_list" parent="menu_action_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_other_voucher_list">-->
<!-- <field name="name">Other Entries</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_other_voucher_list"-->
<!-- action="action_other_voucher_list" parent="account.menu_finance_entries" sequence="8"/>-->
<record model="ir.actions.act_window" id="action_view_cont_voucher_form">
<field name="name">Contra Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','cont_voucher')]</field>
<field name="context">{'type':'cont_voucher'}</field>
</record>
<menuitem name="Contra Voucher" id="menu_action_view_cont_voucher_form"
action="action_view_cont_voucher_form" parent="menu_action_other_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_view_cont_voucher_form">-->
<!-- <field name="name">Contra Entries</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','cont_voucher')]</field>-->
<!-- <field name="context">{'type':'cont_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_view_cont_voucher_form"-->
<!-- action="action_view_cont_voucher_form" parent="menu_action_other_voucher_list"/>-->
<record model="ir.actions.act_window" id="action_view_jour_sale_voucher_form">
<field name="name">Journal Sale Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','journal_sale_vou')]</field>
<field name="context">{'type':'journal_sale_vou'}</field>
</record>
<menuitem name="Journal Sale Voucher" id="menu_action_view_jour_sale_voucher_form"
action="action_view_jour_sale_voucher_form" parent="menu_action_other_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_view_jour_sale_voucher_form">-->
<!-- <field name="name">Journal Sale</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','journal_sale_vou')]</field>-->
<!-- <field name="context">{'type':'journal_sale_vou'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_view_jour_sale_voucher_form"-->
<!-- action="action_view_jour_sale_voucher_form" parent="menu_action_other_voucher_list"/>-->
<record model="ir.actions.act_window" id="action_view_jour_pur_voucher_form">
<field name="name">Journal Purchase Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','journal_pur_voucher')]</field>
<field name="context">{'type':'journal_pur_voucher'}</field>
</record>
<menuitem name="Journal Purchase Voucher" id="menu_action_view_jour_pur_voucher_form"
action="action_view_jour_pur_voucher_form" parent="menu_action_other_voucher_list"/>
<!-- <record model="ir.actions.act_window" id="action_view_jour_pur_voucher_form">-->
<!-- <field name="name">Journal Purchase</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','journal_pur_voucher')]</field>-->
<!-- <field name="context">{'type':'journal_pur_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_view_jour_pur_voucher_form"-->
<!-- action="action_view_jour_pur_voucher_form" parent="menu_action_other_voucher_list"/>-->
<record model="ir.actions.act_window" id="action_view_jour_voucher_form">
<field name="name">Journal Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','journal_voucher')]</field>
<field name="context">{'type':'journal_voucher'}</field>
<!-- <record model="ir.actions.act_window" id="action_view_jour_voucher_form">-->
<!-- <field name="name">Journal Voucher</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="view_id" eval="view_voucher_tree"/>-->
<!-- <field name="domain">[('type','=','journal_voucher')]</field>-->
<!-- <field name="context">{'type':'journal_voucher'}</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_action_view_jour_voucher_form"-->
<!-- action="action_view_jour_voucher_form" parent="menu_action_other_voucher_list"/>-->
<record model="ir.ui.view" id="view_account_journal_form_inherit">
<field name="name">account.journal.form.inherit</field>
<field name="model">account.journal</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="allow_date" position="after">
<field name="max_amount" select="1"/>
</field>
</field>
</record>
<menuitem
name="Journal Voucher" id="menu_action_view_jour_voucher_form"
action="action_view_jour_voucher_form" parent="menu_action_other_voucher_list"/>
<act_window
domain="[('journal_id', '=', active_id)]"
id="act_journal_voucher_open"
name="Voucher Entries"
context="{'journal_id': active_id, 'type':type}"
res_model="account.voucher"
src_model="account.journal"/>
</data>
</openerp>
+15 -17
View File
@@ -1,20 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- <wizard
id="wizard_account_voucher_open"
model="account.voucher"
name="account.voucher.open"
menu="False"
string="Open a Voucher Entry"/>
<menuitem
action="wizard_account_voucher_open"
id="menu_wizard_account_voucher_open"
name="Open Vouchers"
sequence="0"
type="wizard"
parent="menu_action_voucher_list"/> -->
</data>
<data>
<!-- <wizard-->
<!-- id="wizard_account_voucher_open"-->
<!-- model="account.voucher"-->
<!-- name="account.voucher.open"-->
<!-- menu="False"-->
<!-- string="Open a Voucher Entry"/>-->
<!-- <menuitem-->
<!-- action="wizard_account_voucher_open"-->
<!-- id="menu_wizard_account_voucher_open"-->
<!-- name="Open Vouchers"-->
<!-- sequence="0"-->
<!-- type="wizard"-->
<!-- parent="menu_action_voucher_list"/>-->
</data>
</openerp>
+43 -38
View File
@@ -1,75 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="wkf_voucher" model="workflow">
<data>
<record id="wkf" model="workflow">
<field name="name">account.voucher.basic</field>
<field name="osv">account.voucher</field>
<field name="on_create">True</field>
</record>
<record id="act_draft" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="wkf_id" ref="wkf"/>
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<record id="act_performa" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="name">performa</field>
<field name="action">open_voucher()</field>
<field name="action">write({'state':'draft'})</field>
<field name="kind">function</field>
</record>
<record id="act_posted" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="name">posted</field>
<field name="action">proforma_voucher()</field>
<record id="act_proforma" model="workflow.activity">
<field name="wkf_id" ref="wkf"/>
<field name="name">proforma</field>
<field name="action">write({'state':'proforma'})
open_voucher()</field>
<field name="kind">function</field>
</record>
<record id="act_done" model="workflow.activity">
<field name="wkf_id" ref="wkf"/>
<field name="name">done</field>
<field name="action">write({'state':'posted'})
proforma_voucher()</field>
<field name="flow_stop">True</field>
<field name="kind">function</field>
</record>
<record id="act_cancel" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="name">cancel</field>
<field name="action">cancel_voucher()</field>
<record id="act_recheck" model="workflow.activity">
<field name="wkf_id" ref="wkf"/>
<field name="name">recheck</field>
<field name="action">write({'state':'recheck'})</field>
<field name="kind">function</field>
</record>
<record id="t1" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_performa"/>
<field name="act_to" ref="act_proforma"/>
<field name="signal">open_voucher</field>
</record>
<record id="t2" model="workflow.transition">
<field name="act_from" ref="act_performa"/>
<field name="act_to" ref="act_posted"/>
<field name="act_from" ref="act_proforma"/>
<field name="act_to" ref="act_done"/>
<field name="signal">proforma_voucher</field>
<field name="condition">amount &lt;= journal_id.max_amount</field>
</record>
<record id="t3" model="workflow.transition">
<field name="act_from" ref="act_performa"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">cancel_voucher</field>
<field name="act_from" ref="act_proforma"/>
<field name="act_to" ref="act_recheck"/>
<field name="signal">proforma_voucher</field>
<field name="condition">amount &gt; journal_id.max_amount</field>
</record>
<record id="t4" model="workflow.transition">
<field name="act_from" ref="act_recheck"/>
<field name="act_to" ref="act_done"/>
<field name="signal">recheck_voucher</field>
</record>
<record id="t5" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">cancel_voucher</field>
<field name="act_from" ref="act_recheck"/>
<field name="act_to" ref="act_draft"/>
<field name="signal">action_cancel_draft</field>
</record>
<record id="t6" model="workflow.transition">
<field name="act_from" ref="act_posted"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">cancel_voucher</field>
<field name="act_from" ref="act_proforma"/>
<field name="act_to" ref="act_draft"/>
<field name="signal">action_cancel_draft</field>
</record>
<record id="t7" model="workflow.transition">
<field name="act_from" ref="act_cancel"/>
<field name="act_to" ref="act_performa"/>
<field name="signal">open_voucher</field>
</record>
</data>
</data>
</openerp>
@@ -31,11 +31,11 @@ _types = {
'journal_pur_voucher':'Journal Purchase Voucher'
}
_states = {
'draft':'Draft',
'proforma':'Pro-forma',
'posted':'Posted',
'cancel':'Cancel'
}
'draft':'Draft',
'proforma':'Pro-forma',
'posted':'Posted',
'cancel':'Cancel'
}
class account_open_voucher(osv.osv_memory):
_name = "account.open.voucher"
@@ -43,18 +43,18 @@ class account_open_voucher(osv.osv_memory):
_columns = {
'type': fields.selection([('pay_voucher','Cash Payment Voucher'),
('bank_pay_voucher','Bank Payment Voucher'),
('rec_voucher','Cash Receipt Voucher'),
('bank_rec_voucher','Bank Receipt Voucher'),
('cont_voucher','Contra Voucher'),
('journal_sale_vou','Journal Sale Voucher'),
('journal_pur_voucher','Journal Purchase Voucher')],'Voucher Type', required=True),
('bank_pay_voucher','Bank Payment Voucher'),
('rec_voucher','Cash Receipt Voucher'),
('bank_rec_voucher','Bank Receipt Voucher'),
('cont_voucher','Contra Voucher'),
('journal_sale_vou','Journal Sale Voucher'),
('journal_pur_voucher','Journal Purchase Voucher')],'Voucher Type', required=True),
'state': fields.selection([('draft','Draft'),
('proforma','Pro-forma'),
('posted','Posted'),
('cancel','Cancel')], 'State', required=True),
('proforma','Pro-forma'),
('posted','Posted'),
('cancel','Cancel')], 'State', required=True),
'period_ids': fields.many2many('account.period', 'voucher_period_rel', 'voucher_id', 'period_id', 'Periods'),
}
}
def action_open_window(self, cr, uid, ids, context=None):
obj_period = self.pool.get('account.period')
@@ -83,4 +83,4 @@ class account_open_voucher(osv.osv_memory):
account_open_voucher()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<data>
<record id="account_open_vouchers_view" model="ir.ui.view">
<field name="name">Open Vouchers</field>
<field name="model">account.open.voucher</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Open Vouchers">
<field name="type"/>
<field name="state"/>
<field name="period_ids" colspan="4"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="action_open_window" string="Open Voucher Entries" type="object" icon="gtk-ok"/>
</group>
</form>
<form string="Open Vouchers">
<field name="type"/>
<field name="state"/>
<field name="period_ids" colspan="4"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="action_open_window" string="Open Voucher Entries" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
</record>
<record id="action_account_open_vouchers" model="ir.actions.act_window">
<field name="name">Open Vouchers</field>
@@ -28,15 +28,15 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_open_vouchers_view"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
<field name="target">new</field>
</record>
<menuitem
icon="STOCK_EXECUTE"
name="Open Vouchers"
action="action_account_open_vouchers"
id="menu_account_voucher_open"
parent="menu_action_voucher_list"/>
<!-- <menuitem-->
<!-- icon="STOCK_EXECUTE"-->
<!-- name="Open Vouchers"-->
<!-- action="action_account_open_vouchers"-->
<!-- id="menu_account_voucher_open"-->
<!-- parent="menu_action_voucher_list"/>-->
</data>
</openerp>
</data>
</openerp>
+24
View File
@@ -0,0 +1,24 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_voucher_payment
import account_voucher_unreconcile
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+48
View File
@@ -0,0 +1,48 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "Invoice Payment/Receipt by Vouchers.",
"version" : "1.0",
"author" : 'Tiny & Axelor',
"description": """This module includes :
* It reconcile the invoice (supplier, customer) while paying through
Accounting Vouchers
""",
"category" : "Generic Modules/Indian Accounting",
"website" : "http://tinyerpindia.com",
"depends" : [
"base",
"account",
"account_voucher",
],
"init_xml" : [
],
"demo_xml" : [],
"update_xml" : [
"account_voucher_payment_view.xml",
"account_voucher_payment_wizard.xml"
],
"active": False,
"installable": True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+283
View File
@@ -0,0 +1,283 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
class account_move_line(osv.osv):
_inherit = "account.move.line"
_columns = {
'voucher_invoice': fields.many2one('account.invoice', 'Invoice', readonly=True),
}
account_move_line()
class account_voucher(osv.osv):
_inherit = 'account.voucher'
_columns = {
'voucher_line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=False, states={'proforma':[('readonly',True)]}),
}
def action_move_line_create(self, cr, uid, ids, *args):
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
company_currency = inv.company_id.currency_id.id
line_ids = self.read(cr, uid, [inv.id], ['payment_ids'])[0]['payment_ids']
ils = self.pool.get('account.voucher.line').read(cr, uid, line_ids)
iml = self._get_analytic_lines(cr, uid, inv.id)
diff_currency_p = inv.currency_id.id <> company_currency
total = 0
if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_voucher','journal_pur_voucher'):
ref = inv.reference
else:
ref = self._convert_ref(cr, uid, inv.number)
date = inv.date
total_currency = 0
for i in iml:
partner_id=i['partner_id']
acc_id = i['account_id']
if inv.currency_id.id != company_currency:
i['currency_id'] = inv.currency_id.id
i['amount_currency'] = i['amount']
else:
i['amount_currency'] = False
i['currency_id'] = False
if inv.type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher','journal_voucher'):
total += i['amount']
total_currency += i['amount_currency'] or i['amount']
i['amount'] = - i['amount']
else:
total -= i['amount']
total_currency -= i['amount_currency'] or i['amount']
name = inv['name'] or '/'
totlines = False
iml.append({
'type': 'dest',
'name': name,
'amount': total or False,
'account_id': acc_id,
'amount_currency': diff_currency_p \
and total_currency or False,
'currency_id': diff_currency_p \
and inv.currency_id.id or False,
'ref': ref,
'partner_id':partner_id or False,
})
date = inv.date
inv.amount=total
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x,date, context={})) ,iml)
an_journal_id=inv.journal_id.analytic_journal_id.id
journal_id = inv.journal_id.id
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
if journal.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
move = {
'name': name,
'journal_id': journal_id,
'voucher_type':inv.type,
'narration' : inv.narration,
'data':date
}
if inv.period_id:
move['period_id'] = inv.period_id.id
for i in line:
i[2]['period_id'] = inv.period_id.id
move_id = self.pool.get('account.move').create(cr, uid, move)
ref=move['name']
amount=0.0
#create the first line our self
move_line = {
'name': inv.name,
'voucher_invoice' : iml and iml[0]['invoice'] and iml[0]['invoice'].id or False,
'debit': False,
'credit':False,
'account_id': inv.account_id.id or False,
'move_id':move_id ,
'journal_id':journal_id ,
'period_id':inv.period_id.id,
'partner_id': False,
'ref': ref,
'date': date
}
if inv.type in ('rec_voucher', 'bank_rec_voucher', 'journal_pur_voucher', 'journal_voucher'):
move_line['debit'] = inv.amount
else:
move_line['credit'] = inv.amount * (-1)
self.pool.get('account.move.line').create(cr, uid, move_line)
id_mapping_dict = {}
mline_ids = []
for line in inv.voucher_line_ids:
move_line = {
'name':line.name,
'voucher_invoice' : iml and iml[0]['invoice'] and iml[0]['invoice'].id or False,
'debit':False,
'credit':False,
'move_id':move_id,
'account_id':line.account_id.id or False,
'journal_id':journal_id ,
'period_id':inv.period_id.id,
'partner_id':line.partner_id.id or False,
'ref':ref,
'date':date
}
if line.type == 'dr':
move_line['debit'] = line.amount or False
amount=line.amount
elif line.type == 'cr':
move_line['credit'] = line.amount or False
amount=line.amount * (-1)
ml_id=self.pool.get('account.move.line').create(cr, uid, move_line)
id_mapping_dict[line.id] = ml_id
total = 0.0
mline = self.pool.get('account.move.line')
if line.invoice_id.id:
invoice = self.pool.get('account.invoice').browse(cr, uid, line.invoice_id.id)
src_account_id = invoice.account_id.id
cr.execute('select id from account_move_line where move_id in ('+str(invoice.move_id.id)+')')
temp_ids = map(lambda x: x[0], cr.fetchall())
temp_ids.append(ml_id)
mlines = mline.browse(cr, uid, temp_ids)
for ml in mlines:
if ml.account_id.id==src_account_id:
mline_ids.append(ml.id)
total += (ml.debit or 0.0) - (ml.credit or 0.0)
#end if line.invoice_id.id:
if inv.narration:
line.name=inv.narration
else:
line.name=line.name
if line.account_analytic_id:
an_line = {
'name':line.name,
'date':date,
'amount':amount,
'account_id':line.account_analytic_id.id or False,
'move_id':ml_id,
'journal_id':an_journal_id ,
'general_account_id':line.account_id.id,
'ref':ref
}
self.pool.get('account.analytic.line').create(cr,uid,an_line)
if mline_ids:
self.pool.get('account.move.line').reconcile_partial(cr, uid, mline_ids, 'manual', context={})
self.write(cr, uid, [inv.id], {'move_id': move_id})
obj=self.pool.get('account.move').browse(cr, uid, move_id)
for line in obj.line_id :
cr.execute('insert into voucher_id (account_id,rel_account_move) values (%d, %d)',(int(ids[0]),int(line.id)))
return True
account_voucher()
class account_voucher_line(osv.osv):
_inherit = 'account.voucher.line'
def default_get(self, cr, uid, fields, context={}):
data = super(account_voucher_line, self).default_get(cr, uid, fields, context)
self.voucher_context = context
return data
_columns = {
'invoice_id' : fields.many2one('account.invoice','Invoice'),
}
def move_line_get_item(self, cr, uid, line, context={}):
res = super(account_voucher_line, self).move_line_get_item(cr, uid, line, context)
res['invoice'] = line.invoice_id or False
return res
def onchange_invoice_id(self, cr, uid, ids, invoice_id, context={}):
lines = []
if 'lines' in self.voucher_context:
lines = [x[2] for x in self.voucher_context['lines']]
if not invoice_id:
return {'value':{}}
else:
invoice_obj = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context)
residual = invoice_obj.residual
same_invoice_amounts = [x['amount'] for x in lines if x['invoice_id']==invoice_id]
residual -= sum(same_invoice_amounts)
return {'value' : {'amount':residual}}
def onchange_line_account(self, cr, uid, ids, account_id, type, type1):
if not account_id:
return {'value' : {'account_id' : False, 'type' : False ,'amount':False}}
obj = self.pool.get('account.account')
acc_id = False
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
acc_id = obj.browse(cr, uid, account_id)
balance = acc_id.credit
type = 'cr'
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
acc_id = obj.browse(cr, uid, account_id)
balance = acc_id.debit
type = 'dr'
elif type1 in ('journal_sale_vou') :
acc_id = obj.browse(cr, uid, account_id)
balance = acc_id.credit
type = 'dr'
elif type1 in ('journal_pur_voucher') :
acc_id = obj.browse(cr, uid, account_id)
balance = acc_id.debit
type = 'cr'
return {
'value' : {'type' : type, 'amount':balance}
}
account_voucher_line()
class account_invoice(osv.osv):
_inherit = "account.invoice"
def action_cancel(self, cr, uid, ids, *args):
res = super(account_invoice, self).action_cancel(cr, uid, ids, *args)
invoices = self.read(cr, uid, ids, ['move_id'])
voucher_db = self.pool.get('account.voucher')
voucher_ids = voucher_db.search(cr, uid, [])
voucher_obj = voucher_db.browse(cr, uid, voucher_ids)
move_db = self.pool.get('account.move')
move_ids = move_db.search(cr, uid, [])
move_obj = move_db.browse(cr, uid, move_ids)
return res
account_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
Voucher line extension
-->
<record id="view_voucher_form" model="ir.ui.view">
<field name="name">account.voucher.line.form.inherit</field>
<field name="model">account.voucher.line</field>
<field name="type">form</field>
<field name="inherit_id" ref="account_voucher.view_voucher_form"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="invoice_id" on_change="onchange_invoice_id(invoice_id)" domain="[('partner_id','=',partner_id),('state','=','open')]"/>
</field>
</field>
</record>
<record id="view_voucher_form" model="ir.ui.view">
<field name="name">account.voucher.form.inherit</field>
<field name="model">account.voucher</field>
<field name="type">form</field>
<field name="inherit_id" ref="account_voucher.view_voucher_form"/>
<field name="arch" type="xml">
<field name="payment_ids" position="replace">
<field name="voucher_line_ids" default_get="{'lines': voucher_line_ids }" colspan="4" nolabel="1" height="275">
<tree string="Voucher Lines" editable="top">
<field name="account_analytic_id"/>
<field name="partner_id" on_change="onchange_partner(partner_id, type, parent.type)"/>
<field name="account_id" on_change="onchange_line_account(account_id, type, parent.type)"/>
<field name="name"/>
<field name="invoice_id" on_change="onchange_invoice_id(invoice_id)" domain="[('partner_id','=',partner_id),('state','=','open'),('residual','&gt;',0.0)]"/>
<field name="type"/>
<field name="amount"/>
<field name="ref"/>
</tree>
</field>
</field>
</field>
</record>
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form.inherit</field>
<field name="model">account.move.line</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<field name="invoice" position="replace">
<field name="voucher_invoice"/>
</field>
</field>
</record>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.form.inherit</field>
<field name="model">account.move.line</field>
<field name="type">tree</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<field name="invoice" position="replace">
<field name="voucher_invoice"/>
</field>
</field>
</record>
</data>
</openerp>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<wizard
id="wizard_unreconcile_voucher"
menu="True"
model="account.voucher"
name="account.voucher.unreconcile"
string="Unreconcile entries"/>
</data>
</openerp>
@@ -0,0 +1,56 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import pooler
_info_form = '''<?xml version="1.0"?>
<form string="Unreconciliation">
<separator string="Unreconciliation transactions" colspan="4"/>
<image name="gtk-dialog-info" colspan="2"/>
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
</form>'''
def _trans_unrec(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
voucher = pool.get('account.voucher').browse(cr, uid, data.get('id'))
recs = None
for line in voucher.move_ids:
if line.reconcile_id:
recs = [line.reconcile_id.id]
for rec in recs:
pool.get('account.move.reconcile').unlink(cr, uid, rec)
return {}
class wiz_unreconcile(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel'), ('unrec', 'Unreconcile')]}
},
'unrec': {
'actions': [_trans_unrec],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_unreconcile('account.voucher.unreconcile')
@@ -0,0 +1,82 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_voucher_payment
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-05-13 20:11:36+0000\n"
"PO-Revision-Date: 2009-05-13 20:11:36+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_voucher_payment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation transactions"
msgstr ""
#. module: account_voucher_payment
#: model:ir.module.module,description:account_voucher_payment.module_name_translation
msgid "This module includes :\n"
" * It reconcile the invoice (supplier, customer) while paying through \n"
" Accounting Vouchers\n"
" "
msgstr ""
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable"
msgstr ""
#. module: account_voucher_payment
#: view:account.voucher:0
#: field:account.voucher,voucher_line_ids:0
msgid "Voucher Lines"
msgstr ""
#. module: account_voucher_payment
#: model:ir.module.module,shortdesc:account_voucher_payment.module_name_translation
msgid "Invoice Payment/Receipt by Vouchers."
msgstr ""
#. module: account_voucher_payment
#: model:ir.actions.wizard,name:account_voucher_payment.wizard_unreconcile_voucher
msgid "Unreconcile entries"
msgstr ""
#. module: account_voucher_payment
#: field:account.move.line,voucher_invoice:0
#: field:account.voucher.line,invoice_id:0
msgid "Invoice"
msgstr ""
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,end:0
msgid "Cancel"
msgstr ""
#. module: account_voucher_payment
#: field:account.voucher,partner_id:0
msgid "Partner"
msgstr ""
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,unrec:0
msgid "Unreconcile"
msgstr ""
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation"
msgstr ""
+94
View File
@@ -0,0 +1,94 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_voucher_payment
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-05-13 20:11+0000\n"
"PO-Revision-Date: 2010-01-26 11:00+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-21 03:47+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_voucher_payment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "XML invàlid per a la definició de la vista!"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation transactions"
msgstr "Trenca conciliació de transaccions"
#. module: account_voucher_payment
#: model:ir.module.module,description:account_voucher_payment.module_name_translation
msgid ""
"This module includes :\n"
" * It reconcile the invoice (supplier, customer) while paying through \n"
" Accounting Vouchers\n"
" "
msgstr ""
"Aquest mòdul inclou:\n"
" * Concilia factures de proveïdors i clients mentre són pagades "
"mitjançant \n"
" comprovants comptables\n"
" "
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid ""
"If you unreconciliate transactions, you must also verify all the actions "
"that are linked to those transactions because they will not be disable"
msgstr ""
"Si trenqueu conciliació de transaccions, també heu de comprovar totes les "
"accions que estan relacionades amb aquestes transaccions ja que no seran "
"eliminades"
#. module: account_voucher_payment
#: view:account.voucher:0
#: field:account.voucher,voucher_line_ids:0
msgid "Voucher Lines"
msgstr "Línies de comprovant"
#. module: account_voucher_payment
#: model:ir.module.module,shortdesc:account_voucher_payment.module_name_translation
msgid "Invoice Payment/Receipt by Vouchers."
msgstr "Pagaments i rebuts de factures per comprovant."
#. module: account_voucher_payment
#: model:ir.actions.wizard,name:account_voucher_payment.wizard_unreconcile_voucher
msgid "Unreconcile entries"
msgstr "Trenca conciliació entrades"
#. module: account_voucher_payment
#: field:account.move.line,voucher_invoice:0
#: field:account.voucher.line,invoice_id:0
msgid "Invoice"
msgstr "Factura"
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,end:0
msgid "Cancel"
msgstr "Cancel·la"
#. module: account_voucher_payment
#: field:account.voucher,partner_id:0
msgid "Partner"
msgstr ""
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,unrec:0
msgid "Unreconcile"
msgstr "Trenca conciliació"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation"
msgstr "Trenca conciliació"
@@ -0,0 +1,81 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_voucher_payment
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-05-13 19:47:47+0000\n"
"PO-Revision-Date: 2009-05-16 18:57+0100\n"
"Last-Translator: Jordi Esteve <jesteve@zikzakmedia.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
#. module: account_voucher_payment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "XML invàlid per a la definició de la vista!"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation transactions"
msgstr "Trenca conciliació de transaccions"
#. module: account_voucher_payment
#: field:account.move.line,voucher_invoice:0
#: field:account.voucher.line,invoice_id:0
msgid "Invoice"
msgstr "Factura"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable"
msgstr "Si trenqueu conciliació de transaccions, també heu de comprovar totes les accions que estan relacionades amb aquestes transaccions ja que no seran eliminades"
#. module: account_voucher_payment
#: view:account.voucher:0
#: field:account.voucher,voucher_line_ids:0
msgid "Voucher Lines"
msgstr "Línies de comprovant"
#. module: account_voucher_payment
#: model:ir.module.module,shortdesc:account_voucher_payment.module_name_translation
msgid "Invoice Payment/Receipt by Vouchers."
msgstr "Pagaments i rebuts de factures per comprovant."
#. module: account_voucher_payment
#: model:ir.actions.wizard,name:account_voucher_payment.wizard_unreconcile_voucher
msgid "Unreconcile entries"
msgstr "Trenca conciliació entrades"
#. module: account_voucher_payment
#: model:ir.module.module,description:account_voucher_payment.module_name_translation
msgid ""
"This module includes :\n"
" * It reconcile the invoice (supplier, customer) while paying through \n"
" Accounting Vouchers\n"
" "
msgstr ""
"Aquest mòdul inclou:\n"
" * Concilia factures de proveïdors i clients mentre són pagades mitjançant \n"
" comprovants comptables\n"
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,end:0
msgid "Cancel"
msgstr "Cancel·la"
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,unrec:0
msgid "Unreconcile"
msgstr "Trenca conciliació"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation"
msgstr "Trenca conciliació"
+92
View File
@@ -0,0 +1,92 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_voucher_payment
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-05-13 20:11+0000\n"
"PO-Revision-Date: 2010-02-19 05:54+0000\n"
"Last-Translator: Luis Alejandro Rangel Sánchez <xlarsx@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-21 03:47+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_voucher_payment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "¡XML inválido para la definición de la vista!"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation transactions"
msgstr "Romper conciliación de transacciones"
#. module: account_voucher_payment
#: model:ir.module.module,description:account_voucher_payment.module_name_translation
msgid ""
"This module includes :\n"
" * It reconcile the invoice (supplier, customer) while paying through \n"
" Accounting Vouchers\n"
" "
msgstr ""
"Este módulo incluye :\n"
" * Concilia facturas de proveedores y clientes mientras son pagadas "
"mediante \n"
" comprobantes contables\n"
" "
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid ""
"If you unreconciliate transactions, you must also verify all the actions "
"that are linked to those transactions because they will not be disable"
msgstr ""
"Si rompe conciliación de transacciones, también debe verificar todas las "
"acciones que están enlazadas a estas transacciones porque no serán eliminadas"
#. module: account_voucher_payment
#: view:account.voucher:0
#: field:account.voucher,voucher_line_ids:0
msgid "Voucher Lines"
msgstr "Líneas de comprobante"
#. module: account_voucher_payment
#: model:ir.module.module,shortdesc:account_voucher_payment.module_name_translation
msgid "Invoice Payment/Receipt by Vouchers."
msgstr "Pagos y recibos de facturas por comprobantes."
#. module: account_voucher_payment
#: model:ir.actions.wizard,name:account_voucher_payment.wizard_unreconcile_voucher
msgid "Unreconcile entries"
msgstr "Romper concilación entradas"
#. module: account_voucher_payment
#: field:account.move.line,voucher_invoice:0
#: field:account.voucher.line,invoice_id:0
msgid "Invoice"
msgstr "Factura"
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,end:0
msgid "Cancel"
msgstr "Cancelar"
#. module: account_voucher_payment
#: field:account.voucher,partner_id:0
msgid "Partner"
msgstr "Compañero"
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,unrec:0
msgid "Unreconcile"
msgstr "Romper conciliación"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation"
msgstr "Romper conciliación"
@@ -0,0 +1,81 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_voucher_payment
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-05-13 19:47:47+0000\n"
"PO-Revision-Date: 2009-05-16 18:57+0100\n"
"Last-Translator: Jordi Esteve <jesteve@zikzakmedia.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
#. module: account_voucher_payment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "¡XML inválido para la definición de la vista!"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation transactions"
msgstr "Romper conciliación de transacciones"
#. module: account_voucher_payment
#: field:account.move.line,voucher_invoice:0
#: field:account.voucher.line,invoice_id:0
msgid "Invoice"
msgstr "Factura"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable"
msgstr "Si rompe conciliación de transacciones, también debe verificar todas las acciones que están enlazadas a estas transacciones porque no serán eliminadas"
#. module: account_voucher_payment
#: view:account.voucher:0
#: field:account.voucher,voucher_line_ids:0
msgid "Voucher Lines"
msgstr "Líneas de comprobante"
#. module: account_voucher_payment
#: model:ir.module.module,shortdesc:account_voucher_payment.module_name_translation
msgid "Invoice Payment/Receipt by Vouchers."
msgstr "Pagos y recibos de facturas por comprobantes."
#. module: account_voucher_payment
#: model:ir.actions.wizard,name:account_voucher_payment.wizard_unreconcile_voucher
msgid "Unreconcile entries"
msgstr "Romper concilación entradas"
#. module: account_voucher_payment
#: model:ir.module.module,description:account_voucher_payment.module_name_translation
msgid ""
"This module includes :\n"
" * It reconcile the invoice (supplier, customer) while paying through \n"
" Accounting Vouchers\n"
" "
msgstr ""
"Este módulo incluye :\n"
" * Concilia facturas de proveedores y clientes mientras son pagadas mediante \n"
" comprobantes contables\n"
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,end:0
msgid "Cancel"
msgstr "Cancelar"
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,unrec:0
msgid "Unreconcile"
msgstr "Romper conciliación"
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation"
msgstr "Romper conciliación"
@@ -0,0 +1,77 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_voucher_payment
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.6\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-11-26 06:54:11+0000\n"
"PO-Revision-Date: 2009-11-26 06:54:11+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_voucher_payment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation transactions"
msgstr ""
#. module: account_voucher_payment
#: field:account.move.line,voucher_invoice:0
#: field:account.voucher.line,invoice_id:0
msgid "Invoice"
msgstr ""
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable"
msgstr ""
#. module: account_voucher_payment
#: view:account.voucher:0
#: field:account.voucher,voucher_line_ids:0
msgid "Voucher Lines"
msgstr ""
#. module: account_voucher_payment
#: model:ir.module.module,shortdesc:account_voucher_payment.module_meta_information
msgid "Invoice Payment/Receipt by Vouchers."
msgstr ""
#. module: account_voucher_payment
#: model:ir.actions.wizard,name:account_voucher_payment.wizard_unreconcile_voucher
msgid "Unreconcile entries"
msgstr ""
#. module: account_voucher_payment
#: model:ir.module.module,description:account_voucher_payment.module_meta_information
msgid "This module includes :\n"
" * It reconcile the invoice (supplier, customer) while paying through \n"
" Accounting Vouchers\n"
" "
msgstr ""
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,end:0
msgid "Cancel"
msgstr ""
#. module: account_voucher_payment
#: wizard_button:account.voucher.unreconcile,init,unrec:0
msgid "Unreconcile"
msgstr ""
#. module: account_voucher_payment
#: wizard_view:account.voucher.unreconcile,init:0
msgid "Unreconciliation"
msgstr ""
+21 -15
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-01-05 05:59+0000\n"
"PO-Revision-Date: 2010-05-17 23:03+0000\n"
"Last-Translator: Carlos Incaser <Unknown>\n"
"PO-Revision-Date: 2010-05-31 22:24+0000\n"
"Last-Translator: victor tejada yau <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n"
"X-Launchpad-Export-Date: 2010-06-01 03:44+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: crm
@@ -951,6 +951,8 @@ msgid ""
"Category related to the section.Subdivide the CRM cases independently or "
"section-wise."
msgstr ""
"Categoria relacionada a la seccion. subdividido independientemente los casos "
"CRM o modo-seccion"
#. module: crm
#: field:crm.case.rule,act_state:0
@@ -1340,7 +1342,7 @@ msgstr "Calcular la segmentación"
#. module: crm
#: view:crm.lead:0
msgid "Lead Email"
msgstr ""
msgstr "Dirigir correo electronico"
#. module: crm
#: model:ir.actions.act_window,name:crm.crm_segmentation-act
@@ -1563,6 +1565,8 @@ msgid ""
"Helps you to organise the jobs hiring process: evaluation, meetings, email "
"integration..."
msgstr ""
"Te ayuda a organizar los procesos para emplear trabajos: evaluacion, "
"reunion, integracion de correo electronico"
#. module: crm
#: view:crm.fundraising:0
@@ -1619,7 +1623,7 @@ msgstr "Convertido"
#: view:crm.lead:0
#: view:crm.opportunity:0
msgid "Reply to Last Email"
msgstr ""
msgstr "Responder el ultimo correo electronico"
#. module: crm
#: view:crm.segmentation:0
@@ -1629,7 +1633,7 @@ msgstr "Descripción de segmentación"
#. module: crm
#: help:crm.meeting,location:0
msgid "Gives Location of Meeting"
msgstr ""
msgstr "Dando la ubicacion de la reunion"
#. module: crm
#: view:crm.case:0
@@ -1644,7 +1648,7 @@ msgstr "Historial"
#. module: crm
#: model:ir.model,name:crm.model_crm_job
msgid "Job Cases"
msgstr ""
msgstr "casos de trabajos"
#. module: crm
#: view:crm.job:0
@@ -1654,7 +1658,7 @@ msgstr "Trabajos - selección de personal"
#. module: crm
#: field:crm.case.rule,regex_name:0
msgid "Regular Expression on Case Name"
msgstr ""
msgstr "Expresion regular en nombre de caso"
#. module: crm
#: field:crm.case,state:0
@@ -1719,7 +1723,7 @@ msgstr "¡No se ha encontrado Email en la dirección de su compañía!"
#. module: crm
#: view:crm.fundraising:0
msgid "Search Funds"
msgstr ""
msgstr "buscar fondos"
#. module: crm
#: view:crm.claim:0
@@ -1729,7 +1733,7 @@ msgstr "Tipo de reclamación"
#. module: crm
#: view:crm.case:0
msgid "Helpdesk Support Tree"
msgstr ""
msgstr "Arbol de soporte tecnico"
#. module: crm
#: view:res.partner.events:0
@@ -1760,12 +1764,14 @@ msgstr "Referencia"
#. module: crm
#: field:crm.meeting,exrule:0
msgid "Exception Rule"
msgstr ""
msgstr "Exception de regla"
#. module: crm
#: help:crm.case.rule,act_mail_to_partner:0
msgid "Check this if you want the rule to send an email to the partner."
msgstr ""
"Verifica esto si tu quieres enviar la norma en un correo electronico a el "
"socio"
#. module: crm
#: model:crm.case.category2,name:crm.category_lead2
@@ -1810,7 +1816,7 @@ msgstr "Importe de venta"
#: view:crm.lead:0
#: view:crm.opportunity:0
msgid "Add a CC"
msgstr ""
msgstr "Agregar un CC"
#. module: crm
#: selection:crm.segmentation.line,expr_operator:0
@@ -1838,7 +1844,7 @@ msgstr "Alarma"
#. module: crm
#: field:crm.case.rule,act_mail_to_watchers:0
msgid "Mail to watchers (CC)"
msgstr ""
msgstr "correo a los observadores (CC)"
#. module: crm
#: view:crm.fundraising:0
@@ -1903,7 +1909,7 @@ msgstr ""
#. module: crm
#: model:ir.actions.wizard,name:crm.wizard_crm_set_rrule
msgid "Set RRULE"
msgstr ""
msgstr "Establecer RRULE"
#. module: crm
#: model:crm.case.stage,name:crm.stage_oppor4
@@ -1981,7 +1987,7 @@ msgstr ""
#: code:addons/crm/crm.py:0
#, python-format
msgid "Email Fail!"
msgstr ""
msgstr "Correo electronico fallo"
#. module: crm
#: model:crm.case.categ,name:crm.categ_phone1
Regular → Executable
+2
View File
@@ -47,6 +47,8 @@
],
'demo_xml': ['hr_demo.xml',
'hr_department_demo.xml'],
'test': ['test/test_hr.yml'],
'installable': True,
'active': False,
'certificate': '0086710558965',
+14 -3
View File
@@ -18,7 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import os
from osv import fields, osv
import tools
from tools.translate import _
class hr_employee_category(osv.osv):
@@ -109,11 +112,19 @@ class hr_employee(osv.osv):
'category_id' : fields.many2one('hr.employee.category', 'Category'),
'child_ids': fields.one2many('hr.employee', 'parent_id','Subordinates'),
'resource_id': fields.many2one('resource.resource','Resource',ondelete='cascade'),
'coach_id':fields.many2one('res.users','Coach'),
'job_id':fields.many2one('hr.job', 'Job'),
'coach_id': fields.many2one('res.users','Coach'),
'job_id': fields.many2one('hr.job', 'Job'),
'photo': fields.binary('Photo')
}
def _get_photo(self, cr, uid, context=None):
return open(os.path.join(
tools.config['addons_path'], 'hr/image', 'photo.png'),
'rb') .read().encode('base64')
_defaults = {
'active' : lambda *a: True,
'active' : 1,
'photo': _get_photo,
}
def _check_recursion(self, cr, uid, ids):
+41 -28
View File
@@ -1,14 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem icon="terp-hr" id="menu_hr_root" name="Human Resources" sequence="6"/>
<menuitem id="menu_hr_human_resources" sequence="2" name="Human Resources" parent="menu_hr_root"/>
<menuitem
id="menu_hr_root"
icon="terp-hr"
name="Human Resources"
sequence="6"/>
<menuitem
id="menu_hr_configuration"
name="Configuration"
parent="hr.menu_hr_root"
sequence="50" />
<menuitem id="menu_view_employee_category_configuration_form" parent="hr.menu_hr_configuration" name="Employees" sequence="1"/>
<menuitem
id="menu_view_employee_category_configuration_form"
parent="hr.menu_hr_configuration"
name="Employees"
sequence="1"/>
<!--
==========
@@ -21,14 +28,35 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Employee">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="user_id"/>
<field name="active" groups="base.group_extended"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<group colspan="4" col="8">
<group colspan="6" col="6">
<field colspan="6" name="name" select="1"/>
<field name="user_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="active" groups="base.group_extended"/>
<newline/>
<field name="parent_id" />
<field name="coach_id" />
</group>
<group colspan="2" col="1">
<field name="photo" widget='image' nolabel="1"/>
</group>
</group>
<notebook colspan="4">
<notebook colspan="6">
<page string="Personal Information">
<group col="2" colspan="2">
<separator colspan="2" string="Social IDs"/>
<field name="ssnid"/>
<field name="sinid" groups="base.group_extended"/>
<field name="otherid" groups="base.group_extended"/>
</group>
<group col="2" colspan="2">
<separator string="Status" colspan="2"/>
<field name="gender"/>
<field name="marital" widget="selection"/>
<field name="country_id"/>
<field name="birthday"/>
</group>
<group col="2" colspan="2">
<separator string="Contact Information" colspan="2"/>
<field name="address_home_id" colspan="2"/>
@@ -38,29 +66,14 @@
<field name="work_email" widget="email" />
<field name="work_location"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Social IDs"/>
<field name="ssnid"/>
<field name="sinid" groups="base.group_extended"/>
<field name="otherid" groups="base.group_extended"/>
</group>
<group col="2" colspan="2">
<separator string="Position" colspan="2"/>
<field name="job_id" widget="selection"/>
<field name="department_id" widget="selection"/>
<separator string="Managers" colspan="2"/>
<field name="parent_id" select="1"/>
<field name="coach_id" select="1"/>
</group>
<group col="2" colspan="2">
<separator string="Status" colspan="2"/>
<field name="gender"/>
<field name="marital" widget="selection"/>
<field name="country_id"/>
<field name="birthday"/>
<field name="category_id" />
<!--<separator string="Managers" colspan="2"/>
<field name="parent_id" />
<field name="coach_id" />-->
</group>
</page>
<page string="Notes">
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

+68
View File
@@ -0,0 +1,68 @@
- |
In order to test the hr module in OpenERP, I will create new Employee , Department and Job Position.
-
|
First I create Department "R & D" in Department form.
-
!record {model: hr.department, id: hr_department_rd0}:
manager_id: base.user_root
name: 'R & D '
-
|
Now, I create a new employee “employee1”.
select "R & D" Department which I had created.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
marital: hr.hr_employee_marital_status_single
name: employee1
user_id: base.user_root
department_id: 'hr_department_rd0'
- |
In order to check the wizard “Employee Hierarchy” I will create new employee “employee2” and select "employee1" as
Manager.
-
!record {model: hr.employee, id: hr_employee_employee1}:
address_home_id: base.res_partner_address_3000
company_id: base.main_company
gender: male
name: employee2
user_id: base.user_demo
parent_id: 'hr_employee_employee0'
- |
Now I will open up form view of “employee1” and test the wizard “Employee Hierarchy” so it display the employee
hierarchy starting from “employee1”.
- |
Now I will create new Job Position. I will check successfull creation of new Job Position by adding the information.
-
!record {model: hr.job, id: hr_job_jea0}:
department_id: 'hr_department_rd0'
description: 'Position of Junier Application Engineer '
expected_employees: 5
name: 'JEA '
- |
I check that Employee form is in "Open" state.
-
!assert {model: hr.job, id: hr_job_jea0}:
- state == 'open'
- |
I create Employee for this position in this Job Position form.
-
!record {model: hr.job, id: hr_job_jea0}:
employee_ids:
- address_home_id: base.res_partner_address_1
name: employee3
department_id: 'hr_department_rd0'
gender: male
parent_id: 'hr_employee_employee0'
-
I check that "NO of Employee" is "1"
-
!assert {model: hr.job, id: hr_job_jea0}:
- no_of_employee != False
+1
View File
@@ -42,6 +42,7 @@
'hr_contract_view.xml'
],
'demo_xml': [],
'test': ['test/test_hr_contract.yml'],
'installable': True,
'active': False,
'certificate': '0046298028637',
+3 -4
View File
@@ -142,18 +142,17 @@
<group col='15' colspan='4'>
<field name="name"/>
<field name="employee_id"/>
<field name="department_id"/>
<field name="date_start"/>
<field name="date_end"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Department" icon="terp-project" domain="[]" context="{'group_by':'department_id'}"/>
<group expand="1" string="Group By..." colspan="4" col="20">
<filter string="Wage Type" icon="terp-project" domain="[]" context="{'group_by':'wage_type_id'}"/>
</group>
</search>
</field>
</record>
<record id="hr_contract_view_form" model="ir.ui.view">
<field name="name">hr.contract.view.form</field>
<field name="model">hr.contract</field>
@@ -0,0 +1,46 @@
- |
In order to test hr_contract module in OpenERP,
I will create contract for "Mark Johnson" employee.
- |
First I create Employee "Mark Johnson"
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
name: Mark Johnson
user_id: base.user_root
- |
Given that I have Contract wage period "monthly" and
specify "hours in period" is "176.00"
-
!record {model: hr.contract.wage.type.period, id: hr_contract_wage_type_period_monthly0}:
factor_days: 178.0
name: monthly
- |
Given that I have Contract wage type "Monthly Gross Wage".
select wage period "monthly" and type "Gross". with hour cost "1.9"
-
!record {model: hr.contract.wage.type, id: hr_contract_wage_type_monthlygrosswage0}:
factor_type: 1.9
name: Monthly Gross Wage
period_id: 'hr_contract_wage_type_period_monthly0'
type: gross
- |
Now I start by create contract for "Mark Johnson".
Select wage type "Monthly Gross Wage" and Wage period "monthly"
which I have given.
-
!record {model: hr.contract, id: hr_contract_contract0}:
advantages_gross: 0.0
employee_id: 'hr_employee_employee0'
advantages_net: 0.0
date_end: '2011-05-18'
date_start: '2010-05-18'
name: contract1
wage: 1.0
wage_type_id: hr_contract_wage_type_monthlygrosswage0
working_hours: resource.timesheet_group1
+1
View File
@@ -54,6 +54,7 @@
'demo_xml': ['hr_expense_demo.xml',
# 'hr.expense.expense.csv'
],
'test': ['test/test_hr_expense.yml'],
'installable': True,
'active': False,
'certificate': '0062479841789',
+4 -4
View File
@@ -120,9 +120,9 @@ class hr_expense_expense(osv.osv):
for l in exp.line_ids:
tax_id = []
if l.product_id:
acc = l.product_id.product_tmpl_id.property_account_expense.id
acc = l.product_id.product_tmpl_id.property_account_expense
if not acc:
acc = l.product_id.categ_id.property_account_expense_categ.id
acc = l.product_id.categ_id.property_account_expense_categ
tax_id = [x.id for x in l.product_id.supplier_taxes_id]
else:
acc = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
@@ -131,7 +131,7 @@ class hr_expense_expense(osv.osv):
lines.append((0, False, {
'name': l.name,
'account_id': acc,
'account_id': acc.id,
'price_unit': l.unit_amount,
'quantity': l.unit_quantity,
'uos_id': l.uom_id.id,
@@ -177,7 +177,7 @@ class product_product(osv.osv):
_inherit = "product.product"
_columns = {
'hr_expense_ok': fields.boolean('Can Constitute an Expense', help="Determines if the product can be visible in the list of product within a selection from an HR expense sheet line."),
}
}
product_product()
+37 -5
View File
@@ -1,6 +1,31 @@
<?xml version="1.0" ?>
<openerp>
<data noupdate="1">
<record id="product_product_expense_0" model="product.product">
<field name="list_price">1.0</field>
<field name="standard_price">1.0</field>
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="uom_po_id" ref="product.product_uom_unit"/>
<field name="type">service</field>
<field name="name">Air Ticket</field>
<field name="default_code">AT</field>
<field name="categ_id" ref="product.product_category_7"/>
<field name="hr_expense_ok" eval="True" />
</record>
<record id="product_product_expense_2" model="product.product">
<field name="list_price">1.0</field>
<field name="standard_price">1.0</field>
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="uom_po_id" ref="product.product_uom_unit"/>
<field name="type">service</field>
<field name="name">Hotel Accommodation</field>
<field name="default_code">HA0</field>
<field name="categ_id" ref="product.product_category_7"/>
<field name="hr_expense_ok" eval="True" />
</record>
<record id="hr_expense_expense_septemberexpenses0" model="hr.expense.expense">
<field name="currency_id" ref="base.EUR"/>
<field name="employee_id" ref="hr.employee1"/>
@@ -10,20 +35,25 @@
<field name="date">2010-05-03</field>
<field name="state">draft</field>
</record>
<record id="hr_expense_line_travelbycarcustomerseagatedouble0" model="hr.expense.line">
<field name="name">Travel by Car - Customer Seagate 2 - Double</field>
<field name="name">Travel by Air - Customer Seagate 2 - Double</field>
<field name="date_value">2010-05-03</field>
<field name="analytic_account" ref="account.analytic_thymbra"/>
<field name="product_id" ref="product_product_expense_0"/>
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'September Expenses')]"/>
<field eval="200.0" name="unit_amount"/>
<field eval="130.0" name="unit_quantity"/>
<field eval="700.0" name="unit_amount"/>
<field name="uom_id" ref="product.product_uom_unit"/>
<field eval="200.0" name="unit_quantity"/>
</record>
<record id="hr_expense_line_basicpcserverforseagate0" model="hr.expense.line">
<field name="name">Basic PC - Server for Seagate</field>
<field name="date_value">2010-05-03</field>
<field name="analytic_account" ref="account.analytic_seagate_p2"/>
<field name="product_id" ref="product.product_product_25"/>
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'September Expenses')]"/>
<field eval="500.0" name="unit_amount"/>
<field eval="35.5" name="unit_amount"/>
<field name="uom_id" ref="product.product_uom_unit"/>
<field eval="1.0" name="unit_quantity"/>
</record>
</data>
@@ -41,8 +71,10 @@
<field name="name">Hotel Expenses - Thymbra</field>
<field name="date_value">2010-05-03</field>
<field name="analytic_account" ref="account.analytic_thymbra"/>
<field name="product_id" ref="product_product_expense_2"/>
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'Hotel Expenses')]"/>
<field eval="2000.0" name="unit_amount"/>
<field eval="400.0" name="unit_amount"/>
<field name="uom_id" ref="product.product_uom_unit"/>
<field eval="5.0" name="unit_quantity"/>
</record>
+107
View File
@@ -0,0 +1,107 @@
- |
In order to test hr_expenses for OpenERP, I create expense for employee and manage employee's expenses.
- |
Creating unit of measure category "Working Time".
-
!record {model: product.uom.categ, id: product_uom_categ_workingtime0}:
name: Working Time.
- |
Given that I have employee "Marc John" and his address.
-
!record {model: hr.employee, id: hr.employee1}:
address_home_id: base.res_partner_address_1
address_id: base.main_address
- |
I create product unit of measure "Hour".
-
!record {model: product.uom, id: product_uom_hour0}:
category_id: 'product_uom_categ_workingtime0'
factor: 8.0
name: Hour
rounding: 0.01
- |
Creating a product "travel" and select uom "Hour" and category "Working Time".
-
!record {model: product.product, id: product_product_travel0}:
categ_id: product.product_category_services
cost_method: standard
hr_expense_ok: 1
list_price: 800.0
mes_type: fixed
name: Travel
procure_method: make_to_stock
standard_price: 700.0
supply_method: buy
type: product
uom_id: 'product_uom_hour0'
uom_po_id: 'product_uom_hour0'
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
- |
Now I create Expense "September Expenses" for Marc John.And select product "travel".
-
!record {model: hr.expense.expense, id: hr_expense_expense_september0}:
company_id: base.main_company
currency_id: base.EUR
date: '2010-05-05'
employee_id: hr.employee1
name: September Expenses
line_ids:
- date_value: '2010-05-27'
name: Travel
product_id: 'product_product_travel0'
sequence: 0.0
uom_id: product.product_uom_unit
unit_amount: 700.0
user_id: base.user_root
- |
I check that expenses on "draft" state.
-
!assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
- state == 'draft'
- |
I confirm this expenses by click on "Confirm" button.
-
!workflow {model: hr.expense.expense, action: confirm, ref: hr_expense_expense_september0}
- |
I check that state is "Waiting Confirmation".
-
!assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
- state == 'confirm'
- |
I accept this expense by click on "Accept" button.
-
!workflow {model: hr.expense.expense, action: validate, ref: hr_expense_expense_september0}
- |
I invoiced this expenses by click on "Invoice" button.
-
!workflow {model: hr.expense.expense, action: invoice, ref: hr_expense_expense_september0}
- |
I check that state is "Invoiced"
-
!assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
- state == 'invoiced'
- |
Now I check that Invoice is created for that expenses.
-
!python {model: hr.expense.expense}: |
exp = self.browse(cr, uid, [ref('hr_expense_expense_september0')])[0]
invoice_obj = self.pool.get('account.invoice')
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', exp.employee_id.address_id.partner_id.id)])
invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0]
for invoice in invoice_id.invoice_line:
product = invoice.product_id.id
for line in exp.line_ids:
product_exp = line.product_id.id
assert product == product_exp
assert exp.id == invoice_id.id
+2 -1
View File
@@ -61,7 +61,8 @@
'wizard/hr_holidays_summary_employees_view.xml',
#'process/hr_holidays_process.xml'
],
'demo_xml': [],
'demo_xml': ['hr_holidays_demo.xml',],
'test': ['test/test_hr_holiday.yml'],
'installable': True,
'active': False,
'certificate': '0086579209325',
+55 -31
View File
@@ -22,7 +22,7 @@
##############################################################################
import time
import datetime
import pooler
import netsvc
from osv import fields, osv
from tools.translate import _
@@ -31,7 +31,7 @@ class hr_holidays_status(osv.osv):
_name = "hr.holidays.status"
_description = "Leave Type"
def get_days_cat(self, cr, uid, ids, category_id, return_false, context={}):
def get_days_cat(self, cr, uid, ids, category_id, return_false, context=None):
res = {}
for record in self.browse(cr, uid, ids, context):
res[record.id] = {}
@@ -48,9 +48,9 @@ class hr_holidays_status(osv.osv):
res[record.id]['remaining_leaves'] = max_leaves - leaves_taken
return res
def get_days(self, cr, uid, ids, employee_id, return_false, context={}):
def get_days(self, cr, uid, ids, employee_id, return_false, context=None):
res = {}
for record in self.browse(cr, uid, ids, context):
for record in self.browse(cr, uid, ids, context=context):
res[record.id] = {}
max_leaves = leaves_taken = 0
if not return_false:
@@ -65,7 +65,7 @@ class hr_holidays_status(osv.osv):
res[record.id]['remaining_leaves'] = max_leaves - leaves_taken
return res
def _user_left_days(self, cr, uid, ids, name, args, context={}):
def _user_left_days(self, cr, uid, ids, name, args, context=None):
return_false = False
employee_id = False
res = {}
@@ -122,7 +122,7 @@ class hr_holidays(osv.osv):
'date_from' : fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}),
'user_id':fields.many2one('res.users', 'User', states={'draft':[('readonly',False)]}, select=True, readonly=True),
'date_to' : fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id' : fields.many2one("hr.holidays.status", "Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id' : fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'employee_id' : fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
'manager_id' : fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
'notes' : fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
@@ -134,7 +134,7 @@ class hr_holidays(osv.osv):
'parent_id': fields.many2one('hr.holidays', 'Parent'),
'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',),
'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True),
'category_id': fields.many2one('hr.employee.category', "Employee Category", help='Category Of employee'),
'category_id': fields.many2one('hr.employee.category', "Category", help='Category Of employee'),
'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Holiday Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category'),
'manager_id2': fields.many2one('hr.employee', 'Second Validator', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)')
}
@@ -148,6 +148,17 @@ class hr_holidays(osv.osv):
'holiday_type': 'employee'
}
def _create_resource_leave(self, cr, uid, vals, context=None):
'''This method will create entry in resource calendar leave object at the time of holidays validated '''
obj_res_leave = self.pool.get('resource.calendar.leaves')
return obj_res_leave.create(cr, uid, vals)
def _remove_resouce_leave(self, cr, uid, ids, context=None):
'''This method will create entry in resource calendar leave object at the time of holidays cancel/removed'''
obj_res_leave = self.pool.get('resource.calendar.leaves')
leave_ids = obj_res_leave.search(cr, uid, [('holiday_id', 'in', ids)])
return obj_res_leave.unlink(cr, uid, leave_ids)
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
@@ -204,9 +215,11 @@ class hr_holidays(osv.osv):
self.unlink(cr, uid, list_ids)
def _check_date(self, cr, uid, ids):
for rec in self.read(cr, uid, ids, ['number_of_days_temp','date_from','date_to']):
for rec in self.read(cr, uid, ids, ['number_of_days_temp','date_from','date_to', 'type']):
if rec['number_of_days_temp'] < 0:
return False
if rec['type']=='add':
continue
date_from = time.strptime(rec['date_from'], '%Y-%m-%d %H:%M:%S')
date_to = time.strptime(rec['date_to'], '%Y-%m-%d %H:%M:%S')
if date_from > date_to:
@@ -215,14 +228,11 @@ class hr_holidays(osv.osv):
_constraints = [(_check_date, 'Start date should not be larger than end date!\nNumber of Days should be greater than 1!', ['number_of_days_temp'])]
def unlink(self, cr, uid, ids, context={}):
leave_obj = self.pool.get('resource.calendar.leaves')
def unlink(self, cr, uid, ids, context=None):
self._update_user_holidays(cr, uid, ids)
leave_ids = leave_obj.search(cr, uid, [('holiday_id', 'in', ids)])
leave_obj.unlink(cr, uid, leave_ids)
self._remove_resouce_leave(cr, uid, ids, context=context)
return super(hr_holidays, self).unlink(cr, uid, ids, context)
def onchange_date_from(self, cr, uid, ids, date_to, date_from):
result = {}
if date_to and date_from:
@@ -251,14 +261,14 @@ class hr_holidays(osv.osv):
return {'warning': warning}
def set_to_draft(self, cr, uid, ids, *args):
wf_service = netsvc.LocalService("workflow")
self.write(cr, uid, ids, {
'state':'draft',
'manager_id': False,
'number_of_days': 0,
})
wf_service = netsvc.LocalService("workflow")
for holiday_id in ids:
wf_service.trg_create(uid, 'hr.holidays', holiday_id, cr)
for id in ids:
wf_service.trg_create(uid, 'hr.holidays', id, cr)
return True
def holidays_validate2(self, cr, uid, ids, *args):
@@ -273,10 +283,11 @@ class hr_holidays(osv.osv):
return True
def holidays_validate(self, cr, uid, ids, *args):
obj_emp = self.pool.get('hr.employee')
data_holiday = self.browse(cr, uid, ids)
self.check_holidays(cr, uid, ids)
vals = {'state':'validate'}
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
ids2 = obj_emp.search(cr, uid, [('user_id','=', uid)])
if ids2:
if data_holiday[0].state == 'validate1':
vals['manager_id2'] = ids2[0]
@@ -288,15 +299,28 @@ class hr_holidays(osv.osv):
for record in data_holiday:
if record.holiday_type=='employee' and record.type=='remove':
vals = {
'name':record.name,
'date_from':record.date_from,
'date_to':record.date_to,
'calendar_id':record.employee_id.calendar_id.id,
'company_id':record.employee_id.company_id.id,
'resource_id':record.employee_id.resource_id.id,
'holiday_id':record.id
'name': record.name,
'date_from': record.date_from,
'date_to': record.date_to,
'calendar_id': record.employee_id.calendar_id.id,
'company_id': record.employee_id.company_id.id,
'resource_id': record.employee_id.resource_id.id,
'holiday_id': record.id
}
self.pool.get('resource.calendar.leaves').create(cr, uid, vals)
self._create_resource_leave(cr, uid, vals)
elif record.holiday_type=='category' and record.type=='remove':
emp_ids = obj_emp.search(cr, uid, [('category_id', '=', record.category_id.id)])
for emp in obj_emp.browse(cr, uid, emp_ids):
vals = {
'name': record.name,
'date_from': record.date_from,
'date_to': record.date_to,
'calendar_id': emp.calendar_id.id,
'company_id': emp.company_id.id,
'resource_id': emp.resource_id.id,
'holiday_id':record.id
}
self._create_resource_leave(cr, uid, vals)
return True
def holidays_confirm(self, cr, uid, ids, *args):
@@ -339,20 +363,17 @@ class hr_holidays(osv.osv):
return True
def holidays_cancel(self, cr, uid, ids, *args):
leave_obj = self.pool.get('resource.calendar.leaves')
self._update_user_holidays(cr, uid, ids)
self.write(cr, uid, ids, {
'state':'cancel'
})
leave_ids = leave_obj.search(cr, uid, [('holiday_id', 'in', ids)])
leave_obj.unlink(cr, uid, leave_ids)
self._remove_resouce_leave(cr, uid, ids)
return True
def holidays_draft(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
'state':'draft'
})
self.pool.get('resource.calendar.leaves')
return True
def check_holidays(self, cr, uid, ids):
@@ -424,7 +445,9 @@ class hr_holidays(osv.osv):
}
case_id = self.pool.get('crm.meeting').create(cr,uid,vals)
self.write(cr, uid, ids, {'case_id':case_id})
return True
hr_holidays()
class resource_calendar_leaves(osv.osv):
@@ -432,7 +455,8 @@ class resource_calendar_leaves(osv.osv):
_description = "Leave Detail"
_columns = {
'holiday_id': fields.many2one("hr.holidays", "Holiday"),
}
}
resource_calendar_leaves()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+25 -17
View File
@@ -5,41 +5,49 @@
<!-- Casual leave -->
<record model="hr.holidays.status" id="holiday_status_cl">
<field name="name">Casual Leave</field>
<field name="color_name">red</field>
<field name="double_validation">True</field>
<field name="color_name">black</field>
</record>
<record model="hr.holidays.per.user" id="holiday_user_employee1_cl">
<field name="employee_id" ref="hr.employee1"/>
<field name="holiday_status" ref="holiday_status_cl"/>
<field name="max_leaves">12</field>
</record>
<record model="hr.holidays" id="hr_holidays_employee1_allocation_cl">
<field name="name">Casual Leave for Fabien Pinckaers</field>
<field name="holiday_status_id" ref="holiday_status_cl"/>
<field name="type">add</field>
<field name="number_of_days_temp">12</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record model="hr.holidays" id="hr_holidays_employee1_cl">
<field name="name">Going For Tour</field>
<field name="name">Trip with Family</field>
<field name="holiday_status_id" ref="holiday_status_cl"/>
<field name="date_from">2010-01-01 08:00</field>
<field name="date_to">2010-01-03 18:00</field>
<field name="date_from">2010-01-04 08:00</field>
<field name="date_to">2010-01-06 18:00</field>
<field name="type">remove</field>
<field name="number_of_days_temp">3</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<!-- Sick leave -->
<record model="hr.holidays.status" id="holiday_status_sl">
<field name="name">Sickness Leave</field>
<field name="color_name">black</field>
<field name="name">Sick Leave</field>
<field name="limit">True</field>
<field name="color_name">red</field>
</record>
<record model="hr.holidays.per.user" id="holiday_user_employee1_sl">
<field name="employee_id" ref="hr.employee1"/>
<field name="holiday_status" ref="holiday_status_sl"/>
<field name="max_leaves">6</field>
</record>
<record model="hr.holidays" id="hr_holidays_employee1_allocation_sl">
<field name="name">Sick Leave for Fabien Pinckaers</field>
<field name="holiday_status_id" ref="holiday_status_sl"/>
<field name="type">add</field>
<field name="number_of_days_temp">7</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record model="hr.holidays" id="hr_holidays_employee1_sl">
<field name="name">Sickness</field>
<field name="name">Doctor Appointment</field>
<field name="holiday_status_id" ref="holiday_status_sl"/>
<field name="date_from">2010-02-01 00:00</field>
<field name="date_to">2010-02-03 08:00</field>
<field name="type">remove</field>
<field name="number_of_days_temp">3</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
+98 -72
View File
@@ -13,9 +13,9 @@
<filter icon="terp-hr" domain="[('state','=','validate')]" string="Validated"
default="context.get('report', False)"/>
<separator orientation="vertical"/>
<field name="user_id" widget="selection" default="uid"/>
<field name="user_id" widget="selection"/>
<field name="department_id" widget="selection">
<filter icon="terp-hr"
<filter icon="terp-hr" help="My Department Holidays"
domain="[('department_id.manager_id','=',uid)]"
/>
</field>
@@ -43,26 +43,28 @@
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Leave Request">
<group col="6" colspan="4">
<group col="8" colspan="4">
<field name="name" select="1"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130"/>
<group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" select="1" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
<group attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" select="1" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
</group>
<notebook colspan="4">
<page string="General">
<group colspan="4" attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" select="1" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
<group colspan="4" attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" select="1" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
<field name="holiday_status_id" select="1" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<newline/>
<field name="department_id"/>
<field name="date_from" select="1" on_change="onchange_date_from(date_to, date_from)" required="1"/>
<field name="date_to" select="1" on_change="onchange_date_to(date_from, date_to)" required="1"/>
<field name="number_of_days_temp"/>
<newline/>
<field name="manager_id"/>
<field name="department_id"/>
<field name="notes" colspan="4"/>
<field name="manager_id2"/>
<separator string="Notes" colspan="4"/>
<field name="notes" nolabel="1" colspan="4"/>
<newline/>
<field name="state" select="1" colspan="2"/>
<group colspan="2">
@@ -74,52 +76,71 @@
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Extra Information">
<field name="manager_id2"/>
</page>
</notebook>
</form>
</field>
</record>
<!-- Holidays: Allocation Request -->
<record model="ir.ui.view" id="allocation_leave_new">
<field name="name">Allocation Request</field>
<record model="ir.ui.view" id="allocation_leave_new">
<field name="name">Allocation Request</field>
<field name="model">hr.holidays</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Allocation Request">
<group col="4" colspan="4">
<field name="name" select="1"/>
<field name="holiday_status_id" select="1"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type"/>
<group col="2" colspan="2">
<group attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" select="1" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
<group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" select="1" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
</group>
</group>
<notebook colspan="4">
<page string="General">
<field name="number_of_days_temp"/>
<field name="department_id"/>
<field name="manager_id"/>
<field name="manager_id2"/>
<separator string="Notes" colspan="4"/>
<field name="notes" nolabel="1" colspan="4" />
<newline/>
<field name="state" select="1" colspan="2"/>
<group colspan="2">
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Validate" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
<button string="Approve" name="second_validate" states="validate1" type="workflow" icon="gtk-apply"/>
<button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no"/>
<button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel"/>
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert"/>
</group>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_holiday_allocation_tree">
<field name="name">hr.holidays.allocation.tree</field>
<field name="model">hr.holidays</field>
<field name="type">form</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<form string="Allocation Request">
<field name="name" select="1"/>
<field name="holiday_status_id" select="1" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type"/>
<notebook colspan="4">
<page string="General">
<group colspan="4" attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" select="1" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
<group colspan="4" attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" select="1" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
<field name="department_id"/>
<field name="number_of_days_temp"/>
<field name="manager_id"/>
<field name="notes" colspan="4"/>
<newline/>
<field name="state" select="1" colspan="2"/>
<group colspan="2">
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Validate" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
<button string="Approve" name="second_validate" states="validate1" type="workflow" icon="gtk-apply"/>
<button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no"/>
<button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel"/>
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Extra Information">
<field name="manager_id2"/>
</page>
</notebook>
</form>
<tree string="Leaves"
colors="red:state == 'refuse';grey:state == 'cancel'">
<field name="employee_id"/>
<field name="department_id"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
<field name="name"/>
<field name="holiday_status_id"/>
<field name="manager_id" invisible="1"/>
<field name="type"/>
<field name="state"/>
</tree>
</field>
</record>
@@ -165,14 +186,15 @@
<field name="type">tree</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<tree string="Holidays Report">
<field name="employee_id" invisible="1"/>
<tree string="Leaves Summary">
<field name="employee_id"/>
<field name="department_id" invisible="1"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="name" invisible="1"/>
<field name="holiday_status_id" invisible="1"/>
<field name="holiday_status_id"/>
<field name="manager_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="state" invisible="1"/>
</tree>
@@ -194,6 +216,7 @@
<field name="date_to"/>
<field name="name"/>
<field name="holiday_status_id"/>
<field name="manager_id" invisible="1"/>
<field name="type"/>
<field name="state"/>
</tree>
@@ -230,6 +253,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="edit_holiday_new"/>
<field name="domain">[('type','=','remove')]</field>
<field name="context">{'search_default_user_id':uid}</field>
<field name="search_view_id" ref="view_hr_holidays_filter"/>
</record>
@@ -248,25 +272,26 @@
</record>
<menuitem
name="Leave Requests"
parent="menu_open_ask_holidays"
id="menu_open_ask_holidays_new"
action="open_ask_holidays"/>
<menuitem
name="Leave Requests"
parent="menu_open_ask_holidays"
id="menu_open_ask_holidays_new"
action="open_ask_holidays"/>
<record model="ir.actions.act_window" id="open_allocation_holidays">
<field name="name">Allocation Requests</field>
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="context">{'type':'add'}</field>
<field name="domain">[('type','=','add')]</field>
<field name="view_id" ref="allocation_leave_new" />
</record>
<record model="ir.actions.act_window" id="open_allocation_holidays">
<field name="name">Allocation Requests</field>
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="context">{'search_default_user_id':uid,'type':'add'}</field>
<field name="domain">[('type','=','add')]</field>
<field name="view_id" ref="allocation_leave_new"/>
<field name="search_view_id" ref="view_hr_holidays_filter"/>
</record>
<record model="ir.actions.act_window.view" id="action_open_allocation_holidays_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_holiday"/>
<field name="view_id" ref="view_holiday_allocation_tree"/>
<field name="act_window_id" ref="open_allocation_holidays"/>
</record>
@@ -288,8 +313,9 @@
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_holiday_simple" />
<field name="context">{'allocation_type':'company', 'report':True}</field>
<field name="view_id" eval="view_holiday_simple"/>
<field name="context">{'search_default_user_id':uid,'allocation_type':'company', 'report':True}</field>
<field name="search_view_id" ref="view_hr_holidays_filter"/>
</record>
<menuitem
@@ -329,7 +355,7 @@
</field>
</record>
<record id="open_view_holiday_status" model="ir.actions.act_window">
<field name="name">Leaves Type</field>
<field name="name">Leave Type</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.holidays.status</field>
<field name="view_type">form</field>
@@ -337,7 +363,7 @@
</record>
<menuitem sequence="9" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Leaves"/>
<menuitem name="Leaves Statuses"
<menuitem name="Leave Status"
action="open_view_holiday_status"
id="menu_open_view_holiday_status"
parent="hr.menu_open_view_attendance_reason_config"/>
@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
from osv import fields, osv
import tools
class available_holidays_report(osv.osv):
@@ -31,7 +31,8 @@ class available_holidays_report(osv.osv):
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'employee_id': fields.many2one ('hr.employee', 'Employee', readonly=True),
'employee_id': fields.many2one ('hr.employee', "Employee's Name", readonly=True),
'category_id' : fields.many2one('hr.employee.category', "Category's Name", readonly=True),
'holiday_status_id': fields.many2one('hr.holidays.status', 'Leave Type', readonly=True),
'max_leave': fields.float('Allocated Leaves', readonly=True),
'taken_leaves': fields.float('Taken Leaves', readonly=True),
@@ -50,6 +51,7 @@ class available_holidays_report(osv.osv):
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
h.employee_id as employee_id,
h.category_id as category_id,
h.user_id as user_id,
h.department_id,
h.state as state,
@@ -68,12 +70,10 @@ class available_holidays_report(osv.osv):
from hr_holidays h
left join hr_holidays_status s on (s.id = h.holiday_status_id)
where h.state='validate'
and h.employee_id is not null
and s.active <> 'f'
group by h.holiday_status_id, h.employee_id,
date_trunc('day',h.create_date),to_char(s.create_date, 'YYYY'),
to_char(s.create_date, 'MM'),to_char(s.create_date, 'YYYY-MM-DD'),h.user_id,
h.state,h.department_id
to_char(s.create_date, 'MM'), to_char(s.create_date, 'YYYY-MM-DD'), h.user_id,h.state, h.category_id, h.department_id
)""")
available_holidays_report()
@@ -10,8 +10,9 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Available Holidays">
<field name="employee_id" invisible="1"/>
<field name="holiday_status_id" invisible="1"/>
<field name="employee_id"/>
<field name="category_id"/>
<field name="holiday_status_id"/>
<field name="department_id" invisible="1"/>
<field name="max_leave" sum="Allocated Leaves"/>
<field name="taken_leaves" sum="Taken Leaves"/>
@@ -47,6 +48,13 @@
<field name="arch" type="xml">
<search string="Leaves">
<group>
<filter icon="terp-hr" string="Employee"
domain="[('category_id', '=', False)]"
help="Leaves by empolyee"/>
<filter icon="terp-hr" string="Category"
domain="[('employee_id', '=', False)]"
help="Leaves by category"/>
<separator orientation="vertical"/>
<filter icon="terp-hr" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this year"/>
@@ -60,6 +68,7 @@
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Leaves during last 7 days"/>
<separator orientation="vertical"/>
<field name="employee_id"/>
<field name="user_id" widget="selection">
<filter icon="terp-hr"
@@ -74,7 +83,6 @@
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Type" icon="terp-hr" context="{'group_by':'holiday_status_id'}"/>
@@ -95,7 +103,7 @@
<field name="res_model">available.holidays.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by':[], "search_default_user_id": uid}</field>
<field name="view_id" ref="view_hr_available_holidays_report_search"/>
</record>
@@ -18,13 +18,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import tools
from osv import fields,osv
class hr_holidays_report(osv.osv):
_name = "hr.holidays.report"
_description = "Leaves Statistics"
_description = "Leaves Statistics By Employee and category"
_auto = False
_rec_name = 'date'
_columns = {
@@ -34,10 +33,11 @@ class hr_holidays_report(osv.osv):
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'date_from' : fields.date('Start Date', readonly=True),
'date_to' : fields.date('End Date', readonly=True),
'number_of_days_temp': fields.float('#Days', readonly=True),
'employee_id' : fields.many2one('hr.employee', "Employee's Name",readonly=True),
'date_from' : fields.datetime('Start Date', readonly=True),
'date_to' : fields.datetime('End Date', readonly=True),
'number_of_days_temp': fields.float('Number of Days', readonly=True),
'employee_id' : fields.many2one('hr.employee', "Employee's Name", readonly=True),
'category_id' : fields.many2one('hr.employee.category', "Category's Name", readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'holiday_status_id' : fields.many2one("hr.holidays.status", "Leave Type",readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
@@ -60,6 +60,7 @@ class hr_holidays_report(osv.osv):
date_trunc('day',s.date_to) as date_to,
sum(s.number_of_days_temp) as number_of_days_temp,
s.employee_id,
s.category_id,
s.user_id as user_id,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
@@ -69,14 +70,14 @@ class hr_holidays_report(osv.osv):
s.state
from
hr_holidays s
where type='remove' and
s.employee_id is not null
where type='remove'
group by
s.create_date,s.state,s.date_from,s.date_to,
s.employee_id,s.user_id,s.holiday_status_id,
s.department_id
s.department_id, s.category_id
)
""")
hr_holidays_report()
class hr_holidays_remaining_leaves_user(osv.osv):
@@ -113,3 +114,5 @@ class hr_holidays_remaining_leaves_user(osv.osv):
""")
hr_holidays_remaining_leaves_user()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_holidays_report_tree" model="ir.ui.view">
<field name="name">hr.holidays.report.tree</field>
<field name="model">hr.holidays.report</field>
@@ -9,7 +9,8 @@
<field name="arch" type="xml">
<tree string="Leaves Statistics">
<field name="date" invisible="1"/>
<field name="employee_id" invisible="1"/>
<field name="employee_id"/>
<field name="category_id"/>
<field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
@@ -44,6 +45,13 @@
<field name="arch" type="xml">
<search string="Leaves">
<group>
<filter icon="terp-hr" string="Employee"
domain="[('category_id', '=', False)]"
help="Leaves by empolyee"/>
<filter icon="terp-hr" string="Category"
domain="[('employee_id', '=', False)]"
help="Leaves by category"/>
<separator orientation="vertical"/>
<filter icon="terp-hr" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this year"/>
@@ -70,16 +78,12 @@
domain="[('state','=','validate')]"
help = "Pending Leaves"/>
<separator orientation="vertical"/>
<field name="employee_id"/>
<field name="employee_id" widget="selection"/>
<field name="user_id" widget="selection">
<filter icon="terp-hr"
string="My Leaves"
domain="[('user_id','=',uid)]"/>
</field>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Employee" name="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Type" icon="terp-hr" context="{'group_by':'holiday_status_id'}"/>
@@ -91,35 +95,34 @@
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." groups="base.group_extended">
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr"
string="Refused"
string="Refused"
name="done"
domain="[('state','=','refuse')]"/>
domain="[('state','=','refuse')]"/>
<separator orientation="vertical"/>
<field name="date_from"/>
<separator orientation="vertical"/>
<field name="holiday_status_id" widget="selection"/>
<newline/>
<filter icon="terp-hr"
string="Cancelled"
domain="[('state','=','cancel')]"/>
string="Cancelled"
domain="[('state','=','cancel')]"/>
<separator orientation="vertical"/>
<field name="date_to"/>
<separator orientation="vertical"/>
<field name="department_id" widget="selection"/>
<field name="date_to"/>
<separator orientation="vertical"/>
<field name="department_id" widget="selection"/>
</group>
</search>
</field>
</record>
<record id="action_hr_holidays_report_all" model="ir.actions.act_window">
<field name="name">Leaves By Employee</field>
<field name="name">Leaves</field>
<field name="res_model">hr.holidays.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_month':1,'search_default_Employee':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{"search_default_user_id": uid, 'search_default_month':1,'search_default_Employee':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_hr_holidays_report_search"/>
</record>
@@ -150,6 +153,6 @@
</graph>
</field>
</record>
</data>
</openerp>
+112
View File
@@ -0,0 +1,112 @@
- |
In order to test the hr_holiday in OpenERP, I will Manage leaves for employee,
Leave requests.
- |
For that First I create new user "user1" to make leave request.
-
!record {model: res.users, id: res_users_user0}:
company_id: base.main_company
context_lang: en_US
groups_id:
- base.group_user
- hr.group_hr_manager
- hr.group_hr_user
login: user1
name: user1
password: user1
- |
Now, I create a new employee “Mark Johnshon” as Manager to validate employee leave.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
name: Mark Johnson
user_id: base.user_root
- |
create another employee "Brijesh Patel" as "user1" who make leave request.
-
!record {model: hr.employee, id: hr_employee_brijeshpatel0}:
address_home_id: base.res_partner_address_8
name: Brijesh Patel
parent_id: 'hr_employee_employee0'
user_id: 'res_users_user0'
- |
Given that I have Leave type for employee.
-
!record {model: hr.holidays.status, id: hr_holidays_status_fullleave0}:
color_name: red
name: Full Leave.
limit: 1
- |
After that I allocate leave request for employee "Brijesh Patel".
-
!record {model: hr.holidays, id: hr_holidays_allocateleaveforuser0}:
allocation_type: employee
employee_id: 'hr_employee_brijeshpatel0'
holiday_status_id: hr_holidays_status_fullleave0
name: Allocate leave for user1
number_of_days_temp: 12.0
date_from: '05/20/2010 13:59:00'
date_to: '05/22/2010 13:59:00'
type: add
- |
I click on "Confirm" button to confirm allocate leave for employee.
-
!workflow {model: hr.holidays, action: confirm, ref: hr_holidays_allocateleaveforuser0}
- |
I click on "Validate" button to validate leave for employee.
-
!workflow {model: hr.holidays, action: validate, ref: hr_holidays_allocateleaveforuser0}
- |
Now employee "Brijesh Patel" want to leave. so, I connect as user1 which is username of this employee and want to make leave request.
-
!record {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
allocation_type: employee
date_from: '2010-05-20 11:48:00'
date_to: '2010-05-21 11:48:00'
employee_id: 'hr_employee_brijeshpatel0'
holiday_status_id: 'hr_holidays_status_fullleave0'
name: I want to leave for go to hospital
notes: I want to leave for go to hospital. so please accept my leave.
number_of_days_temp: 2.0
type: remove
user_id: 'res_users_user0'
- |
I check that Leave Request is on "Draft" state.
-
!assert {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
- state == 'draft'
- |
Now I confirm my leave Request by click on "Confirm" button.
-
!workflow {model: hr.holidays, action: confirm, ref: hr_holidays_iwanttoleaveforgotohospital0}
- |
Now I connect as Admin user and Open Leave request of "Brijesh Patel".
and "validate" it by click on "validate" button.
-
!workflow {model: hr.holidays, action: validate, ref: hr_holidays_iwanttoleaveforgotohospital0}
- |
I check that "Leave Manager" field is automaticly filled by the user who validate the leave'.
-
!python {model: hr.holidays}: |
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
obj = self.browse(cr, uid, ref('hr_holidays_iwanttoleaveforgotohospital0'))
assert ids2[0] == obj.manager_id.id
- |
I check that Leave request state is "Validated".
-
!assert {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
- state == "validate"
- |
I can also see Summary of Employee's holiday by using 'Print Summary of Employee's Holidays'.
This will allow you to choose if you want to print either the Confirmed & Validated holidays or only the Validated ones.
@@ -18,7 +18,7 @@
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-yes"/>
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
</group>
</form>
</field>
+2 -1
View File
@@ -49,8 +49,9 @@ system to store and search in your CV base.
'hr_recruitment_data.xml'
],
'demo_xml': [
'hr_recruitment_demo.xml'
'hr_recruitment_demo.xml',
],
'test':['test/test_hr_recruitment.yml'],
'installable': True,
'active': False,
}
@@ -79,7 +79,7 @@
<group colspan="3" col="6">
<field name="partner_name"/>
<field name="job_id" on_change="onchange_job(job_id)"/>
<button string="Schedule a Phone Call" name="223" icon="gtk-redo" type="action"/>
<button string="Schedule a Phone Call" name="%(action_hr_recruitment_phonecall)d" icon="gtk-redo" type="action"/>
</group>
<newline/>
<group colspan="3" col="6">
@@ -232,7 +232,7 @@
help="My Department"/>
</field>
<newline/>
<group expand="1" string="Group By...">
<group expand="0" string="Group By..." colspan="11" col="20">
<filter string="Department" icon="terp-project" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Responsible" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
@@ -0,0 +1,115 @@
- |
In order to test hr_recruitment module for OpenERP object, I create applicants form and Manages job positions and the recruitement process.
- |
I create job possition for employee to manage job position.
-
|
First I create Department "R & D" in Department form for which I make recruitment.
-
!record {model: hr.department, id: hr_department_rd0}:
manager_id: base.user_root
name: 'R & D '
- |
Now I will create new Job Position. I will check successfull creation of new Job Position by adding the information.
-
!record {model: hr.job, id: hr_job_jea0}:
department_id: 'hr_department_rd0'
description: 'Position of Junier Application Engineer '
expected_employees: 5
name: 'JEA '
- |
Given that I have stage "Initial Jobs Demand".
-
!record {model: hr.recruitment.stage, id: hr_recrutiment_stage_first0}:
name: 'Initial Jobs Demand'
sequence: 1
- |
I create applicants for "Fresher" and specify job information for that applicant.
-
!record {model: hr.applicant, id: hr_applicant_fresher0}:
availability: 0.0
department_id: hr.dep_it
name: Fresher
partner_address_id: base.res_partner_address_tang
partner_id: base.res_partner_asus
partner_name: Jose
partner_phone: '999666735'
response: 0.0
salary_expected: 0.0
salary_proposed: 0.0
stage_id: crm.stage_lead3
type_id: hr_recruitment.type_job2
stage_id: hr_recrutiment_stage_first0
- |
I check that applicant is on "draft" state.
-
!assert {model: hr.applicant, id: hr_applicant_fresher0}:
- state == 'draft'
- |
I start progress by click on "In Progress" button.
-
!python {model: hr.applicant}: |
self.case_open(cr, uid, [ref("hr_applicant_fresher0")], {"active_ids": [ref("hr_recruitment.menu_crm_case_categ0_act_job")],
})
- |
Given that I have case category "Employee".
-
!record {model: crm.case.categ, id: crm_case_categ_employee0}:
name: 'Employee'
- |
I make phonecall for this applicant by click on "Schedule a Phone Call" button.
-
!record {model: hr.recruitment.job2phonecall, id: hr_recruitment_forinterview0}:
user_id: base.user_root
deadline: '05/28/2010 11:51:00'
note: 'For interview.'
category_id: 'crm_case_categ_employee0'
- |
I click on "Schedule phonecall" button of this wizard.
-
!python {model: hr.recruitment.job2phonecall}: |
self.make_phonecall(cr, uid, [ref('hr_recruitment_forinterview0')], {'active_ids': [ref('hr_applicant_fresher0')]})
- |
I schedule meeting for interview of this applicant by click on "Schdule Meeting" button.
-
!python {model: hr.applicant}: |
self.action_makeMeeting(cr, uid, [ref('hr_recruitment_forinterview0')])
- |
I can see that Meeting's calendar view is shown.
then I click on the date on which I want schedule meeting.
I fill proper data for that meeting and save it.
-
!record {model: crm.meeting, id: crm_meeting_fresher0}:
alarm_id: base_calendar.alarm1
count: 0.0
date: '2010-05-27 00:00:00'
date_deadline: '2010-05-27 08:00:00'
day: 0.0
duration: 8.0
name: Fresher
opportunity_id: crm.crm_case_construstazunits0
partner_address_id: base.res_partner_address_tang
partner_id: base.res_partner_asus
recurrent_uid: 0.0
rrule_type: none
state: open
user_id: base.user_root
- |
After Meeting of this applicant , I hired employee by click on "Hired" button of this form.
-
!python {model: hr.applicant}: |
self.case_close(cr, uid, [ref('hr_applicant_fresher0')])
- |
I check that applicant state is "done".
-
!assert {model: hr.applicant, id: hr_applicant_fresher0}:
- state == 'done'
+20 -15
View File
@@ -43,16 +43,16 @@ class hr_analytic_timesheet(osv.osv):
_inherits = {'account.analytic.line': 'line_id'}
_order = "id desc"
_columns = {
'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade'),
'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade'),
'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner Id',relation='account.analytic.account',store=True),
}
def unlink(self, cr, uid, ids, context={}):
toremove = {}
for obj in self.browse(cr, uid, ids, context):
for obj in self.browse(cr, uid, ids, context=context):
toremove[obj.line_id.id] = True
self.pool.get('account.analytic.line').unlink(cr, uid, toremove.keys(), context)
return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context)
self.pool.get('account.analytic.line').unlink(cr, uid, toremove.keys(), context=context)
return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context=context)
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}):
@@ -60,30 +60,34 @@ class hr_analytic_timesheet(osv.osv):
# if prod_id and unit_amount:
if prod_id:
# find company
company_id=self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context)
res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount,company_id,unit, context)
company_id = self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context)
res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, context=context)
return res
def _getEmployeeProduct(self, cr, uid, context):
def _getEmployeeProduct(self, cr, uid, context={}):
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
if emp_id:
emp=emp_obj.browse(cr, uid, emp_id[0], context)
emp=emp_obj.browse(cr, uid, emp_id[0], context=context)
if emp.product_id:
return emp.product_id.id
return False
def _getEmployeeUnit(self, cr, uid, context):
def _getEmployeeUnit(self, cr, uid, context=None):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
if emp_id:
emp=emp_obj.browse(cr, uid, emp_id[0], context)
emp=emp_obj.browse(cr, uid, emp_id[0], context=context)
if emp.product_id:
return emp.product_id.uom_id.id
return False
def _getGeneralAccount(self, cr, uid, context):
def _getGeneralAccount(self, cr, uid, context=None):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
if emp_id:
emp = emp_obj.browse(cr, uid, emp_id[0], context=context)
@@ -95,8 +99,10 @@ class hr_analytic_timesheet(osv.osv):
return a
return False
def _getAnalyticJournal(self, cr, uid, context):
def _getAnalyticJournal(self, cr, uid, context=None):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
if emp_id:
emp = emp_obj.browse(cr, uid, emp_id[0], context=context)
@@ -110,7 +116,7 @@ class hr_analytic_timesheet(osv.osv):
'product_id' : _getEmployeeProduct,
'general_account_id' : _getGeneralAccount,
'journal_id' : _getAnalyticJournal,
'date' : lambda self,cr,uid,ctx: ctx.get('date', time.strftime('%Y-%m-%d')),
'date' : lambda self, cr, uid, ctx : ctx.get('date', time.strftime('%Y-%m-%d')),
'user_id' : lambda obj, cr, uid, ctx : ctx.get('user_id', uid),
}
def on_change_account_id(self, cr, uid, ids, account_id):
@@ -147,5 +153,4 @@ class hr_analytic_timesheet(osv.osv):
}}
hr_analytic_timesheet()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -81,12 +81,23 @@
<filter string="Year" icon="terp-hr" context="{'group_by':'name'}"/>
</group>
<newline/>
<group expand="0" string="Extended filters..." groups="base.group_extended">
<field name="date"/>
<separator orientation="vertical"/>
<field name="invoice_id" widget="selection"/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Account" icon="terp-hr" context="{'group_by':'account_id'}"/>
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
<filter string="Invoice" icon="terp-hr" context="{'group_by':'invoice_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'name'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<field name="date"/>
<separator orientation="vertical"/>
<field name="invoice_id" widget="selection"/>
</group>
</search>
</field>
</record>
@@ -443,11 +454,10 @@
<field name="arch" type="xml">
<search string="Search Timesheet Lines">
<group col='15' colspan='4'>
<field name="date"/>
<filter icon="terp-project" string="Current" default="1" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical"/>
<field name="user_id" widget="selection"/>
<field name="product_id" widget="selection"/>
<field name="analytic_account_id" widget="selection"/>
<field name="general_account_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By...">
@@ -482,22 +492,37 @@
<record model="ir.actions.act_window" id="action_random_timesheet_lines_board">
<field name="type">ir.actions.act_window</field>
<field name="name">Timesheet Lines</field>
<field name="name">Working Hours</field>
<field name="res_model">random.timesheet.lines</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_user_id':uid }</field>
<field name="view_id" ref="view_random_timesheet_lines_tree"/>
<field name="search_view_id" ref="view_random_timesheet_lines_search"/>
</record>
<!--Time Tracking menu in project Management-->
<menuitem icon="terp-project" id="base.menu_main_pm" name="Project Management" sequence="1"/>
<menuitem
id="base.menu_project_management_time_tracking"
name="Time Tracking"
parent="base.menu_main_pm" sequence="3"/>
<menuitem action="action_random_timesheet_lines_board" id="menu_project_management_timesheet_lines_board" parent="base.menu_project_management_time_tracking" sequence="7"/>
icon="terp-project"
id="base.menu_main_pm"
name="Project Management"
sequence="1"/>
<menuitem
id="base.menu_project_management_time_tracking"
name="Time Tracking"
parent="base.menu_main_pm"
sequence="3"/>
<menuitem
action="action_random_timesheet_lines_board"
id="menu_project_management_timesheet_lines_board"
parent="base.menu_project_management_time_tracking"
sequence="7"/>
<!--<menuitem action="action_random_timesheet_lines_board" id="menu_hr_action_random_timesheet_lines_board"
parent="hr_attendance.menu_hr_time_tracking" groups="hr.group_hr_manager"/>-->
<menuitem action="action_random_timesheet_lines_board" id="menu_hr_action_random_timesheet_lines_board" name="Timesheets Lines"
parent="hr_attendance.menu_hr_time_tracking" groups="hr.group_hr_manager"/>
<menuitem
action="action_random_timesheet_lines_board"
id="menu_hr_action_random_timesheet_lines_board"
name="Working Hours"
parent="hr_attendance.menu_hr_time_tracking"
groups="hr.group_hr_manager"/>
</data>
</openerp>
+45 -26
View File
@@ -27,14 +27,13 @@ import netsvc
from mx import DateTime
from tools.translate import _
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context={}, values={}):
res = {}
for id in ids:
res[id] = []
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context)
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)
res6 = {}
for r in res5:
res6[r['id']] = (r['date_current'], r['user_id'][0])
@@ -71,7 +70,7 @@ class one2many_mod(fields.one2many):
for id in ids:
res[id] = []
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context)
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)
res6 = {}
for r in res5:
res6[r['id']] = (r['date_current'], r['user_id'][0])
@@ -111,8 +110,10 @@ class hr_timesheet_sheet(osv.osv):
res[record[0]]['total_difference_day'] = record[3]
return res
def _total(self, cr, uid, ids, name, args, context):
def _total(self, cr, uid, ids, name, args, context=None):
res = {}
if context is None:
context = {}
cr.execute('SELECT s.id, COALESCE(SUM(d.total_attendance),0), COALESCE(SUM(d.total_timesheet),0), COALESCE(SUM(d.total_difference),0) \
FROM hr_timesheet_sheet_sheet s \
LEFT JOIN hr_timesheet_sheet_sheet_day d \
@@ -125,13 +126,15 @@ class hr_timesheet_sheet(osv.osv):
res[record[0]]['total_difference'] = record[3]
return res
def _state_attendance(self, cr, uid, ids, name, args, context):
def _state_attendance(self, cr, uid, ids, name, args, context=None):
emp_obj = self.pool.get('hr.employee')
result = {}
link_emp = {}
emp_ids = []
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context):
for sheet in self.browse(cr, uid, ids, context=context):
result[sheet.id] = 'none'
emp_ids2 = emp_obj.search(cr, uid,
[('user_id', '=', sheet.user_id.id)])
@@ -147,8 +150,10 @@ class hr_timesheet_sheet(osv.osv):
def copy(self, cr, uid, ids, *args, **argv):
raise osv.except_osv(_('Error !'), _('You can not duplicate a timesheet !'))
def button_confirm(self, cr, uid, ids, context):
for sheet in self.browse(cr, uid, ids, context):
def button_confirm(self, cr, uid, ids, context=None):
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context=context):
di = sheet.user_id.company_id.timesheet_max_difference
if (abs(sheet.total_difference) < di) or not di:
wf_service = netsvc.LocalService("workflow")
@@ -157,8 +162,10 @@ class hr_timesheet_sheet(osv.osv):
raise osv.except_osv(_('Warning !'), _('Please verify that the total difference of the sheet is lower than %.2f !') %(di,))
return True
def date_today(self, cr, uid, ids, context):
for sheet in self.browse(cr, uid, ids, context):
def date_today(self, cr, uid, ids, context=None):
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context=context):
if DateTime.now() <= DateTime.strptime(sheet.date_from, '%Y-%m-%d'):
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,})
elif DateTime.now() >= DateTime.strptime(sheet.date_to, '%Y-%m-%d'):
@@ -167,8 +174,10 @@ class hr_timesheet_sheet(osv.osv):
self.write(cr, uid, [sheet.id], {'date_current': time.strftime('%Y-%m-%d')})
return True
def date_previous(self, cr, uid, ids, context):
for sheet in self.browse(cr, uid, ids, context):
def date_previous(self, cr, uid, ids, context=None):
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context=context):
if DateTime.strptime(sheet.date_current, '%Y-%m-%d') <= DateTime.strptime(sheet.date_from, '%Y-%m-%d'):
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,})
else:
@@ -177,8 +186,10 @@ class hr_timesheet_sheet(osv.osv):
})
return True
def date_next(self, cr, uid, ids, context):
for sheet in self.browse(cr, uid, ids, context):
def date_next(self, cr, uid, ids, context=None):
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context=context):
if DateTime.strptime(sheet.date_current, '%Y-%m-%d') >= DateTime.strptime(sheet.date_to, '%Y-%m-%d'):
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,})
else:
@@ -187,27 +198,33 @@ class hr_timesheet_sheet(osv.osv):
})
return True
def button_dummy(self, cr, uid, ids, context):
for sheet in self.browse(cr, uid, ids, context):
def button_dummy(self, cr, uid, ids, context=None):
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context=context):
if DateTime.strptime(sheet.date_current, '%Y-%m-%d') <= DateTime.strptime(sheet.date_from, '%Y-%m-%d'):
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,})
elif DateTime.strptime(sheet.date_current, '%Y-%m-%d') >= DateTime.strptime(sheet.date_to, '%Y-%m-%d'):
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,})
return True
def sign_in(self, cr, uid, ids, context):
def sign_in(self, cr, uid, ids, context=None):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
if not self.browse(cr, uid, ids, context)[0].date_current == time.strftime('%Y-%m-%d'):
raise osv.except_osv(_('Error !'), _('You can not sign in from an other date than today'))
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
context['sheet_id']=ids[0]
success = emp_obj.attendance_action_change(cr, uid, emp_id, type='sign_in', context=context,)
return True
def sign_out(self, cr, uid, ids, context):
def sign_out(self, cr, uid, ids, context=None):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
if not self.browse(cr, uid, ids, context)[0].date_current == time.strftime('%Y-%m-%d'):
raise osv.except_osv(_('Error !'), _('You can not sign out from an other date than today'))
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
context['sheet_id']=ids[0]
success = emp_obj.attendance_action_change(cr, uid, emp_id, type='sign_out', context=context,)
@@ -250,7 +267,7 @@ class hr_timesheet_sheet(osv.osv):
}
def _default_date_from(self,cr, uid, context={}):
user = self.pool.get('res.users').browse(cr, uid, uid, context)
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
r = user.company_id and user.company_id.timesheet_range or 'month'
if r=='month':
return time.strftime('%Y-%m-01')
@@ -261,7 +278,7 @@ class hr_timesheet_sheet(osv.osv):
return time.strftime('%Y-%m-%d')
def _default_date_to(self,cr, uid, context={}):
user = self.pool.get('res.users').browse(cr, uid, uid, context)
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
r = user.company_id and user.company_id.timesheet_range or 'month'
if r=='month':
return (DateTime.now() + DateTime.RelativeDateTime(months=+1,day=1,days=-1)).strftime('%Y-%m-%d')
@@ -276,8 +293,8 @@ class hr_timesheet_sheet(osv.osv):
'date_from' : _default_date_from,
'date_current' : lambda *a: time.strftime('%Y-%m-%d'),
'date_to' : _default_date_to,
'state': lambda *a: 'new',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c)
'state': 'new',
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c)
}
def _sheet_date(self, cr, uid, ids):
@@ -301,7 +318,7 @@ class hr_timesheet_sheet(osv.osv):
_constraints = [
(_sheet_date, 'You can not have 2 timesheets that overlaps !\nPlease use the menu \'My Current Timesheet\' to avoid this problem.', ['date_from','date_to']),
(_date_current_check, 'You must select a Current date wich is in the timesheet dates !', ['date_current']),
(_date_current_check, 'You must select a Current date which is in the timesheet dates !', ['date_current']),
]
def action_set_to_draft(self, cr, uid, ids, *args):
@@ -319,6 +336,8 @@ class hr_timesheet_sheet(osv.osv):
context, load='_classic_write')]
def unlink(self, cr, uid, ids, context=None):
if context is None:
context = {}
sheets = self.read(cr, uid, ids, ['state','total_attendance'])
for sheet in sheets:
if sheet['state'] in ('confirm', 'done'):
@@ -101,7 +101,7 @@
<field name="date_from"/>
<field name="date_to"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<field name="department_id"/>
<field name="department_id" groups="base.group_extended"/>
<notebook colspan="4">
<page string="Daily View">
<group col="6" colspan="4">
@@ -192,7 +192,6 @@
<field name="arch" type="xml">
<search string="Search Timesheet">
<group col="10" colspan="4">
<separator orientation="vertical"/>
<filter icon="terp-crm" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
<filter icon="terp-crm" string="To Validate" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
<separator orientation="vertical"/>
@@ -219,7 +218,7 @@
<field name="res_model">hr_timesheet_sheet.sheet</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="context">{'search_default_user_id':uid}</field>
<field name="context">{'search_default_my_timesheet':1, 'search_default_user_id':uid }</field>
<field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
</record>
+36 -36
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-11-09 17:47+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-06-01 01:00+0000\n"
"Last-Translator: Pandu Pradana <p4ndupr4d4n4@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:09+0000\n"
"X-Launchpad-Export-Date: 2010-06-01 03:44+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: idea
@@ -27,7 +27,7 @@ msgstr ""
#: selection:idea.vote,score:0
#: selection:idea.vote.stat,score:0
msgid "Very Good"
msgstr ""
msgstr "Sangat Baik"
#. module: idea
#: view:idea.idea:0
@@ -39,7 +39,7 @@ msgstr ""
#: model:ir.actions.act_window,name:idea.action_idea_idea_my_idea
#: model:ir.ui.menu,name:idea.menu_idea_idea_my_idea
msgid "My Ideas"
msgstr ""
msgstr "Ide Saya"
#. module: idea
#: constraint:ir.actions.act_window:0
@@ -51,13 +51,13 @@ msgstr ""
#: selection:idea.vote,score:0
#: selection:idea.vote.stat,score:0
msgid "Not Voted"
msgstr ""
msgstr "Tidak Memberikan Suara"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_idea_open_my
#: model:ir.ui.menu,name:idea.menu_idea_idea_open_my
msgid "My Open Ideas"
msgstr ""
msgstr "Ide Terbuka Saya"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_idea
@@ -69,18 +69,18 @@ msgstr ""
#. module: idea
#: field:idea.category,child_ids:0
msgid "Child Categories"
msgstr ""
msgstr "Kategori Anak"
#. module: idea
#: view:idea.idea:0
msgid "New Idea"
msgstr ""
msgstr "Ide Baru"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_category_tree
#: model:ir.ui.menu,name:idea.menu_idea_category_tree
msgid "Ideas by Categories"
msgstr ""
msgstr "Ide berdasar Kategori"
#. module: idea
#: field:idea.vote,score:0
@@ -101,7 +101,7 @@ msgstr ""
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_vote_stat
msgid "Statistics on Votes"
msgstr ""
msgstr "Statistik pada Voting"
#. module: idea
#: constraint:ir.model:0
@@ -112,17 +112,17 @@ msgstr ""
#. module: idea
#: model:ir.model,name:idea.model_idea_category
msgid "Category for an idea"
msgstr ""
msgstr "Kategori untuk sebuah ide"
#. module: idea
#: model:ir.module.module,shortdesc:idea.module_meta_information
msgid "Idea Manager"
msgstr ""
msgstr "Manager Ide"
#. module: idea
#: model:ir.ui.menu,name:idea.menu_idea_vote_stat
msgid "Vote Statistics"
msgstr ""
msgstr "Statistik Voting"
#. module: idea
#: selection:idea.idea,state:0
@@ -161,12 +161,12 @@ msgstr "Pelaporan"
#. module: idea
#: model:ir.model,name:idea.model_idea_vote_stat
msgid "Idea Votes Statistics"
msgstr ""
msgstr "Statistik Voting Ide"
#. module: idea
#: model:ir.model,name:idea.model_idea_vote
msgid "idea.vote"
msgstr ""
msgstr "ide.voting"
#. module: idea
#: field:idea.comment,user_id:0
@@ -177,7 +177,7 @@ msgstr ""
#. module: idea
#: view:idea.idea:0
msgid "Your comment"
msgstr ""
msgstr "Komentar anda"
#. module: idea
#: model:ir.ui.menu,name:idea.menu_config
@@ -193,12 +193,12 @@ msgstr ""
#. module: idea
#: view:idea.stat:0
msgid "stat"
msgstr ""
msgstr "stat"
#. module: idea
#: field:idea.idea,my_vote:0
msgid "My Vote"
msgstr ""
msgstr "Voting Saya"
#. module: idea
#: constraint:ir.ui.view:0
@@ -208,7 +208,7 @@ msgstr ""
#. module: idea
#: view:idea.vote:0
msgid "Votes"
msgstr ""
msgstr "Memilih"
#. module: idea
#: model:ir.module.module,description:idea.module_meta_information
@@ -230,28 +230,28 @@ msgstr ""
#. module: idea
#: field:idea.idea,count_votes:0
msgid "Count of votes"
msgstr ""
msgstr "Jumlah voting"
#. module: idea
#: field:idea.vote.stat,nbr:0
msgid "Number of Votes"
msgstr ""
msgstr "Nomer Voting"
#. module: idea
#: model:ir.model,name:idea.model_idea_idea
msgid "idea.idea"
msgstr ""
msgstr "ide.ide"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_idea_draft_my
#: model:ir.ui.menu,name:idea.menu_idea_idea_draft_my
msgid "My Draft Ideas"
msgstr ""
msgstr "Draf ide saya"
#. module: idea
#: field:idea.idea,vote_ids:0
msgid "Vote"
msgstr ""
msgstr "Pemilihan"
#. module: idea
#: selection:idea.idea,my_vote:0
@@ -264,7 +264,7 @@ msgstr ""
#: view:idea.idea:0
#: model:ir.ui.menu,name:idea.menu_idea_idea
msgid "All Ideas"
msgstr ""
msgstr "Semua Ide"
#. module: idea
#: view:idea.comment:0
@@ -277,17 +277,17 @@ msgstr ""
#. module: idea
#: field:idea.idea,count_comments:0
msgid "Count of comments"
msgstr ""
msgstr "Jumlah komentar"
#. module: idea
#: field:idea.idea,title:0
msgid "Idea Summary"
msgstr ""
msgstr "Ringkasan Ide"
#. module: idea
#: view:idea.category:0
msgid "Category of ideas"
msgstr ""
msgstr "Kategori berdasarkan ide"
#. module: idea
#: field:idea.category,summary:0
@@ -299,7 +299,7 @@ msgstr ""
#: model:ir.actions.act_window,name:idea.action_idea_idea_open
#: model:ir.ui.menu,name:idea.menu_idea_idea_open
msgid "Open Ideas"
msgstr ""
msgstr "Ide Terbuka"
#. module: idea
#: view:idea.idea:0
@@ -317,7 +317,7 @@ msgstr ""
#. module: idea
#: field:idea.category,parent_id:0
msgid "Parent Categories"
msgstr ""
msgstr "Kategori Induk"
#. module: idea
#: field:idea.idea,user_id:0
@@ -335,14 +335,14 @@ msgstr ""
#: field:idea.vote,idea_id:0
#: field:idea.vote.stat,idea_id:0
msgid "Idea"
msgstr ""
msgstr "Ide"
#. module: idea
#: selection:idea.idea,my_vote:0
#: selection:idea.vote,score:0
#: selection:idea.vote.stat,score:0
msgid "Very Bad"
msgstr ""
msgstr "Sangat Buruk"
#. module: idea
#: selection:idea.idea,state:0
@@ -352,7 +352,7 @@ msgstr ""
#. module: idea
#: model:ir.ui.menu,name:idea.menu_idea_vote
msgid "All Votes"
msgstr ""
msgstr "Semua Pemilihan"
#. module: idea
#: view:idea.idea:0
@@ -367,7 +367,7 @@ msgstr ""
#. module: idea
#: field:idea.idea,vote_avg:0
msgid "Average Score"
msgstr ""
msgstr "Skor Rata-rata"
#. module: idea
#: view:idea.idea:0
@@ -377,4 +377,4 @@ msgstr ""
#. module: idea
#: help:idea.idea,description:0
msgid "Content of the idea"
msgstr ""
msgstr "Isi ide"

Some files were not shown because too many files have changed in this diff Show More