[MERGE] lp:openobject-addons

bzr revid: jam@tinyerp.com-20111216061044-fud42hz16nkjmoha
This commit is contained in:
Jigar Amin - OpenERP 2011-12-16 11:40:44 +05:30
commit 8f2255fe7c
99 changed files with 3586 additions and 5969 deletions

View File

@ -104,6 +104,7 @@ module named account_voucher.
'account_invoice_view.xml', 'account_invoice_view.xml',
'partner_view.xml', 'partner_view.xml',
'data/account_data.xml', 'data/account_data.xml',
'data/data_financial_report.xml',
'data/data_account_type.xml', 'data/data_account_type.xml',
'account_invoice_workflow.xml', 'account_invoice_workflow.xml',
'project/project_view.xml', 'project/project_view.xml',
@ -122,8 +123,6 @@ module named account_voucher.
'ir_sequence_view.xml', 'ir_sequence_view.xml',
'company_view.xml', 'company_view.xml',
'board_account_view.xml', 'board_account_view.xml',
"wizard/account_report_profit_loss_view.xml",
"wizard/account_report_balance_sheet_view.xml",
"edi/invoice_action_data.xml", "edi/invoice_action_data.xml",
"account_bank_view.xml", "account_bank_view.xml",
"account_pre_install.yml" "account_pre_install.yml"

View File

@ -130,6 +130,43 @@ account_payment_term_line()
class account_account_type(osv.osv): class account_account_type(osv.osv):
_name = "account.account.type" _name = "account.account.type"
_description = "Account Type" _description = "Account Type"
def _get_current_report_type(self, cr, uid, ids, name, arg, context=None):
obj_data = self.pool.get('ir.model.data')
obj_financial_report = self.pool.get('account.financial.report')
res = {}
financial_report_ref = {
'asset': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_assets0')[1], context=context),
'liability': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_liability0')[1], context=context),
'income': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_income0')[1], context=context),
'expense': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_expense0')[1], context=context),
}
for record in self.browse(cr, uid, ids, context=context):
res[record.id] = 'none'
for key, financial_report in financial_report_ref.items():
list_ids = [x.id for x in financial_report.account_type_ids]
if record.id in list_ids:
res[record.id] = key
return res
def _save_report_type(self, cr, uid, account_type_id, field_name, field_value, arg, context=None):
obj_data = self.pool.get('ir.model.data')
obj_financial_report = self.pool.get('account.financial.report')
#unlink if it exists somewhere in the financial reports related to BS or PL
financial_report_ref = {
'asset': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_assets0')[1], context=context),
'liability': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_liability0')[1], context=context),
'income': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_income0')[1], context=context),
'expense': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_expense0')[1], context=context),
}
for key, financial_report in financial_report_ref.items():
list_ids = [x.id for x in financial_report.account_type_ids]
if account_type_id in list_ids:
obj_financial_report.write(cr, uid, [financial_report.id], {'account_type_ids': [(3, account_type_id)]})
#write it in the good place
if field_value != 'none':
return obj_financial_report.write(cr, uid, [financial_report_ref[field_value].id], {'account_type_ids': [(4, account_type_id)]})
_columns = { _columns = {
'name': fields.char('Account Type', size=64, required=True, translate=True), 'name': fields.char('Account Type', size=64, required=True, translate=True),
'code': fields.char('Code', size=32, required=True), 'code': fields.char('Code', size=32, required=True),
@ -139,19 +176,16 @@ class account_account_type(osv.osv):
'Balance' will generally be used for cash accounts. 'Balance' will generally be used for cash accounts.
'Detail' will copy each existing journal item of the previous year, even the reconciled ones. 'Detail' will copy each existing journal item of the previous year, even the reconciled ones.
'Unreconciled' will copy only the journal items that were unreconciled on the first day of the new fiscal year."""), 'Unreconciled' will copy only the journal items that were unreconciled on the first day of the new fiscal year."""),
'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'), 'report_type': fields.function(_get_current_report_type, fnct_inv=_save_report_type, type='selection', string='P&L / BS Category',
'report_type':fields.selection([ selection= [('none','/'),
('none','/'), ('income', _('Profit & Loss (Income account)')),
('income','Profit & Loss (Income Accounts)'), ('expense', _('Profit & Loss (Expense account)')),
('expense','Profit & Loss (Expense Accounts)'), ('asset', _('Balance Sheet (Asset account)')),
('asset','Balance Sheet (Asset Accounts)'), ('liability', _('Balance Sheet (Liability account)'))], help="This field is used to generate legal reports: profit and loss, balance sheet.", required=True),
('liability','Balance Sheet (Liability Accounts)')
],'P&L / BS Category', select=True, readonly=False, help="This field is used to generate legal reports: profit and loss, balance sheet.", required=True),
'note': fields.text('Description'), 'note': fields.text('Description'),
} }
_defaults = { _defaults = {
'close_method': 'none', 'close_method': 'none',
'sign': 1,
'report_type': 'none', 'report_type': 'none',
} }
_order = "code" _order = "code"
@ -2912,6 +2946,7 @@ class account_financial_report(osv.osv):
return res return res
def _get_balance(self, cr, uid, ids, name, args, context=None): def _get_balance(self, cr, uid, ids, name, args, context=None):
account_obj = self.pool.get('account.account')
res = {} res = {}
res_all = {} res_all = {}
for report in self.browse(cr, uid, ids, context=context): for report in self.browse(cr, uid, ids, context=context):
@ -2922,6 +2957,12 @@ class account_financial_report(osv.osv):
# it's the sum of balance of the linked accounts # it's the sum of balance of the linked accounts
for a in report.account_ids: for a in report.account_ids:
balance += a.balance balance += a.balance
elif report.type == 'account_type':
# it's the sum of balance of the leaf accounts with such an account type
report_types = [x.id for x in report.account_type_ids]
account_ids = account_obj.search(cr, uid, [('user_type','in', report_types), ('type','!=','view')], context=context)
for a in account_obj.browse(cr, uid, account_ids, context=context):
balance += a.balance
elif report.type == 'account_report' and report.account_report_id: elif report.type == 'account_report' and report.account_report_id:
# it's the amount of the linked report # it's the amount of the linked report
res2 = self._get_balance(cr, uid, [report.account_report_id.id], 'balance', False, context=context) res2 = self._get_balance(cr, uid, [report.account_report_id.id], 'balance', False, context=context)
@ -2944,7 +2985,6 @@ class account_financial_report(osv.osv):
'parent_id': fields.many2one('account.financial.report', 'Parent'), 'parent_id': fields.many2one('account.financial.report', 'Parent'),
'children_ids': fields.one2many('account.financial.report', 'parent_id', 'Account Report'), 'children_ids': fields.one2many('account.financial.report', 'parent_id', 'Account Report'),
'sequence': fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
'note': fields.text('Notes'),
'balance': fields.function(_get_balance, 'Balance'), 'balance': fields.function(_get_balance, 'Balance'),
'level': fields.function(_get_level, string='Level', store=True, type='integer'), 'level': fields.function(_get_level, string='Level', store=True, type='integer'),
'type': fields.selection([ 'type': fields.selection([
@ -2954,13 +2994,20 @@ class account_financial_report(osv.osv):
('account_report','Report Value'), ('account_report','Report Value'),
],'Type'), ],'Type'),
'account_ids': fields.many2many('account.account', 'account_account_financial_report', 'report_line_id', 'account_id', 'Accounts'), 'account_ids': fields.many2many('account.account', 'account_account_financial_report', 'report_line_id', 'account_id', 'Accounts'),
'display_detail': fields.boolean('Display details', help='Display every account with its balance instead of the sum.'), 'display_detail': fields.selection([
('no_detail','No detail'),
('detail_flat','Display children flat'),
('detail_with_hierarchy','Display children with hierarchy')
], 'Display details'),
'account_report_id': fields.many2one('account.financial.report', 'Report Value'), 'account_report_id': fields.many2one('account.financial.report', 'Report Value'),
'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'), 'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'),
'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'),
} }
_defaults = { _defaults = {
'type': 'sum', 'type': 'sum',
'display_detail': 'detail_flat',
'sign': 1,
} }
account_financial_report() account_financial_report()

View File

@ -610,15 +610,15 @@ class account_invoice(osv.osv):
res[r[0]].append( r[1] ) res[r[0]].append( r[1] )
return res return res
def copy(self, cr, uid, id, default={}, context=None): def copy(self, cr, uid, id, default=None, context=None):
if context is None: default = default or {}
context = {}
default.update({ default.update({
'state':'draft', 'state':'draft',
'number':False, 'number':False,
'move_id':False, 'move_id':False,
'move_name':False, 'move_name':False,
'internal_number': False, 'internal_number': False,
'period_id': False,
}) })
if 'date_invoice' not in default: if 'date_invoice' not in default:
default.update({ default.update({
@ -1642,12 +1642,7 @@ class res_partner(osv.osv):
} }
def copy(self, cr, uid, id, default=None, context=None): def copy(self, cr, uid, id, default=None, context=None):
if default is None: default = default or {}
default = {}
if context is None:
context = {}
default.update({'invoice_ids' : []}) default.update({'invoice_ids' : []})
return super(res_partner, self).copy(cr, uid, id, default, context) return super(res_partner, self).copy(cr, uid, id, default, context)

View File

@ -787,7 +787,6 @@
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Reporting Configuration" colspan="4"/> <separator string="Reporting Configuration" colspan="4"/>
<field name="report_type" select="2"/> <field name="report_type" select="2"/>
<field name="sign" />
</group> </group>
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Closing Method" colspan="4"/> <separator string="Closing Method" colspan="4"/>
@ -2781,10 +2780,14 @@ action = pool.get('res.config').next(cr, uid, [], context)
<field name="parent_id"/> <field name="parent_id"/>
<field name="sequence"/> <field name="sequence"/>
<field name="type"/> <field name="type"/>
<field name="sign"/>
</group> </group>
<notebook colspan="4"> <notebook colspan="6">
<page string="Report" attrs="{'invisible': [('state','!=','confirm')]}"> <page string="Report">
<field name="display_detail" attrs="{'invisible': [('type','!=','accounts')]}"/> <group colspan="4" col="4">
<field name="display_detail" attrs="{'invisible': [('type','not in',['accounts','account_type'])]}" colspan="2"/>
<label string="" colspan="2"/>
</group>
<newline/> <newline/>
<field name="account_ids" nolabel="1" colspan="6" attrs="{'invisible': [('type', '!=', 'accounts')]}"/> <field name="account_ids" nolabel="1" colspan="6" attrs="{'invisible': [('type', '!=', 'accounts')]}"/>
<newline/> <newline/>
@ -2793,9 +2796,6 @@ action = pool.get('res.config').next(cr, uid, [], context)
<field name="account_type_ids" nolabel="1" attrs="{'invisible': [('type', '!=', 'account_type')]}"/> <field name="account_type_ids" nolabel="1" attrs="{'invisible': [('type', '!=', 'account_type')]}"/>
<newline/> <newline/>
</page> </page>
<page string="Notes" attrs="{'invisible': [('state','!=','confirm')]}">
<field name="note" nolabel="1" colspan="4"/>
</page>
</notebook> </notebook>
</form> </form>
</field> </field>

View File

@ -1,26 +1,6 @@
<openerp> <openerp>
<data> <data>
<!-- Types --> <!-- Types -->
<record model="account.account.type" id="conf_account_type_receivable">
<field name="name">Receivable</field>
<field name="code">receivable</field>
<field name="report_type">income</field>
<field name="close_method">unreconciled</field>
</record>
<record model="account.account.type" id="conf_account_type_payable">
<field name="name">Payable</field>
<field name="code">payable</field>
<field name="report_type">expense</field>
<field name="close_method">unreconciled</field>
</record>
<record model="account.account.type" id="conf_account_type_view">
<field name="name">View</field>
<field name="code">view</field>
<field name="close_method">none</field>
</record>
<record model="account.account.type" id="account_type_income_view1"> <record model="account.account.type" id="account_type_income_view1">
<field name="name">Income View</field> <field name="name">Income View</field>
<field name="code">view</field> <field name="code">view</field>
@ -41,78 +21,32 @@
<field name="code">liability</field> <field name="code">liability</field>
<field name="report_type">liability</field> <field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="conf_account_type_income">
<field name="name">Income</field>
<field name="code">income</field>
<field name="report_type">income</field>
<field name="close_method">none</field>
</record>
<record model="account.account.type" id="conf_account_type_expense">
<field name="name">Expense</field>
<field name="code">expense</field>
<field name="report_type">expense</field>
<field name="close_method">none</field>
</record>
<record model="account.account.type" id="conf_account_type_tax"> <record model="account.account.type" id="conf_account_type_tax">
<field name="name">Tax</field> <field name="name">Tax</field>
<field name="code">tax</field> <field name="code">tax</field>
<field name="report_type">expense</field>
<field name="close_method">unreconciled</field> <field name="close_method">unreconciled</field>
<field name="report_type">expense</field>
</record> </record>
<record model="account.account.type" id="conf_account_type_cash">
<field name="name">Cash</field>
<field name="code">cash</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_liability">
<field name="name">Liability</field>
<field name="code">liability</field>
<field name="report_type">liability</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_asset">
<field name="name">Asset</field>
<field name="code">asset</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_equity"> <record model="account.account.type" id="conf_account_type_equity">
<field name="name">Equity</field> <field name="name">Equity</field>
<field name="code">equity</field> <field name="code">equity</field>
<field name="close_method">balance</field>
<field name="report_type">liability</field> <field name="report_type">liability</field>
<field name="close_method">balance</field>
</record> </record>
<record model="account.account.type" id="conf_account_type_chk">
<record model="account.account.type" id="conf_account_type_bnk">
<field name="name">Bank</field>
<field name="code">bank</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_chk">
<field name="name">Check</field> <field name="name">Check</field>
<field name="code">check</field> <field name="code">check</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<!-- Account Templates--> <!-- Account Templates-->
<record id="conf_chart0" model="account.account.template"> <record id="conf_chart0" model="account.account.template">
<field name="code">0</field> <field name="code">0</field>
<field name="name">Configurable Account Chart</field> <field name="name">Configurable Account Chart</field>
<field eval="0" name="parent_id"/> <field eval="0" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/> <field name="user_type" ref="data_account_type_view"/>
</record> </record>
<!-- Balance Sheet --> <!-- Balance Sheet -->
@ -122,7 +56,7 @@
<field name="name">Balance Sheet</field> <field name="name">Balance Sheet</field>
<field ref="conf_chart0" name="parent_id"/> <field ref="conf_chart0" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/> <field name="user_type" ref="data_account_type_view"/>
</record> </record>
<record id="conf_fas" model="account.account.template"> <record id="conf_fas" model="account.account.template">
@ -162,7 +96,7 @@
<field name="name">Purchased Stocks</field> <field name="name">Purchased Stocks</field>
<field ref="conf_cas" name="parent_id"/> <field ref="conf_cas" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="conf_a_recv" model="account.account.template"> <record id="conf_a_recv" model="account.account.template">
@ -171,7 +105,7 @@
<field ref="conf_cas" name="parent_id"/> <field ref="conf_cas" name="parent_id"/>
<field name="type">receivable</field> <field name="type">receivable</field>
<field eval="True" name="reconcile"/> <field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_receivable"/> <field name="user_type" ref="data_account_type_receivable"/>
</record> </record>
<record id="conf_ova" model="account.account.template"> <record id="conf_ova" model="account.account.template">
@ -179,7 +113,7 @@
<field name="name">Tax Paid</field> <field name="name">Tax Paid</field>
<field ref="conf_cas" name="parent_id"/> <field ref="conf_cas" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="conf_bnk" model="account.account.template"> <record id="conf_bnk" model="account.account.template">
@ -195,7 +129,7 @@
<field name="name">Opening Income Account</field> <field name="name">Opening Income Account</field>
<field ref="conf_cas" name="parent_id"/> <field ref="conf_cas" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_income"/> <field name="user_type" ref="data_account_type_income"/>
</record> </record>
<record id="conf_cli" model="account.account.template"> <record id="conf_cli" model="account.account.template">
@ -212,7 +146,7 @@
<field ref="conf_cli" name="parent_id"/> <field ref="conf_cli" name="parent_id"/>
<field name="type">payable</field> <field name="type">payable</field>
<field eval="True" name="reconcile"/> <field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_payable"/> <field name="user_type" ref="data_account_type_payable"/>
</record> </record>
<record id="conf_iva" model="account.account.template"> <record id="conf_iva" model="account.account.template">
@ -220,7 +154,7 @@
<field name="name">Tax Received</field> <field name="name">Tax Received</field>
<field ref="conf_cli" name="parent_id"/> <field ref="conf_cli" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_liability"/> <field name="user_type" ref="data_account_type_liability"/>
</record> </record>
<record id="conf_a_reserve_and_surplus" model="account.account.template"> <record id="conf_a_reserve_and_surplus" model="account.account.template">
@ -229,7 +163,7 @@
<field ref="conf_cli" name="parent_id"/> <field ref="conf_cli" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field eval="True" name="reconcile"/> <field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_liability"/> <field name="user_type" ref="data_account_type_liability"/>
</record> </record>
<record id="conf_o_expense" model="account.account.template"> <record id="conf_o_expense" model="account.account.template">
@ -237,7 +171,7 @@
<field name="name">Opening Expense Account</field> <field name="name">Opening Expense Account</field>
<field ref="conf_cli" name="parent_id"/> <field ref="conf_cli" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<!-- Profit and Loss --> <!-- Profit and Loss -->
@ -247,7 +181,7 @@
<field name="name">Profit and Loss</field> <field name="name">Profit and Loss</field>
<field ref="conf_chart0" name="parent_id"/> <field ref="conf_chart0" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/> <field name="user_type" ref="data_account_type_view"/>
</record> </record>
<record id="conf_rev" model="account.account.template"> <record id="conf_rev" model="account.account.template">
@ -263,7 +197,7 @@
<field name="name">Product Sales</field> <field name="name">Product Sales</field>
<field ref="conf_rev" name="parent_id"/> <field ref="conf_rev" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_income"/> <field name="user_type" ref="data_account_type_income"/>
</record> </record>
<record id="conf_cos" model="account.account.template"> <record id="conf_cos" model="account.account.template">
@ -279,7 +213,7 @@
<field name="name">Cost of Goods Sold</field> <field name="name">Cost of Goods Sold</field>
<field ref="conf_cos" name="parent_id"/> <field ref="conf_cos" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<record id="conf_ovr" model="account.account.template"> <record id="conf_ovr" model="account.account.template">
@ -295,7 +229,7 @@
<field name="name">Expenses</field> <field name="name">Expenses</field>
<field ref="conf_ovr" name="parent_id"/> <field ref="conf_ovr" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<record id="conf_a_salary_expense" model="account.account.template"> <record id="conf_a_salary_expense" model="account.account.template">
@ -303,7 +237,7 @@
<field name="name">Salary Expenses</field> <field name="name">Salary Expenses</field>
<field ref="conf_ovr" name="parent_id"/> <field ref="conf_ovr" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<!-- Taxes --> <!-- Taxes -->

View File

@ -30,21 +30,25 @@
<field name="name">Asset</field> <field name="name">Asset</field>
<field name="code">asset</field> <field name="code">asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="data_account_type_liability"> <record model="account.account.type" id="data_account_type_liability">
<field name="name">Liability</field> <field name="name">Liability</field>
<field name="code">liability</field> <field name="code">liability</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="data_account_type_income"> <record model="account.account.type" id="data_account_type_income">
<field name="name">Income</field> <field name="name">Income</field>
<field name="code">income</field> <field name="code">income</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">income</field>
</record> </record>
<record model="account.account.type" id="data_account_type_expense"> <record model="account.account.type" id="data_account_type_expense">
<field name="name">Expense</field> <field name="name">Expense</field>
<field name="code">expense</field> <field name="code">expense</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">expense</field>
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!--
Financial Reports
-->
<record id="account_financial_report_balancesheet0" model="account.financial.report">
<field name="name">Balance Sheet</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_assets0" model="account.financial.report">
<field name="name">Assets</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_liability0" model="account.financial.report">
<field name="name">Liability</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_profitandloss0" model="account.financial.report">
<field name="name">Profit and Loss</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_income0" model="account.financial.report">
<field name="name">Income</field>
<field name="parent_id" ref="account_financial_report_profitandloss0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_expense0" model="account.financial.report">
<field name="name">Expense</field>
<field name="parent_id" ref="account_financial_report_profitandloss0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
</data>
</openerp>

View File

@ -5,58 +5,11 @@
Account Type Account Type
--> -->
<record id="account_type_root" model="account.account.type">
<field name="name">View</field>
<field name="code">view</field>
<field name="close_method">none</field>
</record>
<record id="account_type_asset" model="account.account.type">
<field name="name">Asset</field>
<field name="code">asset</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_receivable" model="account.account.type">
<field name="name">Receivable</field>
<field name="code">receivable</field>
<field name="report_type">asset</field>
<field name="close_method">unreconciled</field>
</record>
<record id="account_type_liability" model="account.account.type">
<field name="name">Liability</field>
<field name="code">liability</field>
<field name="report_type">liability</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_payable" model="account.account.type">
<field name="name">Payable</field>
<field name="code">payable</field>
<field name="report_type">liability</field>
<field name="close_method">unreconciled</field>
</record>
<record id="account_type_income" model="account.account.type">
<field name="name">Income</field>
<field name="code">income</field>
<field name="report_type">income</field>
<field name="close_method">none</field>
</record>
<record id="account_type_expense" model="account.account.type">
<field name="name">Expense</field>
<field name="code">expense</field>
<field name="report_type">expense</field>
<field name="close_method">none</field>
</record>
<record id="account_type_cash_equity" model="account.account.type"> <record id="account_type_cash_equity" model="account.account.type">
<field name="name">Equity</field> <field name="name">Equity</field>
<field name="code">equity</field> <field name="code">equity</field>
<field name="close_method">balance</field>
<field name="report_type">liability</field> <field name="report_type">liability</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_cash_moves" model="account.account.type">
<field name="name">Cash</field>
<field name="code">cash</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record> </record>
<!-- <!--
@ -68,7 +21,7 @@
<field name="name">Chart For Automated Tests</field> <field name="name">Chart For Automated Tests</field>
<field eval="0" name="parent_id"/> <field eval="0" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_root"/> <field name="user_type" ref="data_account_type_view"/>
</record> </record>
<!-- Balance Sheet --> <!-- Balance Sheet -->
@ -78,14 +31,14 @@
<field name="name">Balance Sheet - (test)</field> <field name="name">Balance Sheet - (test)</field>
<field ref="chart0" name="parent_id"/> <field ref="chart0" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_root"/> <field name="user_type" ref="data_account_type_view"/>
</record> </record>
<record model="account.account" id="assets_view"> <record model="account.account" id="assets_view">
<field name="name">Assets - (test)</field> <field name="name">Assets - (test)</field>
<field name="code">X10</field> <field name="code">X10</field>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="False"/>
<field name="parent_id" ref="bal"/> <field name="parent_id" ref="bal"/>
</record> </record>
@ -95,7 +48,7 @@
<field name="name">Fixed Assets - (test)</field> <field name="name">Fixed Assets - (test)</field>
<field ref="assets_view" name="parent_id"/> <field ref="assets_view" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="xfa" model="account.account"> <record id="xfa" model="account.account">
@ -103,7 +56,7 @@
<field name="name">Fixed Asset Account - (test)</field> <field name="name">Fixed Asset Account - (test)</field>
<field ref="fas" name="parent_id"/> <field ref="fas" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="nca" model="account.account"> <record id="nca" model="account.account">
@ -111,7 +64,7 @@
<field name="name">Net Current Assets - (test)</field> <field name="name">Net Current Assets - (test)</field>
<field ref="assets_view" name="parent_id"/> <field ref="assets_view" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="cas" model="account.account"> <record id="cas" model="account.account">
@ -119,7 +72,7 @@
<field name="name">Current Assets - (test)</field> <field name="name">Current Assets - (test)</field>
<field ref="nca" name="parent_id"/> <field ref="nca" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="stk" model="account.account"> <record id="stk" model="account.account">
@ -127,7 +80,7 @@
<field name="name">Purchased Stocks - (test)</field> <field name="name">Purchased Stocks - (test)</field>
<field ref="cas" name="parent_id"/> <field ref="cas" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="a_recv" model="account.account"> <record id="a_recv" model="account.account">
@ -136,7 +89,7 @@
<field ref="cas" name="parent_id"/> <field ref="cas" name="parent_id"/>
<field name="type">receivable</field> <field name="type">receivable</field>
<field eval="True" name="reconcile"/> <field eval="True" name="reconcile"/>
<field name="user_type" ref="account_type_receivable"/> <field name="user_type" ref="data_account_type_receivable"/>
</record> </record>
<record id="ova" model="account.account"> <record id="ova" model="account.account">
@ -144,7 +97,7 @@
<field name="name">Output VAT - (test)</field> <field name="name">Output VAT - (test)</field>
<field ref="cas" name="parent_id"/> <field ref="cas" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="bnk" model="account.account"> <record id="bnk" model="account.account">
@ -152,7 +105,7 @@
<field name="name">Bank Current Account - (test)</field> <field name="name">Bank Current Account - (test)</field>
<field ref="cas" name="parent_id"/> <field ref="cas" name="parent_id"/>
<field name="type">liquidity</field> <field name="type">liquidity</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="cash" model="account.account"> <record id="cash" model="account.account">
@ -160,7 +113,7 @@
<field name="name">Cash - (test)</field> <field name="name">Cash - (test)</field>
<field ref="cas" name="parent_id"/> <field ref="cas" name="parent_id"/>
<field name="type">liquidity</field> <field name="type">liquidity</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="data_account_type_asset"/>
</record> </record>
<record id="o_income" model="account.account"> <record id="o_income" model="account.account">
@ -168,14 +121,14 @@
<field name="name">Opening Income - (test)</field> <field name="name">Opening Income - (test)</field>
<field ref="cas" name="parent_id"/> <field ref="cas" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_income"/> <field name="user_type" ref="data_account_type_income"/>
</record> </record>
<record model="account.account" id="liabilities_view"> <record model="account.account" id="liabilities_view">
<field name="name">Liabilities - (test)</field> <field name="name">Liabilities - (test)</field>
<field name="code">X11</field> <field name="code">X11</field>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_liability"/> <field name="user_type" ref="data_account_type_liability"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="False"/>
<field name="parent_id" ref="bal"/> <field name="parent_id" ref="bal"/>
</record> </record>
@ -185,7 +138,7 @@
<field name="name">Current Liabilities - (test)</field> <field name="name">Current Liabilities - (test)</field>
<field ref="liabilities_view" name="parent_id"/> <field ref="liabilities_view" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_liability"/> <field name="user_type" ref="data_account_type_liability"/>
</record> </record>
<record id="a_pay" model="account.account"> <record id="a_pay" model="account.account">
@ -194,7 +147,7 @@
<field ref="cli" name="parent_id"/> <field ref="cli" name="parent_id"/>
<field name="type">payable</field> <field name="type">payable</field>
<field eval="True" name="reconcile"/> <field eval="True" name="reconcile"/>
<field name="user_type" ref="account_type_payable"/> <field name="user_type" ref="data_account_type_payable"/>
</record> </record>
<record id="iva" model="account.account"> <record id="iva" model="account.account">
@ -202,7 +155,7 @@
<field name="name">Input VAT - (test)</field> <field name="name">Input VAT - (test)</field>
<field ref="cli" name="parent_id"/> <field ref="cli" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_liability"/> <field name="user_type" ref="data_account_type_liability"/>
</record> </record>
<record id="rsa" model="account.account"> <record id="rsa" model="account.account">
@ -210,7 +163,7 @@
<field name="name">Reserve and Profit/Loss - (test)</field> <field name="name">Reserve and Profit/Loss - (test)</field>
<field ref="cli" name="parent_id"/> <field ref="cli" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_liability"/> <field name="user_type" ref="data_account_type_liability"/>
</record> </record>
<record id="o_expense" model="account.account"> <record id="o_expense" model="account.account">
@ -218,7 +171,7 @@
<field name="name">Opening Expense - (test)</field> <field name="name">Opening Expense - (test)</field>
<field ref="cli" name="parent_id"/> <field ref="cli" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<!-- Profit and Loss --> <!-- Profit and Loss -->
@ -228,14 +181,14 @@
<field name="name">Profit and Loss - (test)</field> <field name="name">Profit and Loss - (test)</field>
<field ref="chart0" name="parent_id"/> <field ref="chart0" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_root"/> <field name="user_type" ref="data_account_type_view"/>
</record> </record>
<record model="account.account" id="income_view"> <record model="account.account" id="income_view">
<field name="name">Income - (test)</field> <field name="name">Income - (test)</field>
<field name="code">X20</field> <field name="code">X20</field>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_income"/> <field name="user_type" ref="data_account_type_income"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="False"/>
<field name="parent_id" ref="gpf"/> <field name="parent_id" ref="gpf"/>
</record> </record>
@ -244,7 +197,7 @@
<field name="name">Foreign Exchange Gain - (test)</field> <field name="name">Foreign Exchange Gain - (test)</field>
<field name="code">X201</field> <field name="code">X201</field>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_income"/> <field name="user_type" ref="data_account_type_income"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="False"/>
<field name="parent_id" ref="income_view"/> <field name="parent_id" ref="income_view"/>
</record> </record>
@ -254,7 +207,7 @@
<field name="name">Revenue - (test)</field> <field name="name">Revenue - (test)</field>
<field ref="income_view" name="parent_id"/> <field ref="income_view" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_income"/> <field name="user_type" ref="data_account_type_income"/>
</record> </record>
<record id="a_sale" model="account.account"> <record id="a_sale" model="account.account">
@ -262,14 +215,14 @@
<field name="name">Product Sales - (test)</field> <field name="name">Product Sales - (test)</field>
<field ref="rev" name="parent_id"/> <field ref="rev" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_income"/> <field name="user_type" ref="data_account_type_income"/>
</record> </record>
<record model="account.account" id="expense_view"> <record model="account.account" id="expense_view">
<field name="name">Expense - (test)</field> <field name="name">Expense - (test)</field>
<field name="code">X21</field> <field name="code">X21</field>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="False"/>
<field name="parent_id" ref="gpf"/> <field name="parent_id" ref="gpf"/>
</record> </record>
@ -280,7 +233,7 @@
<field name="name">Cost of Sales - (test)</field> <field name="name">Cost of Sales - (test)</field>
<field ref="expense_view" name="parent_id"/> <field ref="expense_view" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<record id="cog" model="account.account"> <record id="cog" model="account.account">
@ -288,7 +241,7 @@
<field name="name">Cost of Goods Sold - (test)</field> <field name="name">Cost of Goods Sold - (test)</field>
<field ref="cos" name="parent_id"/> <field ref="cos" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<record id="ovr" model="account.account"> <record id="ovr" model="account.account">
@ -296,7 +249,7 @@
<field name="name">Overheads - (test)</field> <field name="name">Overheads - (test)</field>
<field ref="expense_view" name="parent_id"/> <field ref="expense_view" name="parent_id"/>
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<record id="a_expense" model="account.account"> <record id="a_expense" model="account.account">
@ -304,14 +257,14 @@
<field name="name">Expenses - (test)</field> <field name="name">Expenses - (test)</field>
<field ref="ovr" name="parent_id"/> <field ref="ovr" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<record model="account.account" id="income_fx_expense"> <record model="account.account" id="income_fx_expense">
<field name="name">Foreign Exchange Loss - (test)</field> <field name="name">Foreign Exchange Loss - (test)</field>
<field name="code">X2111</field> <field name="code">X2111</field>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="False"/>
<field name="parent_id" ref="ovr"/> <field name="parent_id" ref="ovr"/>
</record> </record>
@ -321,7 +274,7 @@
<field name="name">Salary Expenses - (test)</field> <field name="name">Salary Expenses - (test)</field>
<field ref="ovr" name="parent_id"/> <field ref="ovr" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account_type_expense"/> <field name="user_type" ref="data_account_type_expense"/>
</record> </record>
<!-- Properties --> <!-- Properties -->

View File

@ -33,13 +33,10 @@ import account_print_overdue
import account_aged_partner_balance import account_aged_partner_balance
#import tax_report #import tax_report
import account_tax_report import account_tax_report
import account_balance_landscape
import account_invoice_report import account_invoice_report
import account_report import account_report
import account_entries_report import account_entries_report
import account_analytic_entries_report import account_analytic_entries_report
import account_balance_sheet
import account_profit_loss
import account_treasury_report import account_treasury_report
import account_financial_report import account_financial_report

View File

@ -1,393 +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 locale
from report import report_sxw
parents = {
'tr':1,
'li':1,
'story': 0,
'section': 0
}
class account_balance_landscape(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_balance_landscape, self).__init__(cr, uid, name, context=context)
self.flag=1
self.dr_total= 0.00
self.cr_total= 0.00
self.parent_bal=0
self.status=0
self.done_total=0
self.baldiv={}
self.empty_parent=0
self.result_total = {}
self.total_for_perc=[]
self.localcontext.update({
'time': time,
'lines': self.lines,
'get_lines':self.get_lines,
'linesForTotal': self.linesForTotal,
'linesForYear': self.linesForYear,
'get_years':self.get_years,
'cal_total':self.cal_total,
'total_dr':self.total_dr,
'total_cr':self.total_cr
})
self.context = context
def linesForYear(self,form):
temp=0
years={}
global pattern
global show
global perc
global bal_zero
global ref_bal
pattern=form['compare_pattern']
if form['show_columns']!=1:
show=0
else:
show=form['show_columns']
if form['format_perc']!=1:
perc=0
else:
perc=form['format_perc']
if form['account_choice']=='bal_zero':
bal_zero=0
else:
bal_zero=1
ctx = self.context.copy()
if perc==1:
if form['select_account']!=False:
ref_ac=self.pool.get('account.account').browse(self.cr, self.uid, form['select_account'], ctx.copy())
if ref_ac.balance<>0.00:
ref_bal=ref_ac.balance
else:
ref_bal=1.00
else:
ref_bal='nothing'
else:
ref_bal='nothing'
self.done_total=1
self.total_for_perc=self.linesForTotal(form, ids={}, doneAccount={}, level=1)
self.done_total=0
for t1 in range(0,len(form['fiscalyear'])):
locale.setlocale(locale.LC_ALL, '')
self.result_total["sum_credit" + str(t1)]=locale.format("%.2f", self.result_total["sum_credit" + str(t1)], grouping=True)
self.result_total["sum_debit" + str(t1)]=locale.format("%.2f", self.result_total["sum_debit" + str(t1)], grouping=True)
for temp in range(0,len(form['fiscalyear'])):
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
years["year"+str(temp)]=fy[0][1][12:16]
return [years]
def linesForTotal(self, form, ids={}, doneAccount={}, level=1):
if not self.done_total==1:
return [self.result_total]
accounts=[]
if not ids:
ids = self.ids
if not ids:
return []
ctx = self.context.copy()
for id in form['fiscalyear']:
tmp=[]
ctx['fiscalyear'] = id
ctx['periods'] = form['periods']
ctx['period_manner'] = form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
if tmp:
accounts.append(tmp)
merged_accounts=zip(*accounts)
# used to check for the frst record so all sum_credit and sum_debit r set to 0.00
if level==1:
doneAccount={}
for entry in merged_accounts:
if entry[0].id in doneAccount:
continue
doneAccount[entry[0].id] = 1
for k in range(0,len(entry)):
temp_credit=0.00
temp_debit=0.00
if entry[0].type <> 'view':
temp_credit+=entry[k].credit
temp_debit+=entry[k].debit
if self.flag==1:
self.result_total["sum_credit" + str(k)]=0.00
self.result_total["sum_debit" + str(k)]=0.00
if form['account_choice']=='bal_zero':
if temp_credit<>temp_debit:
self.result_total["sum_credit" + str(k)]+=temp_credit
self.result_total["sum_debit" + str(k)]+=temp_debit
else:
self.result_total["sum_credit" + str(k)]+=temp_credit
self.result_total["sum_debit" + str(k)]+=temp_debit
self.flag=2
if entry[0].child_id:
ids2 = [(x.code,x.id) for x in entry[0].child_id]
ids2.sort()
result_total_parent = self.linesForTotal(form, [x[1] for x in ids2], doneAccount, level+1)
return [self.result_total]
def lines(self, form, ids={}, done={}, level=1):
accounts=[]
if not ids:
ids = self.ids
if not ids:
return []
result = []
ctx = self.context.copy()
tmp1=[]
for id in form['fiscalyear']:
ctx['fiscalyear'] = id
ctx['periods'] = form['periods']
ctx['period_manner']=form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
if tmp1:
accounts.append(tmp1)
if level==1: #if parent is called,done is not empty when called again.
done={}
def cmp_code(x, y):
return cmp(x.code, y.code)
for n in range(0,len(accounts)):
accounts[n].sort(cmp_code)
merged_accounts=zip(*accounts)
for entry in merged_accounts:
j=0
checked=1
if form['account_choice']!='all': # if checked,include empty a/c;not otherwise
checked=0
if entry[0].id in done:
continue
done[entry[0].id] = 1
if entry[0].child_id: # this is for parent account,dont check 0 for it
checked=4
self.status=1 # for displaying it Bold
else:
self.status=0
if checked==0:
i=0
for i in range(0,len(entry)):
if bal_zero==0:
if entry[i].balance<>0.0:
checked=4
break
else:
checked=3
i=i+1
else:
if entry[i].credit <> 0.0 or entry[i].debit <> 0.0:
checked=4
break
else:
checked=3
i=i+1
if checked==3:
# this is the point where we skip those accounts which are encountered as empty ones
continue
self.empty_parent=0
else:
self.empty_parent=1
res = {
'code': entry[0].code,
'name': entry[0].name,
'level': level,
'status': self.status,
}
for j in range(0,len(entry)):
locale.setlocale(locale.LC_ALL, '')
res["debit"+str(j)]=locale.format("%.2f", entry[j].debit, grouping=True)
res["credit"+str(j)]=locale.format("%.2f", entry[j].credit, grouping=True)
res["balance"+str(j)]=locale.format("%.2f", entry[j].balance, grouping=True)
if j==0:
res["bal_cash"+str(j)]="0.00"
res["bal_perc"+str(j)]="0.00%"
else:
temp_cash=entry[j].balance - entry[j-1].balance
res["bal_cash"+str(j)]=locale.format("%.2f", temp_cash, grouping=True)
if entry[j-1].balance<>0.00:
temp_perc=(entry[j].balance - entry[j-1].balance )*100/entry[j-1].balance
else:
temp_perc=(entry[j].balance) *100
res["bal_perc"+str(j)]=locale.format("%.2f", temp_perc) + "%"
if ref_bal=='nothing':
if level==1:
self.parent_bal=1
else:
self.parent_bal=0
if self.parent_bal==1:
res["balance_perc"+str(j)]="/"
else:
if entry[j].balance==0.00:
if self.baldiv["baldiv"+str(level-1)+str(j)]<>0.00:
res["balance_perc"+str(j)]="0.00%"
else:
res["balance_perc"+str(j)]="/"
else:
if self.baldiv["baldiv"+str(level-1)+str(j)]<>0.00:
temp=self.baldiv["baldiv"+str(level-1)+str(j)]
temp1=(entry[j].balance * 100 )/ float(temp)
temp1=round(temp1,2)
res["balance_perc" + str(j)]=str(temp1)+"%"
else:
res["balance_perc"+str(j)]="/"
else:
res["balance_perc"+str(j)]=str( (entry[j].balance * 100 )/ float(ref_bal)) + "%"
result.append(res)
if entry[0].child_id:
for q in range(0,len(form['fiscalyear'])):
self.baldiv["baldiv"+str(level)+str(q)]=entry[q].balance
ids2 = [(x.code,x.id) for x in entry[0].child_id]
ids2.sort()
dir=[]
dir += self.lines(form, [x[1] for x in ids2], done, level+1)
if dir==[]:
for w in range(0,len(form['fiscalyear'])):
if entry[w].credit <> 0.0 or entry[w].debit <> 0.0 or entry[w].balance<>0.00:
dont_pop=1
break
else:
dont_pop=0
if dont_pop==1:
result +=dir
else:
result.pop(-1) # here we pop up the parent having its children as emprty accounts
else:
result +=dir
return result
def get_years(self, form):
result =[]
res={}
for temp in range(0, len(form['fiscalyear'])):
res={}
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
res['year']=fy[0][1]
res['last_str']=temp
result.append(res)
self.linesForYear(form)
return result
def get_lines(self, year_dict, form):
final_result = []
res = {}
line_l = self.lines(form)
self.cal_total(year_dict)
if line_l:
for l in line_l:
res = {}
res['code'] = l['code']
res['name'] = l['name']
res['level'] = l['level']
for k,v in l.items():
if k.startswith('debit'+str(year_dict['last_str'])):
res['debit'] = v
if k.startswith('credit'+str(year_dict['last_str'])):
res['credit'] = v
if k.startswith('balance'+str(year_dict['last_str'])) and not k.startswith('balance_perc'+str(year_dict['last_str'])):
res['balance'] =v
if k.startswith('balance_perc'+str(year_dict['last_str'])) and not k.startswith('balance'+str(year_dict['last_str'])):
res['balance_perc'] = v
if form['compare_pattern'] == 'bal_perc':
if k.startswith('bal_perc'+str(year_dict['last_str'])):
res['pattern'] = v
elif form['compare_pattern'] == 'bal_cash':
if k.startswith('bal_cash'+str(year_dict['last_str'])):
res['pattern'] = v
else:
res['pattern'] = ''
final_result.append(res)
return final_result
def cal_total(self, year_dict):
total_l = self.result_total
if total_l:
for k,v in total_l.items():
if k.startswith('sum_debit'+str(year_dict['last_str'])):
self.dr_total = v
elif k.startswith('sum_credit'+str(year_dict['last_str'])):
self.cr_total = v
else:
continue
return True
def total_dr(self):
return self.dr_total
def total_cr(self):
return self.cr_total
report_sxw.report_sxw('report.account.account.balance.landscape', 'account.account', 'addons/account/report/account_balance_landscape.rml', parser=account_balance_landscape, header="internal landscape")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,317 +0,0 @@
<?xml version="1.0"?>
<document filename="Account Balance.pdf">
<template pageSize="(842.0,595.0)" title="Account Balance" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="28.0" width="786" height="539"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Tiltle">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_header_account">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<blockBackground colorName="#b3b3b3" start="0,0" stop="0,-1"/>
<blockBackground colorName="#b3b3b3" start="1,0" stop="1,-1"/>
<blockBackground colorName="#b3b3b3" start="2,0" stop="2,-1"/>
<blockBackground colorName="#b3b3b3" start="3,0" stop="3,-1"/>
<blockBackground colorName="#b3b3b3" start="4,0" stop="4,-1"/>
<blockBackground colorName="#b3b3b3" start="5,0" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<blockBackground colorName="#b3b3b3" start="0,0" stop="0,-1"/>
<blockBackground colorName="#b3b3b3" start="1,0" stop="1,-1"/>
<blockBackground colorName="#b3b3b3" start="2,0" stop="2,-1"/>
<blockBackground colorName="#b3b3b3" start="3,0" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<blockBackground colorName="#cccccc" start="0,0" stop="0,-1"/>
<blockBackground colorName="#cccccc" start="1,0" stop="1,-1"/>
<blockBackground colorName="#cccccc" start="2,0" stop="2,-1"/>
<blockBackground colorName="#cccccc" start="3,0" stop="3,-1"/>
<blockBackground colorName="#cccccc" start="4,0" stop="4,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" 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-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="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" 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="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_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="0.0" spaceAfter="0.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_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="15" alignment="CENTER" spaceBefore="0.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_space" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.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="terp_default_8">[[ repeatIn(get_years(data['form']), 'y') ]]</para>
<blockTable colWidths="785.0" style="Table_Tiltle">
<tr>
<td>
<para style="terp_header_Centre">Account Balance - [[ company.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_space">
<font color="white"> </font>
</para>
<para style="terp_header">Year : [[ y['year'] ]]</para>
<blockTable colWidths="56.0,198.0,95.0,110.0,105.0,164.0" style="Table_header_account">
<tr>
<td>
<para style="terp_tblheader_Details">[[ data['form']['show_columns'] and 'Code' or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details">Account Name </para>
</td>
<td>
<para style="terp_tblheader_Details">[[ data['form']['compare_pattern']!='none' and 'C.S.Y.T.(C./P)' or removeParentNode('font') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Debit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Credit</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Balance</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
<blockTable colWidths="56.0,198.0,206.0,268.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_Details">[[ data['form']['show_columns'] and removeParentNode('blockTable') or 'Code' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details">Account Name </para>
</td>
<td>
<para style="terp_tblheader_Details"><font>[[ data['form']['compare_pattern']!='none' and 'C.S.Y.T.(C./P)' or removeParentNode('font') ]]</font></para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Balance</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_8">[[ repeatIn(get_lines(y,data['form']), 'a') ]]</para>
<blockTable colWidths="56.0,197.0,94.0,110.0,106.0,162.0" style="Table4">
<tr>
<td>
<para style="terp_default_9">[[ (data['form']['format_perc'] or not data['form']['show_columns']) and removeParentNode('blockTable') ]] [[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font color="white">[['.....'*(a['level']-1) ]]</font><font>[[ a['name'] ]]</font></para>
</td>
<td>
<para style="terp_default_9">[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['debit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['credit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['balance'] ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2"/>
<blockTable colWidths="56.0,197.0,94.0,110.0,107.0,85.0,77.0" style="Table2">
<tr>
<td>
<para style="terp_default_9">[[ (not data['form']['format_perc'] or not data['form']['show_columns']) and removeParentNode('blockTable') ]] [[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font color="white">[['.....'*(a['level']-1) ]]</font> <font>[[ a['name'] ]]</font></para>
</td>
<td>
<para style="terp_default_9">[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['debit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['credit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['balance'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['balance_perc'] ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
<blockTable colWidths="55.0,197.0,94.0,380.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[[ (data['form']['format_perc'] or data['form']['show_columns']) and removeParentNode('blockTable') ]] [[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font color="white">[['.....'*(a['level']-1) ]]</font><font> [[ a['name'] ]]</font></para>
</td>
<td>
<para style="terp_default_9">[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['balance'] ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
<blockTable colWidths="54.0,197.0,94.0,275.0,106.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">[[ (not data['form']['format_perc'] or data['form']['show_columns']) and removeParentNode('blockTable') ]] [[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font color="white">[['.....'*(a['level']-1) ]]</font> <font> [[ a['name'] ]]</font></para>
</td>
<td>
<para style="terp_default_9">[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['balance'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ a['balance_perc'] ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2"/>
</section>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="52.0,291.0,112.0,107.0,164.0" style="Table3">
<tr>
<td>
<para style="terp_default_9">[[ not data['form']['show_columns'] and removeParentNode('blockTable') ]] </para>
</td>
<td>
<para style="terp_tblheader_Details">Total :</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ total_dr() ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ total_cr() ]]</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="terp_default_space">
<font color="white"> </font>
</para>
<para style="terp_tblheader_Details">[[ data['form']['compare_pattern']!='none' and "C.S.Y.T.(C./P) : Compare Selected Years In Terms of Cash/Perc" or removeParentNode('font') ]]</para>
</story>
</document>

View File

@ -1,182 +0,0 @@
<?xml version="1.0"?>
<document filename="Account Balance.pdf">
<template pageSize="(1120.0,770.0)" title="Account Balance" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20" >
<pageTemplate id="first">
<frame id="first" x1="22.0" y1="31.0" width="1080" height="680"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table61">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="red"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="18" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P3" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="RIGHT"/>
<paraStyle name="P4" fontName="Helvetica" fontSize="9.0" alignment="CENTER"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="9.0" leading="12" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P8" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="P9" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P10" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P11" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P13" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="1.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<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="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="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
</stylesheet>
<story>
<blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table1">
<tr>
<td>
<para style="Table Contents">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P1">Account Balance</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="Table Contents">[[ company.name ]]</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P5">Currency: [[ company.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P8">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
<para style="P8">
<font color="white"> </font>
</para>
<section>
<para style="P13"> [[repeatIn(linesForYear(data['form']),'year_header',td=len(data['form']['fiscalyear'][0][2]),width=[126],value=['year'],type=['string']) ]]</para>
<blockTable colWidths="180.0" style="Table6">
<tr>
<td>
<para style="P1">Account Information</para>
</td>
</tr>
</blockTable>
</section>
<section>
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['Debit','Credit','Balance'],type=['lable','lable','lable']) ]]</para>
<blockTable colWidths="30.0,150.0" style="Table6">
<tr>
<td>
<para style="P1">Code</para>
</td>
<td>
<para style="P1">Account Name</para>
</td>
</tr>
</blockTable>
</section>
<section>
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[84,42],value=['Cash','%'],type=['lable','lable']) ]]</para>
<blockTable colWidths="180.0" style="Table5">
<tr>
<td>
<para style="P4"></para>
</td>
</tr>
</blockTable>
</section>
<para style="P8">
<font color="white"> </font>
</para>
<section>
<para style="P13">[[ repeatIn(lines(data['form']),'a',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['debit','credit','balance'],type=['string','string','string']) ]]</para>
<blockTable colWidths="0.0,28.0,152.0" style="Table5">
<tr>
<td>
<para style="P3"> </para>
</td>
<td>
<para style="P7">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['code'] ]]</para>
</td>
<td>
<para style="P2"><font color="white">[['.....'*(a['level']-1) ]]</font><font>[[ a['status']==1 and ( setTag('font','font',{'name':'Helvetica-bold'})) ]][[ a['name'] ]]</font></para>
</td>
</tr>
</blockTable>
</section>
<para style="P8">
<font color="white"> </font>
</para>
<section>
<para style="P13">[[ repeatIn(linesForTotal(data['form']),'total',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['sum_debit','sum_credit',''],type=['string','string','lable'] ) ]]</para>
<blockTable colWidths="180.0" style="Table6">
<tr>
<td>
<para style="P3">Total:[[ data['form']['show_columns']==0 and removeParentNode('section')]]</para>
</td>
</tr>
</blockTable>
</section>
<para style="Standard">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -1,179 +0,0 @@
<?xml version="1.0"?>
<document filename="Account Balance.pdf">
<template pageSize="(635.0,842.0)" title="Account Balance" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="15.0" y1="15.0" width="615" height="772"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table61">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="red"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="18" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0"/>
<paraStyle name="P3" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="RIGHT" />
<paraStyle name="P4" fontName="Helvetica" fontSize="9.0" alignment="CENTER"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="9.0" leading="12" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P8" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="P9" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P10" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P11" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P13" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="1.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<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="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="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
</stylesheet>
<story>
<blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table1">
<tr>
<td>
<para style="Table Contents"><font color="white"> </font></para>
</td>
<td>
<para style="P1">Account balance</para>
</td>
<td>
<para style="P3"><font color="white"> </font></para>
</td>
</tr>
<tr>
<td>
<para style="Table Contents">[[ company.name ]]</para>
</td>
<td>
<para style="P4"><font color="white"> </font></para>
</td>
<td>
<para style="P5">Currency: [[ company.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P8">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
<para style="P8">
<font color="white"> </font>
</para>
<section>
<para style="P13"> [[repeatIn(linesForYear(data['form']),'year_header',td=len(data['form']['fiscalyear'][0][2]),width=[126],value=['year'],type=['string']) ]]</para>
<blockTable colWidths="190.0" style="Table6">
<tr>
<td>
<para style="P1">Account Information</para>
</td>
</tr>
</blockTable>
</section>
<section>
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['Debit','Credit','Balance'],type=['lable','lable','lable']) ]]</para>
<blockTable colWidths="30.0,160.0" style="Table6">
<tr>
<td>
<para style="P1">Code</para>
</td>
<td>
<para style="P1">Account Name</para>
</td>
</tr>
</blockTable>
</section>
<section>
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[84,42],value=['Cash','%'],type=['lable','lable']) ]]</para>
<blockTable colWidths="190.0" style="Table5">
<tr>
<td>
<para style="P4"><font color="white"> </font></para>
</td>
</tr>
</blockTable>
</section>
<para style="P8">
<font color="white"> </font>
</para>
<section>
<para style="P13">[[ repeatIn(lines(data['form']),'a',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['debit','credit','balance'],type=['string','string','string']) ]]</para>
<condPageBreak height="2cm"/>
<blockTable colWidths="0.0,28.0,162.0" style="Table5">
<tr>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P7">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['code'] ]]</para>
</td>
<td>
<para style="P2"><font color="white">[['.....'*(a['level']-1) ]]</font><font>[[ a['status']==1 and ( setTag('font','font',{'name':'Helvetica-bold'})) ]][[ a['name'] ]]</font></para>
</td>
</tr>
</blockTable>
</section>
<para style="P8">
<font color="white"> </font>
</para>
<section>
<para style="P13">[[ repeatIn(linesForTotal(data['form']),'total',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['sum_debit','sum_credit',''],type=['string','string','lable'] ) ]]</para>
<blockTable colWidths="190.0" style="Table6">
<tr>
<td>
<para style="P3">Total:[[ data['form']['show_columns']==0 and removeParentNode('section')]]</para>
</td>
</tr>
</blockTable>
</section>
<para style="Standard">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -1,224 +0,0 @@
# -*- 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 time
import pooler
from report import report_sxw
from account.report import account_profit_loss
from common_report_header import common_report_header
from tools.translate import _
class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context=context)
self.obj_pl = account_profit_loss.report_pl_account_horizontal(cr, uid, name, context=context)
self.result_sum_dr = 0.0
self.result_sum_cr = 0.0
self.result = {}
self.res_bl = {}
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,
'get_fiscalyear': self._get_fiscalyear,
'get_account': self._get_account,
'get_start_period': self.get_start_period,
'get_end_period': self.get_end_period,
'get_sortby': self._get_sortby,
'get_filter': self._get_filter,
'get_journal': self._get_journal,
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
'get_company':self._get_company,
'get_target_move': self._get_target_move,
})
self.context = context
def set_context(self, objects, data, ids, report_type=None):
new_ids = ids
if (data['model'] == 'ir.ui.menu'):
new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
return super(report_balancesheet_horizontal, self).set_context(objects, data, new_ids, report_type=report_type)
def sum_dr(self):
if self.res_bl['type'] == _('Net Profit'):
self.result_sum_dr += self.res_bl['balance']*-1
return self.result_sum_dr
def sum_cr(self):
if self.res_bl['type'] == _('Net Loss'):
self.result_sum_cr += self.res_bl['balance']
return self.result_sum_cr
def get_pl_balance(self):
return self.res_bl
def get_data(self,data):
cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
#Getting Profit or Loss Balance from profit and Loss report
self.obj_pl.get_data(data)
self.res_bl = self.obj_pl.final_result()
account_pool = db_pool.get('account.account')
currency_pool = db_pool.get('res.currency')
types = [
'liability',
'asset'
]
ctx = self.context.copy()
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
if data['form']['filter'] == 'filter_period':
ctx['period_from'] = data['form'].get('period_from', False)
ctx['period_to'] = data['form'].get('period_to', False)
elif data['form']['filter'] == 'filter_date':
ctx['date_from'] = data['form'].get('date_from', False)
ctx['date_to'] = data['form'].get('date_to', False)
ctx['state'] = data['form'].get('target_move', 'all')
cal_list = {}
pl_dict = {}
account_dict = {}
account_id = data['form'].get('chart_account_id', False)
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 not self.res_bl:
self.res_bl['type'] = _('Net Profit')
self.res_bl['balance'] = 0.0
if self.res_bl['type'] == _('Net Profit'):
self.res_bl['type'] = _('Net Profit')
else:
self.res_bl['type'] = _('Net Loss')
pl_dict = {
'code': self.res_bl['type'],
'name': self.res_bl['type'],
'level': False,
'balance':self.res_bl['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 != 0 and account.balance * account.user_type.sign or account.balance,
'type': account.type,
}
currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += account.balance
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += account.balance
if data['form']['display_account'] == 'movement':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.credit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.debit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account_dict)
elif data['form']['display_account'] == 'not_zero':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account_dict)
else:
accounts_temp.append(account_dict)
if account.id == data['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={
'type': cal_list['liability'][i]['type'],
'code': cal_list['liability'][i]['code'],
'name': cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'],
'type1': cal_list['asset'][i]['type'],
'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={
'type': '',
'code': '',
'name': '',
'level': False,
'balance':False,
'type1': cal_list['asset'][i]['type'],
'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={
'type': cal_list['liability'][i]['type'],
'code': cal_list['liability'][i]['code'],
'name': cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'],
'type1': '',
'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, [])
report_sxw.report_sxw('report.account.balancesheet.horizontal', 'account.account',
'addons/account/report/account_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
header='internal landscape')
report_sxw.report_sxw('report.account.balancesheet', 'account.account',
'addons/account/report/account_balance_sheet.rml',parser=report_balancesheet_horizontal,
header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,303 +0,0 @@
<?xml version="1.0"?>
<document filename="Balance Sheet.pdf">
<template pageSize="(595.0,842.0)" title="Balance Sheet" author="OpenERP S.A.(sales@openerp.com)" 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="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
</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="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,1" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/>
<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="LINEAFTER" 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"/>
<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="LINEAFTER" 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"/>
</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="-1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="-1,-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_Left" 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"/>
<paraStyle name="terp_level_1_code" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_name" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_balance" fontName="Helvetica-Bold" fontSize="9.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_code" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_name" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_balance" fontName="Helvetica-Bold" fontSize="8.0" leftIndent=".0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_code" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_code_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name" fontName="Helvetica" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name" fontName="Helvetica" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<blockTableStyle id="Table1">
<blockTopPadding start="0,0" stop="-1,0" length="15"/>
<blockFont name="Helvetica-Bold" size="10.0" />
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,1" thickness="1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockTopPadding start="0,0" stop="-1,0" length="10"/>
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBELOW" colorName="#666666" start="1,1" stop="1,1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockValign value="TOP"/>
</blockTableStyle>
</stylesheet>
<images/>
<story>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="539.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Centre">Balance Sheet</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">[[ get_data(data) or removeParentNode('para') ]]</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="120.0,100.0,140.0,90.0,90.0" style="Table2_header" >
<tr>
<td><para style="terp_tblheader_General_Centre">Chart of Accounts</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Display Account</para></td>
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] </para>
<blockTable colWidths="60.0,60.0" style="Table3">[[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_Details_Centre">Start Date</para></td>
<td><para style="terp_tblheader_Details_Centre">End Date</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ formatLang(get_start_date(data),date=True) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para></td>
</tr>
</blockTable>
<blockTable colWidths="65.0,60.0" style="Table3">[[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_Details_Centre">Start Period</para></td>
<td><para style="terp_tblheader_Details_Centre">End Period</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td>
</tr>
</blockTable>
</td>
<td><para style="terp_default_Centre_8">[[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="539.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Left">Assets</para>
</td>
</tr>
</blockTable>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<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">Account</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
</tr>
<tr style="Table3">
[[ repeatIn(get_lines_another('asset'),'a' ) ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]]
<td><para style="terp_level_3_code">[[ (a['type'] =='view' and a['level'] &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]]<i>[[ a['code'] ]]</i></para></td>
<td><para style="terp_level_3_name">[[ (a['type'] =='view' and a['level'] &gt;= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]]</para></td>
<td>[[ (a['level'] &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a['type'] =='view' and a['level'] &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</para></td>
<td>[[ a['level'] == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</u></para></td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Balance:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr(), currency_obj = company.currency_id) ]]</u></para>
</td>
</tr>
</blockTable>
<condPageBreak height="20cm"/>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="539.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Left">Liabilities</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">Account</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
</tr>
<tr style="Table3">
[[ repeatIn(get_lines_another('liability'),'a' ) ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]]
<td><para style="terp_level_3_code">[[ (a['type'] =='view' and a['level'] &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]]<i>[[ a['code'] ]]</i></para></td>
<td><para style="terp_level_3_name">[[ (a['type'] =='view' and a['level'] &gt;= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]]</para></td>
<td>[[ (a['level'] &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a['type'] =='view' and a['level'] &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</para></td>
<td>[[ a['level'] == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</u></para></td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Balance:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr(), currency_obj = company.currency_id) ]]</u></para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -1,250 +0,0 @@
<?xml version="1.0"?>
<document filename="Balance Sheet.pdf">
<template pageSize="(842.0,595.0)" title="Balance Sheet" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="57.0" width="772" height="481"/>
</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="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,1" stop="-1,-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="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/>
<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="LINEAFTER" 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"/>
<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="LINEAFTER" 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"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-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="9.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="10" alignment="CENTER" spaceBefore="6.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="terp_header_Centre">Balance Sheet</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">[[ get_data(data) or removeParentNode('para') ]]</para>
<blockTable colWidths="250.0,100.0,150.0,120.0,150.0" style="Table2_header" >
<tr>
<td><para style="terp_tblheader_General_Centre">Chart of Accounts</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Display Account</para></td>
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] </para>
<blockTable colWidths="70.0,70.0" style="Table3">[[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_Details_Centre">Start Date</para></td>
<td><para style="terp_tblheader_Details_Centre">End Date</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ formatLang(get_start_date(data),date=True) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para></td>
</tr>
</blockTable>
<blockTable colWidths="70.0,70.0" style="Table3">[[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_Details_Centre">Start Period</para></td>
<td><para style="terp_tblheader_Details_Centre">End Period</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td>
</tr>
</blockTable>
</td>
<td><para style="terp_default_Centre_8">[[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]]</para></td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="80.0,210.16,100.32,80.0,210.16,100.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">Assets</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
<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">Balance</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">
<font>[[ repeatIn(get_lines(),'a' ) ]] </font>[[ a['code1'] ]]<font>[[ a['level1']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]]</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'})) or removeParentNode('font') ]][[ a['name1'] ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font>[[ a['level1']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]]</font><font>[[ formatLang(a['balance1'], currency_obj=company.currency_id) ]]</font>
</para>
</td>
<td>
<para style="terp_default_9">
[[ a['code'] ]]<font>[[ ( a['level']&lt;4 or a['name']=='Net Profit') and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]]</font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white">[[ '. '*(a['level']-1) ]]</font>
<font>[[ ( a['level']&lt;4 or a['name']=='Net Profit') and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name'] ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font>[[ ( a['level']&lt;4 or a['name']=='Net Profit') and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]]</font>
<font>[[(a['code'] and a['name']) and formatLang(a['balance'], currency_obj=company.currency_id) or removeParentNode('font')]]</font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="290.16,100.32,290.16,100.32" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Balance:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr(), currency_obj=company.currency_id) ]]</u></para>
</td>
<td>
<para style="terp_default_Bold_9">Balance:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr(), currency_obj=company.currency_id) ]]</u></para>
</td>
</tr>
</blockTable>
</story>
</document>

View File

@ -64,29 +64,30 @@ class report_account_common(report_sxw.rml_parse, common_report_header):
vals['balance_cmp'] = self.pool.get('account.financial.report').browse(self.cr, self.uid, report.id, context=data['form']['comparison_context']).balance vals['balance_cmp'] = self.pool.get('account.financial.report').browse(self.cr, self.uid, report.id, context=data['form']['comparison_context']).balance
lines.append(vals) lines.append(vals)
account_ids = [] account_ids = []
if report.type == 'accounts' and report.display_detail and report.account_ids: if report.type == 'accounts' and report.account_ids:
account_ids = account_obj._get_children_and_consol(self.cr, self.uid, [x.id for x in report.account_ids]) account_ids = account_obj._get_children_and_consol(self.cr, self.uid, [x.id for x in report.account_ids])
elif report.type == 'account_type' and report.account_type_ids: elif report.type == 'account_type' and report.account_type_ids:
account_ids = account_obj.search(self.cr, self.uid, [('user_type','in', [x.id for x in report.account_type_ids])]) account_ids = account_obj.search(self.cr, self.uid, [('user_type','in', [x.id for x in report.account_type_ids])])
if account_ids: if account_ids:
for account in account_obj.browse(self.cr, self.uid, account_ids, context=data['form']['used_context']): for account in account_obj.browse(self.cr, self.uid, account_ids, context=data['form']['used_context']):
if account.type != 'view': if report.display_detail == 'detail_flat' and account.type == 'view':
flag = False continue
vals = { flag = False
'name': account.code + ' ' + account.name, vals = {
'balance': account.balance != 0 and account.balance * account.user_type.sign or account.balance, 'name': account.code + ' ' + account.name,
'type': 'account', 'balance': account.balance != 0 and account.balance * report.sign or account.balance,
'level': 6, 'type': 'account',
'account_type': account.type, 'level': report.display_detail == 'detail_with_hierarchy' and min(account.level,6) or 6,
} 'account_type': account.type,
if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance']): }
if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance']):
flag = True
if data['form']['enable_filter']:
vals['balance_cmp'] = account_obj.browse(self.cr, self.uid, account.id, context=data['form']['comparison_context']).balance
if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance_cmp']):
flag = True flag = True
if data['form']['enable_filter']: if flag:
vals['balance_cmp'] = account_obj.browse(self.cr, self.uid, account.id, context=data['form']['comparison_context']).balance lines.append(vals)
if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance_cmp']):
flag = True
if flag:
lines.append(vals)
return lines return lines
report_sxw.report_sxw('report.account.financial.report', 'account.financial.report', report_sxw.report_sxw('report.account.financial.report', 'account.financial.report',

View File

@ -130,15 +130,13 @@
<paraStyle name="terp_level_1_name" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_1_name" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_balance" fontName="Helvetica-Bold" fontSize="9.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_1_balance" fontName="Helvetica-Bold" fontSize="9.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_name" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_2_name" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_balance" fontName="Helvetica-Bold" fontSize="8.0" leftIndent=".0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_2_balance" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_3_name" fontName="Helvetica" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance" fontName="Helvetica-Bold" fontSize="8.0" leftIndent=".0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_3_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name" fontName="Helvetica" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_4_name" fontName="Helvetica" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_balance" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_level_4_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_5_name" fontName="Helvetica" fontSize="8.0" leftIndent="40.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_5_balance" fontName="Helvetica-Oblique" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_6_name" fontName="Helvetica" fontSize="8.0" leftIndent="50.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_6_balance" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<blockTableStyle id="Table1"> <blockTableStyle id="Table1">
<blockTopPadding start="0,0" stop="-1,0" length="15"/> <blockTopPadding start="0,0" stop="-1,0" length="15"/>
@ -229,13 +227,13 @@
<para style="terp_tblheader_Details_Right">Balance</para> <para style="terp_tblheader_Details_Right">Balance</para>
</td> </td>
</tr> </tr>
<tr style="Table1"> <tr style="Table3">
[[ repeatIn(get_lines(data), 'a') ]] [[ repeatIn(get_lines(data), 'a') ]]
[[ (a.get('level') &lt;&gt; 0) or removeParentNode('tr') ]] [[ (a.get('level') &lt;&gt; 0) or removeParentNode('tr') ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]] [[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]]
<td><para style="terp_level_1_name">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_name'}) ]] [[ a.get('name') ]]</para></td> <td><para style="terp_level_3_name">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level')))+'_name'}) ]][[ a.get('name') ]]</para></td>
<td>[[ a.get('level') == 4 or removeParentNode('td') ]]<para style="terp_level_1_balance"><u>[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]]</u></para></td> <td>[[ (a.get('level') &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</para></td>
<td>[[ a.get('level') &lt;&gt; 4 or removeParentNode('td') ]]<para style="terp_level_1_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]]</para></td> <td>[[ a.get('level') == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</u></para></td>
</tr> </tr>
</blockTable> </blockTable>
<para style="Standard"> <para style="Standard">
@ -258,11 +256,11 @@
[[ repeatIn(get_lines(data), 'a') ]] [[ repeatIn(get_lines(data), 'a') ]]
[[ (a.get('level') &lt;&gt; 0) or removeParentNode('tr') ]] [[ (a.get('level') &lt;&gt; 0) or removeParentNode('tr') ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]] [[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]]
<td><para style="terp_level_1_name">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_name'}) ]] [[ a.get('name') ]]</para></td> <td><para style="terp_level_3_name">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level')))+'_name'}) ]][[ a.get('name') ]]</para></td>
<td>[[ a.get('level') == 4 or removeParentNode('td') ]]<para style="terp_level_1_balance"><u>[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]]</u></para></td> <td>[[ (a.get('level') &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</para></td>
<td>[[ a.get('level') &lt;&gt; 4 or removeParentNode('td') ]]<para style="terp_level_1_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]]</para></td> <td>[[ a.get('level') == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</u></para></td>
<td>[[ a.get('level') == 4 or removeParentNode('td') ]]<para style="terp_level_1_balance"><u>[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'))]] [[company.currency_id.symbol]]</u></para></td> <td>[[ (a.get('level') &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]]</para></td>
<td>[[ a.get('level') &lt;&gt; 4 or removeParentNode('td') ]]<para style="terp_level_1_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'))]] [[company.currency_id.symbol]]</para></td> <td>[[ a.get('level') == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]]</u></para></td>
</tr> </tr>
</blockTable> </blockTable>
<para style="Standard"> <para style="Standard">

View File

@ -1,282 +0,0 @@
<?xml version="1.0"?>
<document filename="Profit and Loss.pdf">
<template pageSize="(842.0,595.0)" title="Profit And Loss" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="57.0" width="772" height="481"/>
</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="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,1" stop="-1,-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="Table3">
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_Net_Profit_Loss">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,-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>
<blockTableStyle id="Table2_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/>
<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="LINEAFTER" 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"/>
<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="LINEAFTER" 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"/>
</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>
<blockTable colWidths="539.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Centre">Profit And Loss</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P2">[[ get_data(data) or removeParentNode('para')]]</para>
<blockTable colWidths="250.0,100.0,150.0,120.0,150.0" style="Table2_header">
<tr>
<td><para style="terp_tblheader_General_Centre">Chart of Accounts</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Display Account</para></td>
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] </para>
<blockTable colWidths="70.0,70.0" style="Table3">[[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_General_Centre">Start Date</para></td>
<td><para style="terp_tblheader_General_Centre">End Date</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ formatLang(get_start_date(data),date=True) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para></td>
</tr>
</blockTable>
<blockTable colWidths="70.0,70.0" style="Table3">[[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_General_Centre">Start Period</para></td>
<td><para style="terp_tblheader_General_Centre">End Period</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td>
</tr>
</blockTable>
</td>
<td><para style="terp_default_Centre_8">[[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]]</para></td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="80.0,210.16,100.32,80.0,210.16,100.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">Expenses</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
<td>
<para style="terp_default_Bold_9">Code</para>
</td>
<td>
<para style="terp_default_Bold_9">Income</para>
</td>
<td>
<para style="P1">Balance</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">
<font>[[ repeatIn(get_lines(),'a' ) ]] </font>[[ a['code'] ]]<font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]]</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'})) or removeParentNode('font') ]][[ a['name'] ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]]</font><font>[[ formatLang(abs(a['balance']), currency_obj=company.currency_id) ]]</font></para>
</td>
<td>
<para style="terp_default_9">
[[ a['code1'] ]]<font>[[ a['level1']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]]</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'})) or removeParentNode('font') ]][[ a['name1'] ]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]]</font><font>[[(a['code1'] and a['name1']) and formatLang(abs(a['balance1']), currency_obj=company.currency_id) or removeParentNode('font') ]]</font></para>
</td>
</tr>
</blockTable>
<blockTable colWidths="80.0,210.16,100.32,80.0,210.16,100.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' and final_result()['type'] or '' ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(abs(final_result()['balance']), currency_obj=company.currency_id) ]]</para>
</td>
<td>
<para style="terp_default_Bold_9"></para>
</td>
<td>
<para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Loss' and final_result()['type'] or '' ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(abs(final_result()['balance']), currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="290.16,100.32,290.16,100.32" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Total:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr()), currency_obj=company.currency_id) ]]</u></para>
</td>
<td>
<para style="terp_default_Bold_9">Total:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr()), currency_obj=company.currency_id) ]]</u></para>
</td>
</tr>
</blockTable>
</story>
</document>

View File

@ -1,198 +0,0 @@
##############################################################################
#
# 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 time
import pooler
from report import report_sxw
from common_report_header import common_report_header
from tools.translate import _
class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
super(report_pl_account_horizontal, self).__init__(cr, uid, name, context=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_currency': self._get_currency,
'get_data': self.get_data,
'sum_dr': self.sum_dr,
'sum_cr': self.sum_cr,
'final_result': self.final_result,
'get_fiscalyear': self._get_fiscalyear,
'get_account': self._get_account,
'get_start_period': self.get_start_period,
'get_end_period': self.get_end_period,
'get_sortby': self._get_sortby,
'get_filter': self._get_filter,
'get_journal': self._get_journal,
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
'get_company':self._get_company,
'get_target_move': self._get_target_move,
})
self.context = context
def set_context(self, objects, data, ids, report_type=None):
new_ids = ids
if (data['model'] == 'ir.ui.menu'):
new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
return super(report_pl_account_horizontal, self).set_context(objects, data, new_ids, report_type=report_type)
def final_result(self):
return self.res_pl
def sum_dr(self):
if self.res_pl['type'] == _('Net Profit'):
self.result_sum_dr += self.res_pl['balance']
return self.result_sum_dr
def sum_cr(self):
if self.res_pl['type'] == _('Net Loss'):
self.result_sum_cr += self.res_pl['balance']
return self.result_sum_cr
def get_data(self, data):
cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
account_pool = db_pool.get('account.account')
currency_pool = db_pool.get('res.currency')
types = [
'expense',
'income'
]
ctx = self.context.copy()
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
if data['form']['filter'] == 'filter_period':
ctx['period_from'] = data['form'].get('period_from', False)
ctx['period_to'] = data['form'].get('period_to', False)
elif data['form']['filter'] == 'filter_date':
ctx['date_from'] = data['form'].get('date_from', False)
ctx['date_to'] = data['form'].get('date_to', False)
cal_list = {}
account_id = data['form'].get('chart_account_id', False)
company_currency = account_pool.browse(self.cr, self.uid, account_id).company_id.currency_id
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):
currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += account.debit - account.credit
if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += account.credit - account.debit
if data['form']['display_account'] == 'movement':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.credit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.debit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account)
elif data['form']['display_account'] == 'not_zero':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account)
else:
accounts_temp.append(account)
if currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)):
self.res_pl['type'] = None
self.res_pl['balance'] = 0.0
elif self.result_sum_dr > self.result_sum_cr:
self.res_pl['type'] = _('Net Loss')
self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
else:
self.res_pl['type'] = _('Net Profit')
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 != 0 and \
cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign or \
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 != 0 and \
cal_list['income'][i].balance * cal_list['income'][i].user_type.sign or \
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 != 0 and \
cal_list['income'][i].balance * cal_list['income'][i].user_type.sign \
or 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 != 0 and \
cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign \
or 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, [])
report_sxw.report_sxw('report.pl.account.horizontal', 'account.account',
'addons/account/report/account_profit_horizontal.rml',parser=report_pl_account_horizontal, header='internal landscape')
report_sxw.report_sxw('report.pl.account', 'account.account',
'addons/account/report/account_profit_loss.rml',parser=report_pl_account_horizontal, header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,314 +0,0 @@
<?xml version="1.0"?>
<document filename="Profit and Loss.pdf">
<template pageSize="(595.0,842.0)" title="Profit and Loss" author="OpenERP S.A. (sales@openerp.com)" 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="MIDDLE"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-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="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,-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>
<blockTableStyle id="Table2_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/>
<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="LINEAFTER" 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"/>
<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="LINEAFTER" 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"/>
</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"/>
<paraStyle name="terp_level_1_code" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_name" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_balance" fontName="Helvetica-Bold" fontSize="9.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_code" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_name" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_balance" fontName="Helvetica-Bold" fontSize="8.0" leftIndent=".0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_code" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_code_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name" fontName="Helvetica" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name" fontName="Helvetica" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<blockTableStyle id="Table1">
<blockTopPadding start="0,0" stop="-1,0" length="15"/>
<blockFont name="Helvetica-Bold" size="10.0" />
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,1" thickness="1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockTopPadding start="0,0" stop="-1,0" length="10"/>
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBELOW" colorName="#666666" start="1,1" stop="1,1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockValign value="TOP"/>
</blockTableStyle>
</stylesheet>
<images/>
<story>
<blockTable colWidths="539.0" style="Table_Company_Name">
<tr>
<td>
<para style="terp_header_Centre">Profit And Loss</para>
</td>
</tr>
</blockTable>
<para style="P2">[[ get_data(data) or removeParentNode('para')]]</para>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="125.0,100.0,140.0,80.0,90.0" style="Table2_header">
<tr>
<td><para style="terp_tblheader_General_Centre">Chart of Accounts</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Display Account</para></td>
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] </para>
<blockTable colWidths="60.0,60.0" style="Table3">[[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_General_Centre">Start Date</para></td>
<td><para style="terp_tblheader_General_Centre">End Date</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ formatLang(get_start_date(data),date=True) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para></td>
</tr>
</blockTable>
<blockTable colWidths="65.0,60.0" style="Table3">[[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_General_Centre">Start Period</para></td>
<td><para style="terp_tblheader_General_Centre">End Period</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td>
</tr>
</blockTable>
</td>
<td><para style="terp_default_Centre_8">[[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="terp_header">Expenses</para>
<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">Account</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
</tr>
<tr style="Table3">
[[ repeatIn(get_lines_another('expense'),'a' ) ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
<td><para style="terp_level_3_code">[[ (a.type =='view' and a.level &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]]<i>[[ a.code ]]</i></para></td>
<td><para style="terp_level_3_name">[[ (a.type =='view' and a.level &gt;= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]]</para></td>
<td>[[ (a.level &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]]</para></td>
<td>[[ a.level == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]]</u></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' and final_result()['type'] or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(final_result()['balance'], currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
<tr>
<td>
<para style="terp_default_Bold_9">Total:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr(), currency_obj=company.currency_id) ]]</u></para>
</td>
</tr>
</blockTable>
<condPageBreak height="20cm"/>
<para style="terp_default_Right_9_Bold">
<font color="white"> </font>
</para>
<para style="terp_header">Incomes</para>
<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">Account</para>
</td>
<td>
<para style="P1">Balance</para>
</td>
</tr>
<tr style="Table3">
[[ repeatIn(get_lines_another('income'),'a' ) ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
<td><para style="terp_level_3_code">[[ (a.type =='view' and a.level &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]]<i>[[ a.code ]]</i></para></td>
<td><para style="terp_level_3_name">[[ (a.type =='view' and a.level &gt;= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]]</para></td>
<td>[[ (a.level &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level &gt;= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]]</para></td>
<td>[[ a.level == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]]</u></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' and final_result()['type'] or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(final_result()['balance'], currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="426.0,113.0" style="Table4">
<tr>
<td>
<para style="terp_default_Bold_9">Total:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr(), currency_obj=company.currency_id) ]]</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>

View File

@ -37,24 +37,15 @@
data_dict = {'chart_account_id':ref('account.chart0')} data_dict = {'chart_account_id':ref('account.chart0')}
from tools import test_reports from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account') test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account')
-
Print the Account Balance Sheet in Horizontal mode
-
!python {model: account.account}: |
ctx={}
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account')
- -
Print the Account Balance Sheet in Normal mode Print the Account Balance Sheet in Normal mode
- -
!python {model: account.account}: | !python {model: account.account}: |
ctx={} ctx={}
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]}) ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False} data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False, 'account_report_id': ref('account_financial_report_balancesheet0')}
from tools import test_reports from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account') test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
- -
Print the Account Balance Report in Normal mode through the wizard - From Account Chart Print the Account Balance Report in Normal mode through the wizard - From Account Chart
- -
@ -147,18 +138,9 @@
!python {model: account.account}: | !python {model: account.account}: |
ctx={} ctx={}
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]}) ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False,'target_move': 'all'} data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False,'target_move': 'all', 'account_report_id': ref('account_financial_report_balancesheet0')}
from tools import test_reports from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account') test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
-
Print the Profit-Loss Report in Horizontal Mode
-
!python {model: account.account}: |
ctx={}
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True,'target_move': 'all'}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
- -
Print the Analytic Balance Report through the wizard Print the Analytic Balance Report through the wizard
- -

View File

@ -64,8 +64,6 @@ import account_report_account_balance
import account_change_currency import account_change_currency
import account_report_balance_sheet
import account_report_profit_loss
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -38,9 +38,19 @@ class accounting_report(osv.osv_memory):
'date_to_cmp': fields.date("End Date"), 'date_to_cmp': fields.date("End Date"),
} }
def _get_account_report(self, cr, uid, context=None):
menu_obj = self.pool.get('ir.ui.menu')
report_obj = self.pool.get('account.financial.report')
report_ids = []
if context.get('active_id'):
menu = menu_obj.browse(cr, uid, context.get('active_id')).name
report_ids = report_obj.search(cr, uid, [('name','ilike',menu)])
return report_ids and report_ids[0] or False
_defaults = { _defaults = {
'filter_cmp': 'filter_no', 'filter_cmp': 'filter_no',
'target_move': 'posted', 'target_move': 'posted',
'account_report_id': _get_account_report,
} }
def _build_comparison_context(self, cr, uid, ids, data, context=None): def _build_comparison_context(self, cr, uid, ids, data, context=None):

View File

@ -40,6 +40,24 @@
<field name="target">new</field> <field name="target">new</field>
</record> </record>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"
name="Accounting Reports"/>
<menuitem icon="STOCK_PRINT"
name="Profit And Loss"
action="account.action_account_report"
id="menu_account_pl_report"
parent="final_accounting_reports"/>
<menuitem icon="STOCK_PRINT"
name="Balance Sheet"
action="account.action_account_report"
groups="group_account_user,group_account_manager"
id="menu_account_bs_report"
parent="final_accounting_reports"/>
<menuitem icon="STOCK_PRINT" <menuitem icon="STOCK_PRINT"
name="Financial Report" name="Financial Report"
action="action_account_report" action="action_account_report"

View File

@ -1,85 +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/>.
#
##############################################################################
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'
_inherit = "account.common.account.report"
_description = 'Account Balance Sheet Report'
def _get_def_reserve_account(self, cr, uid, context=None):
chart_id = self._get_account(cr, uid, context=context)
res = self.onchange_chart_id(cr, uid, [], chart_id, context=context)
if not res:
return False
return res['value']['reserve_account_id']
_columns = {
'display_type': fields.boolean("Landscape Mode"),
'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',
help='This account is used for transferring Profit/Loss (If It is Profit: Amount will be added, Loss : Amount will be deducted.), as calculated in Profit & Loss Report',
domain = [('type','=','other')]),
'journal_ids': fields.many2many('account.journal', 'account_bs_report_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults={
'display_type': False,
'journal_ids': [],
'reserve_account_id': _get_def_reserve_account,
}
def onchange_chart_id(self, cr, uid, ids, chart_id, context=None):
if not chart_id:
return {}
account = self.pool.get('account.account').browse(cr, uid, chart_id , context=context)
if not account.company_id.property_reserve_and_surplus_account:
return {'value': {'reserve_account_id': False}}
return {'value': {'reserve_account_id': account.company_id.property_reserve_and_surplus_account.id}}
def _print_report(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0])
if not data['form']['reserve_account_id']:
raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
data = self.pre_print_report(cr, uid, ids, data, context=context)
if data['form']['display_type']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet.horizontal',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet',
'datas': data,
}
account_bs_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_bs_report_view" model="ir.ui.view">
<field name="name">Account Balance Sheet</field>
<field name="model">account.bs.report</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.account_common_report_view" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='chart_account_id']" position="replace">
<field name="chart_account_id" widget="selection" on_change="onchange_chart_id(chart_account_id)"/>
</xpath>
<xpath expr="//field[@name='journal_ids']" position="replace">
<field name="journal_ids" colspan="4" nolabel="1" required="0" readonly="1"/>
</xpath>
<xpath expr="/form/label[@string='']" position="replace">
<separator string="Balance Sheet" colspan="4"/>
<label nolabel="1" colspan="4" string="This report allows you to print or generate a pdf of your trial balance allowing you to quickly check the balance of each of your accounts in a single report"/>
</xpath>
<xpath expr="//field[@name='target_move']" position="after">
<field name="display_account"/>
<field name="reserve_account_id"/>
<field name="display_type"/>
<newline/>
</xpath>
</data>
</field>
</record>
<record id="action_account_bs_report" model="ir.actions.act_window">
<field name="name">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>
<menuitem icon="STOCK_PRINT"
name="Balance Sheet"
action="action_account_bs_report"
groups="group_account_user,group_account_manager"
id="menu_account_bs_report"
parent="final_accounting_reports"/>
</data>
</openerp>

View File

@ -1,62 +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/>.
#
##############################################################################
from osv import osv, fields
class account_pl_report(osv.osv_memory):
"""
This wizard will provide the account profit and loss report by periods, between any two dates.
"""
_inherit = "account.common.account.report"
_name = "account.pl.report"
_description = "Account Profit And Loss Report"
_columns = {
'display_type': fields.boolean("Landscape Mode"),
'journal_ids': fields.many2many('account.journal', 'account_pl_report_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
'display_type': False,
'journal_ids': [],
}
def _print_report(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
data = self.pre_print_report(cr, uid, ids, data, context=context)
data['form'].update(self.read(cr, uid, ids, ['display_type'])[0])
if data['form']['display_type']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'pl.account.horizontal',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'pl.account',
'datas': data,
}
account_pl_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_pl_report_view" model="ir.ui.view">
<field name="name">Profit and Loss</field>
<field name="model">account.pl.report</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.account_common_report_view" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='journal_ids']" position="replace">
<field name="journal_ids" required="0" colspan="4" nolabel="1" readonly="1"/>
</xpath>
<xpath expr="/form/label[@string='']" position="replace">
<separator string="Profit And Loss" colspan="4"/>
<label nolabel="1" colspan="4" string="The Profit and Loss report gives you an overview of your company profit and loss in a single document"/>
</xpath>
<xpath expr="//field[@name='fiscalyear_id']" position="after">
<field name="display_account"/>
<field name="display_type"/>
</xpath>
</data>
</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>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"
name="Accounting Reports"/>
<menuitem icon="STOCK_PRINT"
name="Profit And Loss"
action="action_account_pl_report"
id="menu_account_pl_report"
parent="final_accounting_reports"/>
</data>
</openerp>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -68,7 +68,7 @@ class account_followup_stat(osv.osv):
cr.execute(""" cr.execute("""
create or replace view account_followup_stat as ( create or replace view account_followup_stat as (
SELECT SELECT
l.id as id, l.partner_id AS id,
l.partner_id AS partner_id, l.partner_id AS partner_id,
min(l.date) AS date_move, min(l.date) AS date_move,
max(l.date) AS date_move_last, max(l.date) AS date_move_last,

View File

@ -93,7 +93,7 @@ class account_followup_stat_by_partner(osv.osv):
cr.execute(""" cr.execute("""
create or replace view account_followup_stat_by_partner as ( create or replace view account_followup_stat_by_partner as (
SELECT SELECT
l.partner_id * 10000 + l.company_id as id, l.partner_id AS id,
l.partner_id AS partner_id, l.partner_id AS partner_id,
min(l.date) AS date_move, min(l.date) AS date_move,
max(l.date) AS date_move_last, max(l.date) AS date_move_last,

View File

@ -91,10 +91,10 @@ class account_voucher(osv.osv):
return False return False
def _get_payment_rate_currency(self, cr, uid, context=None): def _get_payment_rate_currency(self, cr, uid, context=None):
''' """
Return the default value for field payment_rate_currency_id: the currency of the journal Return the default value for field payment_rate_currency_id: the currency of the journal
if there is one, otherwise the currency of the user's company if there is one, otherwise the currency of the user's company
''' """
if context is None: context = {} if context is None: context = {}
journal_pool = self.pool.get('account.journal') journal_pool = self.pool.get('account.journal')
journal_id = context.get('journal_id', False) journal_id = context.get('journal_id', False)
@ -141,20 +141,22 @@ class account_voucher(osv.osv):
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
mod_obj = self.pool.get('ir.model.data') mod_obj = self.pool.get('ir.model.data')
if context is None: context = {} if context is None: context = {}
if not view_id and context.get('invoice_type', False):
if context.get('invoice_type', False) in ('out_invoice', 'out_refund'): if view_type == 'form':
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') if not view_id and context.get('invoice_type'):
else: if context.get('invoice_type') in ('out_invoice', 'out_refund'):
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
result = result and result[1] or False else:
view_id = result result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
if not view_id and view_type == 'form' and context.get('line_type', False): result = result and result[1] or False
if context.get('line_type', False) == 'customer': view_id = result
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') if not view_id and context.get('line_type'):
else: if context.get('line_type') == 'customer':
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
result = result and result[1] or False else:
view_id = result result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
result = result and result[1] or False
view_id = result
res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
doc = etree.XML(res['arch']) doc = etree.XML(res['arch'])

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -51,7 +51,7 @@
name: "cash account in usd" name: "cash account in usd"
code: "Xcash usd" code: "Xcash usd"
type: 'liquidity' type: 'liquidity'
user_type: "account.account_type_cash_moves" user_type: "account.data_account_type_cash"
- -
I create a bank journal with USD as currency I create a bank journal with USD as currency

View File

@ -46,7 +46,7 @@
name: "cash account in chf" name: "cash account in chf"
code: "Xcash chf" code: "Xcash chf"
type: 'liquidity' type: 'liquidity'
user_type: "account.account_type_cash_moves" user_type: "account.data_account_type_cash"
- -
I create a bank journal with CHF as currency I create a bank journal with CHF as currency

View File

@ -205,6 +205,7 @@
<group col="2" colspan="1"> <group col="2" colspan="1">
<group col="4" colspan="1" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}"> <group col="4" colspan="1" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
<separator string="Currency Options" colspan="4"/> <separator string="Currency Options" colspan="4"/>
<field name="is_multi_currency" invisible="1"/>
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/> <field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/> <field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" invisible="1"/> <field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" invisible="1"/>
@ -356,6 +357,7 @@
<group col="2" colspan="1"> <group col="2" colspan="1">
<group col="4" colspan="1" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}"> <group col="4" colspan="1" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
<separator string="Currency Options" colspan="4"/> <separator string="Currency Options" colspan="4"/>
<field name="is_multi_currency" invisible="1"/>
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/> <field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/> <field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" invisible="1"/> <field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" invisible="1"/>

View File

@ -21,7 +21,7 @@
<field name="parent_id" eval="0"> <field name="parent_id" eval="0">
<value search="[('type','=','view')]" model="account.account"/> <value search="[('type','=','view')]" model="account.account"/>
</field> </field>
<field name="user_type" ref="account.account_type_root"/> <field name="user_type" ref="account.data_account_type_view"/>
</record> </record>
<record model="account.account" id="auction_expense_view"> <record model="account.account" id="auction_expense_view">
@ -32,13 +32,13 @@
<field name="parent_id" eval="0"> <field name="parent_id" eval="0">
<value search="[('type','=','view')]" model="account.account"/> <value search="[('type','=','view')]" model="account.account"/>
</field> </field>
<field name="user_type" ref="account.account_type_expense"/> <field name="user_type" ref="account.data_account_type_expense"/>
</record> </record>
<record model="account.account" id="auction_income"> <record model="account.account" id="auction_income">
<field name="name">Auction Adjudications</field> <field name="name">Auction Adjudications</field>
<field name="code">A7x*</field> <field name="code">A7x*</field>
<field name="user_type" ref="account.account_type_income"/> <field name="user_type" ref="account.data_account_type_income"/>
<field name="type">other</field> <field name="type">other</field>
<field name="currency_id" search="[('name','=','EUR')]"/> <field name="currency_id" search="[('name','=','EUR')]"/>
<field name="parent_id" eval="auction_income_view"/> <field name="parent_id" eval="auction_income_view"/>
@ -47,7 +47,7 @@
<record model="account.account" id="auction_expense"> <record model="account.account" id="auction_expense">
<field name="name">Auction Adjudication Expenses</field> <field name="name">Auction Adjudication Expenses</field>
<field name="code">A6x*</field> <field name="code">A6x*</field>
<field name="user_type" ref="account.account_type_expense"/> <field name="user_type" ref="account.data_account_type_expense"/>
<field name="type">other</field> <field name="type">other</field>
<field name="currency_id" search="[('name','=','EUR')]"/> <field name="currency_id" search="[('name','=','EUR')]"/>
<field name="parent_id" eval="auction_expense_view"/> <field name="parent_id" eval="auction_expense_view"/>

View File

@ -14,9 +14,9 @@ access_crm_case_categ,crm.case.categ,model_crm_case_categ,base.group_user,1,0,0,
access_crm_meeting,crm.meeting,model_crm_meeting,base.group_sale_salesman,1,1,1,0 access_crm_meeting,crm.meeting,model_crm_meeting,base.group_sale_salesman,1,1,1,0
access_crm_meeting_all,crm.meeting_allll,model_crm_meeting,base.group_user,1,0,0,0 access_crm_meeting_all,crm.meeting_allll,model_crm_meeting,base.group_user,1,0,0,0
access_crm_lead,crm.lead,model_crm_lead,base.group_sale_salesman,1,1,1,0 access_crm_lead,crm.lead,model_crm_lead,base.group_sale_salesman,1,1,1,0
access_crm_lead.all,crm.lead.all,model_crm_lead,base.group_user,1,0,0,0 access_crm_lead_all,crm.lead.all,model_crm_lead,base.group_user,1,0,0,0
access_crm_phonecall,crm.phonecall,model_crm_phonecall,base.group_sale_salesman,1,1,1,0 access_crm_phonecall,crm.phonecall,model_crm_phonecall,base.group_sale_salesman,1,1,1,0
access_crm_phonecall.all,crm.phonecall.all,model_crm_phonecall,base.group_user,1,0,0,0 access_crm_phonecall_all,crm.phonecall.all,model_crm_phonecall,base.group_user,1,0,0,0
access_crm_case_section_user,crm.case.section.user,model_crm_case_section,base.group_sale_salesman,1,1,1,0 access_crm_case_section_user,crm.case.section.user,model_crm_case_section,base.group_sale_salesman,1,1,1,0
access_crm_case_section_manager,crm.case.section.manager,model_crm_case_section,base.group_sale_manager,1,1,1,1 access_crm_case_section_manager,crm.case.section.manager,model_crm_case_section,base.group_sale_manager,1,1,1,1
access_crm_case_stage,crm.case.stage,model_crm_case_stage,base.group_user,1,0,0,0 access_crm_case_stage,crm.case.stage,model_crm_case_stage,base.group_user,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
14 access_crm_meeting crm.meeting model_crm_meeting base.group_sale_salesman 1 1 1 0
15 access_crm_meeting_all crm.meeting_allll model_crm_meeting base.group_user 1 0 0 0
16 access_crm_lead crm.lead model_crm_lead base.group_sale_salesman 1 1 1 0
17 access_crm_lead.all access_crm_lead_all crm.lead.all model_crm_lead base.group_user 1 0 0 0
18 access_crm_phonecall crm.phonecall model_crm_phonecall base.group_sale_salesman 1 1 1 0
19 access_crm_phonecall.all access_crm_phonecall_all crm.phonecall.all model_crm_phonecall base.group_user 1 0 0 0
20 access_crm_case_section_user crm.case.section.user model_crm_case_section base.group_sale_salesman 1 1 1 0
21 access_crm_case_section_manager crm.case.section.manager model_crm_case_section base.group_sale_manager 1 1 1 1
22 access_crm_case_stage crm.case.stage model_crm_case_stage base.group_user 1 0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -81,7 +81,7 @@
<field name="name">Bank Current Account</field> <field name="name">Bank Current Account</field>
<field ref="account.cas" name="parent_id"/> <field ref="account.cas" name="parent_id"/>
<field name="type">liquidity</field> <field name="type">liquidity</field>
<field name="user_type" ref="account.account_type_asset"/> <field name="user_type" ref="account.data_account_type_asset"/>
</record> </record>
<record id="a_salary_expense" model="account.account"> <record id="a_salary_expense" model="account.account">
@ -89,7 +89,7 @@
<field name="name">Salary Expenses</field> <field name="name">Salary Expenses</field>
<field ref="account.ovr" name="parent_id"/> <field ref="account.ovr" name="parent_id"/>
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account.account_type_expense"/> <field name="user_type" ref="account.data_account_type_expense"/>
</record> </record>
<record id="a_creditors" model="account.account"> <record id="a_creditors" model="account.account">
@ -98,7 +98,7 @@
<field ref="account.cli" name="parent_id"/> <field ref="account.cli" name="parent_id"/>
<field name="type">payable</field> <field name="type">payable</field>
<field eval="True" name="reconcile"/> <field eval="True" name="reconcile"/>
<field name="user_type" ref="account.account_type_payable"/> <field name="user_type" ref="account.data_account_type_payable"/>
</record> </record>

View File

@ -184,10 +184,6 @@ class hr_applicant(crm.crm_case, osv.osv):
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True), 'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
} }
def _get_stage(self, cr, uid, context=None):
ids = self.pool.get('hr.recruitment.stage').search(cr, uid, [], context=context)
return ids and ids[0] or False
_defaults = { _defaults = {
'active': lambda *a: 1, 'active': lambda *a: 1,
'user_id': lambda self, cr, uid, context: uid, 'user_id': lambda self, cr, uid, context: uid,

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -19,27 +19,49 @@
assert applicant.name == "Application for the post of Jr.application Programmer.", "Subject does not match" assert applicant.name == "Application for the post of Jr.application Programmer.", "Subject does not match"
assert applicant.state == "draft" assert applicant.state == "draft"
assert len(resume_ids), "Resume does not attached." assert len(resume_ids), "Resume does not attached."
-
I refuse applicant for the Recruitment.
-
!python {model: hr.applicant}: |
self.case_close(cr, uid, [ref("hr_case_programmer")])
-
I open applicant for the Recruitment.
-
!python {model: hr.applicant}: |
self.case_reset(cr, uid, [ref("hr_case_programmer")])
self.case_open(cr, uid, [ref("hr_case_programmer")])
- -
I assign the Job position to the applicant I assign the Job position to the applicant
- -
!python {model: hr.applicant}: | !python {model: hr.applicant}: |
self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_jr_appli')}) self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_jr_appli')})
-
I open applicant for the Recruitment
-
!python {model: hr.applicant}: |
self.case_open(cr, uid, [ref("hr_case_programmer")])
- -
I start communication with applicant, first schedule phonecall. I start communication with applicant, first schedule phonecall.
- -
!python {model: hr.recruitment.job2phonecall}: | !python {model: hr.recruitment.job2phonecall}: |
self.make_phonecall(cr, uid, [ref('hr_case_programmer')]) context.update({'active_model': 'hr.applicant', 'active_id': ref("hr_case_programmer"), 'active_ids': [ref("hr_case_programmer")], 'survey_id': ref("survey_job_0")})
id = self.create(cr, uid, {}, context=context)
self.make_phonecall(cr, uid, [id], context=context)
- -
I schedule meeting with applicant for interview. I schedule meeting with applicant for interview.
- -
!python {model: hr.applicant}: | !python {model: hr.applicant}: |
self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')]) self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
-
I check Initial Qualification of applicant.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
-
I schedule First Interview of applicant.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
-
On a successful First Interview of applicant, I schedule Second Interview.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
- -
Applicant fillup the answer of the interview quetion. Applicant fillup the answer of the interview quetion.
- -
@ -56,7 +78,13 @@
!python {model: hr.applicant}: | !python {model: hr.applicant}: |
self.action_print_survey(cr, uid, [ref('hr_case_programmer')]) self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
- -
On a successful interview with the applicant, I hired employee. On a successful Second Interview of applicant Contract is Proposed to applicant.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
self.stage_previous(cr, uid, [ref('hr_case_programmer')])
-
I Hired Applicant.
- -
!python {model: hr.applicant}: | !python {model: hr.applicant}: |
self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')]) self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')])
@ -65,3 +93,28 @@
- -
!assert {model: hr.applicant, id: hr_case_programmer}: !assert {model: hr.applicant, id: hr_case_programmer}:
- state == 'done' - state == 'done'
-
I do not give employment to the hired the applicant.
-
!python {model: hired.employee}: |
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
emp_id = self.create(cr, uid, {}, context=context)
self.case_close(cr, uid, [emp_id], context=context)
-
Now I give employment to hired applicant .
-
!python {model: hr.applicant}: |
hired_emp_obj = self.pool.get('hired.employee')
self.case_reset(cr, uid, [ref("hr_case_programmer")])
self.case_open(cr, uid, [ref("hr_case_programmer")])
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context)
hired_emp_obj.case_close_with_emp(cr, uid, [emp_hr_id], context=context)
-
Now hired employee want to be a partner of company.
-
!record {model: hr.recruitment.partner.create, id: hr_recruitment_partner_id1 }:
-
!python {model: hr.recruitment.partner.create}: |
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
self.make_order(cr, uid, [ref("hr_recruitment_partner_id1")], context=context)

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,28 +8,28 @@
<field name="close_method">none</field> <field name="close_method">none</field>
</record> </record>
<record model="account.account.type" id="account.account_type_income" > <record model="account.account.type" id="account.data_account_type_income" >
<field name="name">Erfolgskonten - Erlöse</field> <field name="name">Erfolgskonten - Erlöse</field>
<field name="code">income</field> <field name="code">income</field>
<field name="report_type">income</field> <field name="report_type">income</field>
<field name="close_method">none</field> <field name="close_method">none</field>
</record> </record>
<record model="account.account.type" id="account.account_type_expense"> <record model="account.account.type" id="account.data_account_type_expense">
<field name="name">Erfolgskonten - Aufwendungen</field> <field name="name">Erfolgskonten - Aufwendungen</field>
<field name="code">expense</field> <field name="code">expense</field>
<field name="report_type">expense</field> <field name="report_type">expense</field>
<field name="close_method">none</field> <field name="close_method">none</field>
</record> </record>
<record model="account.account.type" id="account.account_type_asset"> <record model="account.account.type" id="account.data_account_type_asset">
<field name="name">Bilanzkonten - Aktiva - Vermögenskonten</field> <field name="name">Bilanzkonten - Aktiva - Vermögenskonten</field>
<field name="code">balance asset</field> <field name="code">balance asset</field>
<field name="report_type">asset</field> <field name="report_type">asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
</record> </record>
<record model="account.account.type" id="account.account_type_liability"> <record model="account.account.type" id="account.data_account_type_liability">
<field name="name">Bilanzkonten - Passiva - Kapitalkonten</field> <field name="name">Bilanzkonten - Passiva - Kapitalkonten</field>
<field name="code">balance liability</field> <field name="code">balance liability</field>
<field name="report_type">liability</field> <field name="report_type">liability</field>

View File

@ -8,28 +8,28 @@
<field name="close_method">none</field> <field name="close_method">none</field>
</record> </record>
<record model="account.account.type" id="account.account_type_income" > <record model="account.account.type" id="account.data_account_type_income" >
<field name="name">Erfolgskonten - Erlöse</field> <field name="name">Erfolgskonten - Erlöse</field>
<field name="code">income</field> <field name="code">income</field>
<field name="report_type">income</field> <field name="report_type">income</field>
<field name="close_method">none</field> <field name="close_method">none</field>
</record> </record>
<record model="account.account.type" id="account.account_type_expense"> <record model="account.account.type" id="account.data_account_type_expense">
<field name="name">Erfolgskonten - Aufwendungen</field> <field name="name">Erfolgskonten - Aufwendungen</field>
<field name="code">expense</field> <field name="code">expense</field>
<field name="report_type">expense</field> <field name="report_type">expense</field>
<field name="close_method">none</field> <field name="close_method">none</field>
</record> </record>
<record model="account.account.type" id="account.account_type_asset"> <record model="account.account.type" id="account.data_account_type_asset">
<field name="name">Bilanzkonten - Aktiva - Vermögenskonten</field> <field name="name">Bilanzkonten - Aktiva - Vermögenskonten</field>
<field name="code">balance asset</field> <field name="code">balance asset</field>
<field name="report_type">asset</field> <field name="report_type">asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
</record> </record>
<record model="account.account.type" id="account.account_type_liability"> <record model="account.account.type" id="account.data_account_type_liability">
<field name="name">Bilanzkonten - Passiva - Kapitalkonten</field> <field name="name">Bilanzkonten - Passiva - Kapitalkonten</field>
<field name="code">balance liability</field> <field name="code">balance liability</field>
<field name="report_type">liability</field> <field name="report_type">liability</field>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -58,7 +58,11 @@ Note: If you need demo data, you can install the marketing_campaign_crm_demo mod
"security/ir.model.access.csv" "security/ir.model.access.csv"
], ],
'demo_xml': [ 'demo_xml': [
'marketing_campaign_demo.xml',
], ],
'test': [
'test/marketing_campaign.yml',
],
'installable': True, 'installable': True,
'active': False, 'active': False,
'certificate' : '00421723279617928365', 'certificate' : '00421723279617928365',

View File

@ -164,11 +164,12 @@ Normal - the campaign runs normally and automatically sends all emails and repor
self.write(cr, uid, ids, {'state': 'cancelled'}) self.write(cr, uid, ids, {'state': 'cancelled'})
return True return True
# dead code
def signal(self, cr, uid, model, res_id, signal, run_existing=True, context=None): def signal(self, cr, uid, model, res_id, signal, run_existing=True, context=None):
record = self.pool.get(model).browse(cr, uid, res_id, context) record = self.pool.get(model).browse(cr, uid, res_id, context)
return self._signal(cr, uid, record, signal, run_existing, context) return self._signal(cr, uid, record, signal, run_existing, context)
#dead code
def _signal(self, cr, uid, record, signal, run_existing=True, context=None): def _signal(self, cr, uid, record, signal, run_existing=True, context=None):
if not signal: if not signal:
raise ValueError('signal cannot be False') raise ValueError('signal cannot be False')
@ -461,6 +462,7 @@ class marketing_campaign_activity(osv.osv):
return super(marketing_campaign_activity, self).search(cr, uid, args, return super(marketing_campaign_activity, self).search(cr, uid, args,
offset, limit, order, context, count) offset, limit, order, context, count)
#dead code
def _process_wi_report(self, cr, uid, activity, workitem, context=None): def _process_wi_report(self, cr, uid, activity, workitem, context=None):
service = netsvc.LocalService('report.%s'%activity.report_id.report_name) service = netsvc.LocalService('report.%s'%activity.report_id.report_name)
(report_data, format) = service.create(cr, uid, [], {}, {}) (report_data, format) = service.create(cr, uid, [], {}, {})
@ -481,6 +483,7 @@ class marketing_campaign_activity(osv.osv):
activity.email_template_id.id, activity.email_template_id.id,
workitem.res_id, context=context) workitem.res_id, context=context)
#dead code
def _process_wi_action(self, cr, uid, activity, workitem, context=None): def _process_wi_action(self, cr, uid, activity, workitem, context=None):
if context is None: if context is None:
context = {} context = {}
@ -670,7 +673,7 @@ class marketing_campaign_workitem(osv.osv):
def _process_one(self, cr, uid, workitem, context=None): def _process_one(self, cr, uid, workitem, context=None):
if workitem.state != 'todo': if workitem.state != 'todo':
return return False
activity = workitem.activity_id activity = workitem.activity_id
proxy = self.pool.get(workitem.object_id.model) proxy = self.pool.get(workitem.object_id.model)
@ -707,7 +710,7 @@ class marketing_campaign_workitem(osv.osv):
if result: if result:
# process _chain # process _chain
workitem = workitem.browse(context)[0] # reload workitem = workitem.browse(context=context)[0] # reload
date = datetime.strptime(workitem.date, DT_FMT) date = datetime.strptime(workitem.date, DT_FMT)
for transition in activity.to_ids: for transition in activity.to_ids:
@ -784,11 +787,7 @@ class marketing_campaign_workitem(osv.osv):
res = {} res = {}
wi_obj = self.browse(cr, uid, ids[0], context=context) wi_obj = self.browse(cr, uid, ids[0], context=context)
if wi_obj.activity_id.type == 'email': if wi_obj.activity_id.type == 'email':
data_obj = self.pool.get('ir.model.data') view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'email_template', 'email_template_preview_form')
data_id = data_obj._get_id(cr, uid, 'email_template', 'email_template_preview_form')
view_id = 0
if data_id:
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
res = { res = {
'name': _('Email Preview'), 'name': _('Email Preview'),
'view_type': 'form', 'view_type': 'form',
@ -796,7 +795,7 @@ class marketing_campaign_workitem(osv.osv):
'res_model': 'email_template.preview', 'res_model': 'email_template.preview',
'view_id': False, 'view_id': False,
'context': context, 'context': context,
'views': [(view_id, 'form')], 'views': [(view_id and view_id[1] or 0, 'form')],
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'target': 'new', 'target': 'new',
'nodestroy':True, 'nodestroy':True,

View File

@ -0,0 +1,93 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!-- Email tempalte -->
<record id="email_template_1" model="email.template">
<field name="name">Template for New Partner</field>
<field name="email_from">info@tinyerp.com</field>
<field name="subject">Welcome in OpenERP Partner Channel!</field>
<field name="email_to">${object.email or ''}</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="body_text">Hello, We are very happy to send Welcome message.</field>
</record>
<record id="email_template_2" model="email.template">
<field name="name">Template for Silver Partner</field>
<field name="email_from">info@tinyerp.com</field>
<field name="subject">Congratulation! You become now our Silver Partner.</field>
<field name="email_to">${object.email or ''}</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="body_text">Hello, We are happy to announce that you now become our Silver Partner.</field>
</record>
<record id="email_template_3" model="email.template">
<field name="name">Template for Gold Partner</field>
<field name="email_from">info@tinyerp.com</field>
<field name="subject">Congratulation! You become our Gold Partner.</field>
<field name="email_to">${object.email or ''}</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="body_text">Hello, We are happy to announce that you become our Gold Partner.</field>
</record>
<!-- Campaign -->
<record id="marketing_campaign_openerppartnerchannel" model="marketing.campaign">
<field name="name">OpenERP Partner Channel</field>
<field name="object_id" ref="base.model_res_partner"/>
<field name="mode">active</field>
</record>
<!-- Activity -->
<record id="marketing_campaign_activity_0" model="marketing.campaign.activity">
<field name="name">New Partner</field>
<field name="campaign_id" ref="marketing_campaign_openerppartnerchannel"/>
<field name="email_template_id" ref="email_template_1"/>
<field name="condition">object.credit_limit &lt; 10000</field>
<field name="keep_if_condition_not_met">True</field>
<field eval="1" name="start"/>
</record>
<record id="marketing_campaign_activity_1" model="marketing.campaign.activity">
<field name="name">Silver Partner</field>
<field name="campaign_id" ref="marketing_campaign_openerppartnerchannel"/>
<field name="condition">object.credit_limit &gt;= 10000 and object.credit_limit &lt; 50000</field>
<field name="keep_if_condition_not_met">True</field>
<field name="email_template_id" ref="email_template_2"/>
</record>
<record id="marketing_campaign_activity_2" model="marketing.campaign.activity">
<field name="name">Gold Partner</field>
<field name="condition">object.credit_limit &gt;= 100000</field>
<field name="campaign_id" ref="marketing_campaign_openerppartnerchannel"/>
<field name="keep_if_condition_not_met">True</field>
<field name="email_template_id" ref="email_template_3"/>
</record>
<!-- Tranisition -->
<record id="marketing_campaign_transition_0" model="marketing.campaign.transition">
<field model="marketing.campaign.activity" name="activity_from_id" ref = "marketing_campaign_activity_0"/>
<field model="marketing.campaign.activity" name="activity_to_id" ref = "marketing_campaign_activity_1"/>
</record>
<record id="marketing_campaign_transition_1" model="marketing.campaign.transition">
<field model="marketing.campaign.activity" name="activity_from_id" ref = "marketing_campaign_activity_1"/>
<field model="marketing.campaign.activity" name="activity_to_id" ref = "marketing_campaign_activity_2"/>
</record>
<!-- Segment -->
<record id="filter0" model="ir.filters">
<field name="name">Partners</field>
<field name="domain">[('name','like','Agrolait')]</field>
<field name="model_id">res.partner</field>
</record>
<record id="marketing_campaign_segment0" model="marketing.campaign.segment">
<field eval="time.strftime('%Y-%m-%d %H:%M:%S')" name="date_run"/>
<field name="name">OpenERP Partner</field>
<field name="sync_mode">create_date</field>
<field name="ir_filter_id" ref="filter0"></field>
<field name="campaign_id" ref="marketing_campaign_openerppartnerchannel"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,151 @@
-
In order to test process of compaign, I start compaign.
-
!workflow {model: marketing.campaign, action: state_running_set, ref: marketing_campaign_openerppartnerchannel}
-
I check the campaign on Running mode after started.
-
!assert {model: marketing.campaign, id: marketing_campaign_openerppartnerchannel}:
- state == 'running'
-
I start this segment after assinged campaign.
-
!workflow {model: marketing.campaign.segment, action: state_running_set, ref: marketing_campaign_segment0}
-
I check the segment on Running mode after started.
-
!assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}:
- state == 'running'
-
I synchronized segment manually to see all step of activity and process covered on this campaign.
-
!python {model: marketing.campaign.segment}: |
segment_id = self.browse(cr ,uid ,ref("marketing_campaign_segment0") ,context)
assert segment_id.date_next_sync, 'Next Synchronization date is not calculated.'
self.synchroniz(cr, uid, [ref("marketing_campaign_segment0")])
-
I cancel Marketing Workitems.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel'))])
self.button_cancel(cr, uid, ids)
record = self.browse(cr, uid, ids[0])
assert record.state == 'cancelled' or record.state == 'done' , 'Marketing Workitem shoud be in cancel state.'
-
I set Marketing Workitems in draft state.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel'))])
self.button_draft(cr, uid, ids)
record = self.browse(cr, uid, ids[0])
assert record.state == 'todo' or record.state == 'done' , 'Marketing Workitem shoud be in draft state.'
-
I check followup detail of first activity.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_0'))])
assert ids, 'Followup item is not created for first activity.'
work_item_id = self.browse(cr ,uid ,ids[0] ,context)
assert work_item_id.res_name, 'Resource Name is not defined.'
-
I process followup of first activity.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_0'))])
self.process(cr, uid, ids)
record = self.browse(cr, uid, ids)[0]
assert record.state == "done", "Followup item should be closed after process."
-
I check followup detail of second activity after process of first activity.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_1'))])
assert ids, 'Followup item is not created for second activity.'
-
Now I increase credit limit of customer
-
!python {model: res.partner}: |
self.write(cr, uid, [ref("base.res_partner_agrolait")], {'credit_limit':41000}, context=context)
-
I process followup of second activity after set draft.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_1'))])
self.button_draft(cr, uid, ids, context=context)
self.process(cr, uid, ids, context=context)
record = self.browse(cr, uid, ids[0], context=context)
assert record.state == "done", "Followup item should be closed after process."
-
I check followup detail of third activity after process of second activity.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_2'))])
assert ids, 'Followup item is not created for third activity.'
-
Now I increase credit limit of customer
-
!python {model: res.partner}: |
self.write(cr, uid, [ref("base.res_partner_agrolait")], {'credit_limit':151000}, context=context)
-
I process followup of third activity after set draft.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_2'))])
self.button_draft(cr, uid, ids, context=context)
self.process(cr, uid, ids, context=context)
record = self.browse(cr, uid, ids[0], context=context)
assert record.state == "done", "Followup item should be closed after process."
-
I print workitem report.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_2'))])
self.preview(cr, uid, ids)
-
I cancel segmentation because of some activity.
-
!workflow {model: marketing.campaign.segment, action: state_cancel_set, ref: marketing_campaign_segment0}
-
I check the segmentation is canceled.
-
!assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}:
- state == 'cancelled'
-
I reopen the segmentation.
-
!workflow {model: marketing.campaign.segment, action: state_draft_set, ref: marketing_campaign_segment0}
-
!workflow {model: marketing.campaign.segment, action: state_running_set, ref: marketing_campaign_segment0}
-
I check the segment on Running mode after started.
-
!assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}:
- state == 'running'
-
I close segmentation After completion of all activity.
-
!workflow {model: marketing.campaign.segment, action: state_done_set, ref: marketing_campaign_segment0}
-
I check the segmentation is done.
-
!assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}:
- state == 'done'
-
I close this campaing.
-
!workflow {model: marketing.campaign.segment, action: state_done_set, ref: marketing_campaign_openerppartnerchannel}
-
I check the campaing is done.
-
!assert {model: marketing.campaign.segment, id: marketing_campaign_openerppartnerchannel}:
- state == 'done'

View File

@ -58,7 +58,7 @@
<field name="name">For OpenERP Discovery Day on May 2010</field> <field name="name">For OpenERP Discovery Day on May 2010</field>
</record> </record>
<record id="email_template_3" model="email.template"> <record id="email_template_3" model="email.template">
<field name="subject">Thanks for subscribing to the OpenERP Discovery Day</field> <field name="subject">Thanks for subscribing to the OpenERP Discovery Day</field>
<field name="email_to">info@tinyerp.com</field> <field name="email_to">info@tinyerp.com</field>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/> <field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
@ -72,7 +72,7 @@
<field name="name">For OpenERP Discovery Day</field> <field name="name">For OpenERP Discovery Day</field>
</record> </record>
<record id="email_template_4" model="email.template"> <record id="email_template_4" model="email.template">
<field name="subject">Thanks for buying the OpenERP book</field> <field name="subject">Thanks for buying the OpenERP book</field>
<field name="email_to">info@tinyerp.com</field> <field name="email_to">info@tinyerp.com</field>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/> <field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
@ -91,7 +91,6 @@
<field name="email_to">info@tinyerp.com</field> <field name="email_to">info@tinyerp.com</field>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/> <field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/> <field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="model_id" ref="crm.model_crm_lead"/>
<field eval="0" name="user_signature"/> <field eval="0" name="user_signature"/>
<field name="body_text">Hello, We have very good offer that might suit you. <field name="body_text">Hello, We have very good offer that might suit you.
For our gold partners,We are arranging free technical training on june,2010. For our gold partners,We are arranging free technical training on june,2010.
@ -157,6 +156,7 @@
<record id="marketing_campaign_openerpondemandfreetrial0" model="marketing.campaign"> <record id="marketing_campaign_openerpondemandfreetrial0" model="marketing.campaign">
<field name="name">OpenERP OnDemand Free Trial 2010</field> <field name="name">OpenERP OnDemand Free Trial 2010</field>
<field name="object_id" ref="crm.model_crm_lead"/> <field name="object_id" ref="crm.model_crm_lead"/>
<field name="mode">active</field>
<field name="partner_field_id" ref="crm.field_crm_lead_partner_id"/> <field name="partner_field_id" ref="crm.field_crm_lead_partner_id"/>
</record> </record>

View File

@ -522,6 +522,7 @@
<field name="res_model">mrp.bom</field> <field name="res_model">mrp.bom</field>
<field name="domain">[('id','=',active_id)]</field> <field name="domain">[('id','=',active_id)]</field>
<field name="view_type">tree</field> <field name="view_type">tree</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="mrp_bom_tree_view"/> <field name="view_id" ref="mrp_bom_tree_view"/>
</record> </record>
<record id="ir_BOM_structure" model="ir.values"> <record id="ir_BOM_structure" model="ir.values">
@ -776,7 +777,7 @@
<field colspan="4" name="product_lines" nolabel="1" widget="one2many_list"/> <field colspan="4" name="product_lines" nolabel="1" widget="one2many_list"/>
</page> </page>
<page string="Extra Information"> <page string="Extra Information">
<field name="user_id"/> <field name="user_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/> <field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="priority" groups="base.group_extended"/> <field name="priority" groups="base.group_extended"/>
<newline/> <newline/>
@ -972,7 +973,7 @@
</data> </data>
</field> </field>
</record> </record>
<act_window <act_window
context="{'search_default_product_id': [active_id]}" context="{'search_default_product_id': [active_id]}"
id="act_product_manufacturing_open" id="act_product_manufacturing_open"
@ -980,13 +981,14 @@
view_id="mrp_production_tree_view" view_id="mrp_production_tree_view"
res_model="mrp.production" res_model="mrp.production"
src_model="product.product"/> src_model="product.product"/>
<act_window <act_window
id="action_product_bom_structure" id="action_product_bom_structure"
name="Product BoM Structure" name="Product BoM Structure"
domain="[('product_id', '=', active_id),('bom_id','=',False)]" domain="[('product_id', '=', active_id),('bom_id','=',False)]"
context="{'default_product_id': active_id}" context="{'default_product_id': active_id}"
view_type="tree" view_type="tree"
view_mode="tree"
view_id="mrp_bom_tree_view" view_id="mrp_bom_tree_view"
res_model="mrp.bom" res_model="mrp.bom"
src_model="product.product" src_model="product.product"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -16,7 +16,7 @@
<group col="7" colspan="4"> <group col="7" colspan="4">
<field name="name"/> <field name="name"/>
<field name="date_order"/> <field name="date_order"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)" context="{'search_default_customer':1}"/>
<button name="invoice" string="Invoice" icon="gtk-apply" type="workflow" states="paid" attrs="{'invisible': ['|',('partner_id','=',False),('state','&lt;&gt;','paid')]}"/> <button name="invoice" string="Invoice" icon="gtk-apply" type="workflow" states="paid" attrs="{'invisible': ['|',('partner_id','=',False),('state','&lt;&gt;','paid')]}"/>
</group> </group>
<notebook colspan="4"> <notebook colspan="4">

View File

@ -478,3 +478,34 @@
.point-of-sale .pos-receipt-container { .point-of-sale .pos-receipt-container {
font-size: 0.75em; font-size: 0.75em;
} }
.point-of-sale .oe_pos_synch-notification-button {
color: white;
border: 1px solid black;
border-radius: 3px;
padding: 2px 3px 2px 3px;
background-color: #D92A2A;
}
@media print {
#oe_header, #oe_menu, .point-of-sale #topheader, .point-of-sale #leftpane {
display: none;
}
.point-of-sale #content {
top: 0px;
}
.point-of-sale #rigthpane {
left: 0px;
background-color: white;
}
#receipt-screen header, #pos-finish-order {
display: none;
}
#receipt-screen {
text-align: left;
}
.pos-sale-ticket {
margin: 0;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -22,62 +22,122 @@ openerp.point_of_sale = function(db) {
QWeb.add_template("/point_of_sale/static/src/xml/pos.xml"); QWeb.add_template("/point_of_sale/static/src/xml/pos.xml");
var qweb_template = function(template) { var qweb_template = function(template) {
return function(ctx) { return function(ctx) {
return QWeb.render(template, ctx); return QWeb.render(template, _.extend({}, ctx,{
'currency': pos.get('currency'),
'format_amount': function(amount) {
if (pos.get('currency').position == 'after') {
return amount + ' ' + pos.get('currency').symbol;
} else {
return pos.get('currency').symbol + ' ' + amount;
}
},
}));
}; };
}; };
var _t = db.web._t;
/* /*
Local store access. Read once from localStorage upon construction and persist on every change. Local store access. Read once from localStorage upon construction and persist on every change.
There should only be one store active at any given time to ensure data consistency. There should only be one store active at any given time to ensure data consistency.
*/ */
var Store = (function() { var Store = db.web.Class.extend({
function Store() { init: function() {
var store; this.data = {};
store = localStorage['pos']; },
this.data = (store && JSON.parse(store)) || {}; get: function(key, _default) {
} if (this.data[key] === undefined) {
var stored = localStorage['oe_pos_' + key];
Store.prototype.get = function(key) { if (stored)
this.data[key] = JSON.parse(stored);
else
return _default;
}
return this.data[key]; return this.data[key];
}; },
Store.prototype.set = function(key, value) { set: function(key, value) {
this.data[key] = value; this.data[key] = value;
return localStorage['pos'] = JSON.stringify(this.data); localStorage['oe_pos_' + key] = JSON.stringify(value);
}; },
return Store; });
})();
/* /*
Gets all the necessary data from the OpenERP web client (session, shop data etc.) Gets all the necessary data from the OpenERP web client (session, shop data etc.)
*/ */
var Pos = (function() { var Pos = Backbone.Model.extend({
function Pos(session) { initialize: function(session, attributes) {
Backbone.Model.prototype.initialize.call(this, attributes);
this.store = new Store();
this.ready = $.Deferred();
this.flush_mutex = new $.Mutex();
this.build_tree = _.bind(this.build_tree, this); this.build_tree = _.bind(this.build_tree, this);
this.session = session; this.session = session;
this.set({'pending_operations': this.store.get('pending_operations', [])});
this.bind('change:pending_operations', _.bind(function(unused, val) {
this.store.set('pending_operations', val);
}, this));
this.set({'currency': this.store.get('currency', {symbol: '$', position: 'after'})});
this.bind('change:currency', _.bind(function(unused, val) {
this.store.set('currency', val);
}, this));
$.when(this.fetch('pos.category', ['name', 'parent_id', 'child_id']), $.when(this.fetch('pos.category', ['name', 'parent_id', 'child_id']),
this.fetch('product.product', ['name', 'list_price', 'pos_categ_id', 'taxes_id', 'img'], [['pos_categ_id', '!=', 'false']]), this.fetch('product.product', ['name', 'list_price', 'pos_categ_id', 'taxes_id', 'img'], [['pos_categ_id', '!=', 'false']]),
this.fetch('account.bank.statement', ['account_id', 'currency', 'journal_id', 'state', 'name']), this.fetch('account.bank.statement', ['account_id', 'currency', 'journal_id', 'state', 'name'], [['state', '=', 'open']]),
this.fetch('account.journal', ['auto_cash', 'check_dtls', 'currency', 'name', 'type'])) this.fetch('account.journal', ['auto_cash', 'check_dtls', 'currency', 'name', 'type']),
this.get_currency())
.then(this.build_tree); .then(this.build_tree);
} },
fetch: function(osvModel, fields, domain) {
Pos.prototype.ready = $.Deferred();
Pos.prototype.store = new Store;
Pos.prototype.fetch = function(osvModel, fields, domain) {
var dataSetSearch; var dataSetSearch;
var self = this; var self = this;
var callback = function(result) {
return self.store.set(osvModel, result);
};
dataSetSearch = new db.web.DataSetSearch(this, osvModel, {}, domain); dataSetSearch = new db.web.DataSetSearch(this, osvModel, {}, domain);
return dataSetSearch.read_slice(fields, 0).then(callback); return dataSetSearch.read_slice(fields, 0).then(function(result) {
}; return self.store.set(osvModel, result);
Pos.prototype.push = function(osvModel, record, callback, errorCallback) { });
var dataSet; },
dataSet = new db.web.DataSet(this, osvModel, null); get_currency: function() {
return dataSet.create(record, callback, errorCallback); return new db.web.Model("sale.shop").get_func("search_read")([]).pipe(function(result) {
}; var company_id = result[0]['company_id'][0];
Pos.prototype.categories = {}; return new db.web.Model("res.company").get_func("read")(company_id, ['currency_id']).pipe(function(result) {
Pos.prototype.build_tree = function() { var currency_id = result['currency_id'][0]
return new db.web.Model("res.currency").get_func("read")([currency_id],
['symbol', 'position']).pipe(function(result) {
return result[0];
});
});
}).then(_.bind(function(currency) {
this.set({'currency': currency});
}, this));
},
push: function(osvModel, record) {
var ops = _.clone(this.get('pending_operations'));
ops.push({model: osvModel, record: record});
this.set({pending_operations: ops});
return this.flush();
},
flush: function() {
return this.flush_mutex.exec(_.bind(function() {
return this._int_flush();
}, this));
},
_int_flush : function() {
var ops = this.get('pending_operations');
if (ops.length === 0)
return $.when();
var op = ops[0];
var dataSet = new db.web.DataSet(this, op.model, null);
/* we prevent the default error handler and assume errors
* are a normal use case, except we stop the current iteration
*/
return dataSet.create(op.record).fail(function(unused, event) {
event.preventDefault();
}).pipe(_.bind(function() {
console.debug('saved 1 record');
var ops2 = this.get('pending_operations');
this.set({'pending_operations': _.without(ops2, op)});
return this._int_flush();
}, this), function() {return $.when()});
},
categories: {},
build_tree: function() {
var c, id, _i, _len, _ref, _ref2; var c, id, _i, _len, _ref, _ref2;
_ref = this.store.get('pos.category'); _ref = this.store.get('pos.category');
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -124,14 +184,14 @@ openerp.point_of_sale = function(db) {
}).call(this) }).call(this)
}; };
return this.ready.resolve(); return this.ready.resolve();
}; },
Pos.prototype.build_ancestors = function(parent) { build_ancestors: function(parent) {
if (parent != null) { if (parent != null) {
this.current_category.ancestors.unshift(parent); this.current_category.ancestors.unshift(parent);
return this.build_ancestors(this.categories[parent].parent); return this.build_ancestors(this.categories[parent].parent);
} }
}; },
Pos.prototype.build_subtree = function(category) { build_subtree: function(category) {
var c, _i, _len, _ref, _results; var c, _i, _len, _ref, _results;
_ref = category.children; _ref = category.children;
_results = []; _results = [];
@ -141,9 +201,8 @@ openerp.point_of_sale = function(db) {
_results.push(this.build_subtree(this.categories[c])); _results.push(this.build_subtree(this.categories[c]));
} }
return _results; return _results;
}; }
return Pos; });
})();
/* global variable */ /* global variable */
var pos; var pos;
@ -210,26 +269,28 @@ openerp.point_of_sale = function(db) {
To add more of the same product, just update the quantity accordingly. To add more of the same product, just update the quantity accordingly.
The Order also contains payment information. The Order also contains payment information.
*/ */
var Orderline = (function() { var Orderline = Backbone.Model.extend({
__extends(Orderline, Backbone.Model); defaults: {
function Orderline() {
Orderline.__super__.constructor.apply(this, arguments);
}
Orderline.prototype.defaults = {
quantity: 1, quantity: 1,
list_price: 0, list_price: 0,
discount: 0 discount: 0
}; },
Orderline.prototype.incrementQuantity = function() { initialize: function(attributes) {
Backbone.Model.prototype.initialize.apply(this, arguments);
this.bind('change:quantity', function(unused, qty) {
if (qty == 0)
this.trigger('killme');
}, this);
},
incrementQuantity: function() {
return this.set({ return this.set({
quantity: (this.get('quantity')) + 1 quantity: (this.get('quantity')) + 1
}); });
}; },
Orderline.prototype.getTotal = function() { getTotal: function() {
return (this.get('quantity')) * (this.get('list_price')) * (1 - (this.get('discount')) / 100); return (this.get('quantity')) * (this.get('list_price')) * (1 - (this.get('discount')) / 100);
}; },
Orderline.prototype.exportAsJSON = function() { exportAsJSON: function() {
var result; var result;
result = { result = {
qty: this.get('quantity'), qty: this.get('quantity'),
@ -238,18 +299,11 @@ openerp.point_of_sale = function(db) {
product_id: this.get('id') product_id: this.get('id')
}; };
return result; return result;
}; },
return Orderline; });
})(); var OrderlineCollection = Backbone.Collection.extend({
var OrderlineCollection = (function() { model: Orderline,
__extends(OrderlineCollection, Backbone.Collection); });
function OrderlineCollection() {
OrderlineCollection.__super__.constructor.apply(this, arguments);
}
OrderlineCollection.prototype.model = Orderline;
return OrderlineCollection;
})();
/* /*
Every PaymentLine has all the attributes of the corresponding CashRegister. Every PaymentLine has all the attributes of the corresponding CashRegister.
*/ */
@ -268,7 +322,7 @@ openerp.point_of_sale = function(db) {
Paymentline.prototype.exportAsJSON = function() { Paymentline.prototype.exportAsJSON = function() {
var result; var result;
result = { result = {
name: "Payment line", name: db.web.datetime_to_str(new Date()),
statement_id: this.get('id'), statement_id: this.get('id'),
account_id: (this.get('account_id'))[0], account_id: (this.get('account_id'))[0],
journal_id: (this.get('journal_id'))[0], journal_id: (this.get('journal_id'))[0],
@ -324,9 +378,13 @@ openerp.point_of_sale = function(db) {
var existing; var existing;
existing = (this.get('orderLines')).get(product.id); existing = (this.get('orderLines')).get(product.id);
if (existing != null) { if (existing != null) {
return existing.incrementQuantity(); existing.incrementQuantity();
} else { } else {
return (this.get('orderLines')).add(new Orderline(product.toJSON())); var line = new Orderline(product.toJSON());
this.get('orderLines').add(line);
line.bind('killme', function() {
this.get('orderLines').remove(line);
}, this);
} }
}; };
Order.prototype.addPaymentLine = function(cashRegister) { Order.prototype.addPaymentLine = function(cashRegister) {
@ -617,7 +675,7 @@ openerp.point_of_sale = function(db) {
Shopping carts. Shopping carts.
*/ */
var OrderlineWidget = db.web.Widget.extend({ var OrderlineWidget = db.web.Widget.extend({
tagName: 'tr', tag_name: 'tr',
template_fct: qweb_template('pos-orderline-template'), template_fct: qweb_template('pos-orderline-template'),
init: function(parent, options) { init: function(parent, options) {
this._super(parent); this._super(parent);
@ -662,13 +720,12 @@ openerp.point_of_sale = function(db) {
changeSelectedOrder: function() { changeSelectedOrder: function() {
this.currentOrderLines.unbind(); this.currentOrderLines.unbind();
this.bindOrderLineEvents(); this.bindOrderLineEvents();
return this.render_element(); this.render_element();
}, },
bindOrderLineEvents: function() { bindOrderLineEvents: function() {
this.currentOrderLines = (this.shop.get('selectedOrder')).get('orderLines'); this.currentOrderLines = (this.shop.get('selectedOrder')).get('orderLines');
this.currentOrderLines.bind('add', this.addLine, this); this.currentOrderLines.bind('add', this.addLine, this);
this.currentOrderLines.bind('change', this.render_element, this); this.currentOrderLines.bind('remove', this.render_element, this);
return this.currentOrderLines.bind('remove', this.render, this);
}, },
addLine: function(newLine) { addLine: function(newLine) {
var line = new OrderlineWidget(null, { var line = new OrderlineWidget(null, {
@ -677,7 +734,7 @@ openerp.point_of_sale = function(db) {
numpadState: this.numpadState numpadState: this.numpadState
}); });
line.appendTo(this.$element); line.appendTo(this.$element);
return this.updateSummary(); this.updateSummary();
}, },
render_element: function() { render_element: function() {
this.$element.empty(); this.$element.empty();
@ -689,7 +746,7 @@ openerp.point_of_sale = function(db) {
}); });
line.appendTo(this.$element); line.appendTo(this.$element);
}, this)); }, this));
return this.updateSummary(); this.updateSummary();
}, },
updateSummary: function() { updateSummary: function() {
var currentOrder, tax, total, totalTaxExcluded; var currentOrder, tax, total, totalTaxExcluded;
@ -699,7 +756,7 @@ openerp.point_of_sale = function(db) {
tax = currentOrder.getTax(); tax = currentOrder.getTax();
$('#subtotal').html(totalTaxExcluded.toFixed(2)).hide().fadeIn(); $('#subtotal').html(totalTaxExcluded.toFixed(2)).hide().fadeIn();
$('#tax').html(tax.toFixed(2)).hide().fadeIn(); $('#tax').html(tax.toFixed(2)).hide().fadeIn();
return $('#total').html(total.toFixed(2)).hide().fadeIn(); $('#total').html(total.toFixed(2)).hide().fadeIn();
}, },
}); });
/* /*
@ -831,12 +888,13 @@ openerp.point_of_sale = function(db) {
validateCurrentOrder: function() { validateCurrentOrder: function() {
var callback, currentOrder; var callback, currentOrder;
currentOrder = this.shop.get('selectedOrder'); currentOrder = this.shop.get('selectedOrder');
callback = _.bind(function() { $('button#validate-order', this.$element).attr('disabled', 'disabled');
pos.push('pos.order', currentOrder.exportAsJSON()).then(_.bind(function() {
$('button#validate-order', this.$element).removeAttr('disabled');
return currentOrder.set({ return currentOrder.set({
validated: true validated: true
}); });
}, this); }, this));
pos.push('pos.order', currentOrder.exportAsJSON(), callback);
}, },
bindPaymentLineEvents: function() { bindPaymentLineEvents: function() {
this.currentPaymentLines = (this.shop.get('selectedOrder')).get('paymentLines'); this.currentPaymentLines = (this.shop.get('selectedOrder')).get('paymentLines');
@ -1103,7 +1161,7 @@ openerp.point_of_sale = function(db) {
s = $(this).val().toLowerCase(); s = $(this).val().toLowerCase();
if (s) { if (s) {
m = products.filter( function(p) { m = products.filter( function(p) {
return p.name.toLowerCase().indexOf(s); return p.name.toLowerCase().indexOf(s) != -1;
}); });
$('.search-clear').fadeIn(); $('.search-clear').fadeIn();
} else { } else {
@ -1120,29 +1178,109 @@ openerp.point_of_sale = function(db) {
}; };
return App; return App;
})(); })();
db.point_of_sale.SynchNotification = db.web.Widget.extend({
template: "pos-synch-notification",
init: function() {
this._super.apply(this, arguments);
this.nbr_pending = 0;
},
render_element: function() {
this._super.apply(this, arguments);
$('.oe_pos_synch-notification-button', this.$element).click(this.on_synch);
},
on_change_nbr_pending: function(nbr_pending) {
this.nbr_pending = nbr_pending;
this.render_element();
},
on_synch: function() {}
});
db.web.client_actions.add('pos.ui', 'db.point_of_sale.PointOfSale'); db.web.client_actions.add('pos.ui', 'db.point_of_sale.PointOfSale');
db.point_of_sale.PointOfSale = db.web.Widget.extend({ db.point_of_sale.PointOfSale = db.web.Widget.extend({
template: "PointOfSale", init: function() {
start: function() { this._super.apply(this, arguments);
var self = this;
this.$element.find("#loggedas button").click(function() {
self.stop();
});
if (pos) if (pos)
throw "It is not possible to instantiate multiple instances "+ throw "It is not possible to instantiate multiple instances "+
"of the point of sale at the same time."; "of the point of sale at the same time.";
pos = new Pos(this.session); pos = new Pos(this.session);
},
start: function() {
var self = this;
return pos.ready.then(_.bind(function() {
this.render_element();
this.synch_notification = new db.point_of_sale.SynchNotification(this);
this.synch_notification.replace($('.oe_pos_synch-notification', this.$element));
this.synch_notification.on_synch.add(_.bind(pos.flush, pos));
pos.bind('change:pending_operations', this.changed_pending_operations, this);
this.changed_pending_operations();
this.$element.find("#loggedas button").click(function() {
self.try_close();
});
this.$element.find('#steps').buttonset();
this.$element.find('#steps').buttonset();
$('.oe_toggle_secondary_menu').hide();
$('.oe_footer').hide();
return pos.ready.then( function() {
pos.app = new App(self.$element); pos.app = new App(self.$element);
}); $('.oe_toggle_secondary_menu').hide();
$('.oe_footer').hide();
if (pos.store.get('account.bank.statement').length === 0)
return new db.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_pos_open_statement']], ['res_id']).pipe(
_.bind(function(res) {
return this.rpc('/web/action/load', {'action_id': res[0]['res_id']}).pipe(_.bind(function(result) {
var action = result.result;
this.do_action(action);
}, this));
}, this));
}, this));
},
render: function() {
return qweb_template("PointOfSale")();
},
changed_pending_operations: function () {
this.synch_notification.on_change_nbr_pending(pos.get('pending_operations').length);
},
try_close: function() {
pos.flush().then(_.bind(function() {
var close = _.bind(this.close, this);
if (pos.get('pending_operations').length > 0) {
var confirm = false;
$(QWeb.render('pos-close-warning')).dialog({
resizable: false,
height:160,
modal: true,
title: "Warning",
buttons: {
"Yes": function() {
confirm = true;
$( this ).dialog( "close" );
},
"No": function() {
$( this ).dialog( "close" );
}
},
close: function() {
if (confirm)
close();
}
});
} else {
close();
}
}, this));
},
close: function() {
return new db.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_pos_close_statement']], ['res_id']).pipe(
_.bind(function(res) {
return this.rpc('/web/action/load', {'action_id': res[0]['res_id']}).pipe(_.bind(function(result) {
var action = result.result;
action.context = _.extend(action.context || {}, {'cancel_action': {type: 'ir.actions.client', tag: 'default_home'}});
this.do_action(action);
}, this));
}, this));
}, },
stop: function() { stop: function() {
$('.oe_footer').show(); $('.oe_footer').show();

View File

@ -25,7 +25,8 @@
</div> </div>
</div> </div>
<div id="loggedas"> <div id="loggedas">
<button>Back</button> <span class="oe_pos_synch-notification"></span>
<button>Close</button>
</div> </div>
</div> </div>
<div id="content"> <div id="content">
@ -49,15 +50,15 @@
<ul id="amounts"> <ul id="amounts">
<li> <li>
Subtotal: Subtotal:
<span id="subtotal">0</span> <t t-if="currency.position == 'before'" t-esc="currency.symbol"/> <span id="subtotal">0</span> <t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
</li> </li>
<li> <li>
Tax: Tax:
<span id="tax">0</span> <t t-if="currency.position == 'before'" t-esc="currency.symbol"/> <span id="tax">0</span> <t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
</li> </li>
<li> <li>
Total: Total:
<span id="total">0</span> <t t-if="currency.position == 'before'" t-esc="currency.symbol"/> <span id="total">0</span> <t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
</li> </li>
</ul> </ul>
<div id="paypad"></div> <div id="paypad"></div>
@ -102,11 +103,11 @@
<table> <table>
<tr> <tr>
<td class="paymentline-type">Paid:</td> <td class="paymentline-type">Paid:</td>
<td class="paymentline-amount pos-rigth-align"><span id="payment-paid-total"></span> </td> <t t-if="currency.position == 'before'" t-esc="currency.symbol"/> <td class="paymentline-amount pos-rigth-align"><span id="payment-paid-total"></span> <t t-if="currency.position == 'after'" t-esc="currency.symbol"/></td>
</tr> </tr>
<tr> <tr>
<td class="paymentline-type">Change:</td> <td class="paymentline-type">Change:</td>
<td class="paymentline-amount pos-rigth-align"><span id="payment-remaining"></span> </td> <t t-if="currency.position == 'before'" t-esc="currency.symbol"/> <td class="paymentline-amount pos-rigth-align"><span id="payment-remaining"></span> <t t-if="currency.position == 'after'" t-esc="currency.symbol"/></td>
</tr> </tr>
</table> </table>
</div> </div>
@ -122,6 +123,16 @@
</div> </div>
</div> </div>
</t> </t>
<t t-name="pos-synch-notification">
<span>
<a t-if="widget.nbr_pending &gt; 0" href="javascript:void(0)" class="oe_pos_synch-notification-button">
<t t-esc="widget.nbr_pending"/> pending orders
</a>
</span>
</t>
<t t-name="pos-close-warning">
<div>There are pending operations that could not be saved into the database, are you sure you want to exit?</div>
</t>
<t t-name="pos-category-template"> <t t-name="pos-category-template">
<header> <header>
<ol class="breadcrumb"> <ol class="breadcrumb">
@ -162,8 +173,7 @@
<div class="product-img"> <div class="product-img">
<img t-att-src="'data:image/gif;base64,'+ img" /> <img t-att-src="'data:image/gif;base64,'+ img" />
<span class="price-tag"> <span class="price-tag">
<t t-esc="list_price"/> <t t-esc="format_amount(list_price)"/>
</span> </span>
</div> </div>
<div class="product-name"> <div class="product-name">
@ -176,8 +186,7 @@
<t t-esc="name"/> <t t-esc="name"/>
</td> </td>
<td> <td>
<t t-esc="list_price.toFixed(2)"/> <t t-esc="format_amount(list_price.toFixed(2))"/>
</td> </td>
<td> <td>
<t t-esc="discount.toFixed(2)"/> <t t-esc="discount.toFixed(2)"/>
@ -186,8 +195,7 @@
<t t-esc="quantity.toFixed(0)"/> <t t-esc="quantity.toFixed(0)"/>
</td> </td>
<td> <td>
<t t-esc="(list_price * (1 - discount/100) * quantity).toFixed(2)"/> <t t-esc="format_amount((list_price * (1 - discount/100) * quantity).toFixed(2))"/>
</td> </td>
</t> </t>
<t t-name="pos-paymentline-template"> <t t-name="pos-paymentline-template">
@ -206,7 +214,7 @@
<t t-esc="name"/> <t t-esc="name"/>
</td> </td>
<td class="receiptline-amount"> <td class="receiptline-amount">
<t t-esc="(list_price * (1 - discount/100) * quantity).toFixed(2)"/> <t t-esc="format_amount((list_price * (1 - discount/100) * quantity).toFixed(2))"/>
</td> </td>
</t> </t>
<t t-name="pos-payment-button-template"> <t t-name="pos-payment-button-template">
@ -233,9 +241,21 @@
<table id="receiptlines"></table> <table id="receiptlines"></table>
<br /> <br />
<table> <table>
<tr><td>Total:</td><td class="pos-rigth-align"><span id="receipt-summary-total"></span></td></tr> <tr><td>Total:</td><td class="pos-rigth-align">
<tr><td>Tax:</td><td class="pos-rigth-align"><span id="receipt-summary-tax"></span></td></tr> <t t-if="currency.position == 'before'" t-esc="currency.symbol"/>
<tr><td>Change:</td><td class="pos-rigth-align"><span id="receipt-summary-change"></span></td></tr> <span id="receipt-summary-total"></span>
<t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
</td></tr>
<tr><td>Tax:</td><td class="pos-rigth-align">
<t t-if="currency.position == 'before'" t-esc="currency.symbol"/>
<span id="receipt-summary-tax"></span>
<t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
</td></tr>
<tr><td>Change:</td><td class="pos-rigth-align">
<t t-if="currency.position == 'before'" t-esc="currency.symbol"/>
<span id="receipt-summary-change"></span>
<t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
</td></tr>
</table> </table>
</div> </div>
</div> </div>

View File

@ -75,7 +75,7 @@ class pos_box_out(osv.osv_memory):
res_obj = self.pool.get('res.users') res_obj = self.pool.get('res.users')
for data in self.read(cr, uid, ids, context=context): for data in self.read(cr, uid, ids, context=context):
curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id
statement_id = statement_obj.search(cr, uid, [('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context) statement_ids = statement_obj.search(cr, uid, [('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context)
monday = (datetime.today() + relativedelta(weekday=0)).strftime('%Y-%m-%d') monday = (datetime.today() + relativedelta(weekday=0)).strftime('%Y-%m-%d')
sunday = (datetime.today() + relativedelta(weekday=6)).strftime('%Y-%m-%d') sunday = (datetime.today() + relativedelta(weekday=6)).strftime('%Y-%m-%d')
done_statmt = statement_obj.search(cr, uid, [('date', '>=', monday+' 00:00:00'), ('date', '<=', sunday+' 23:59:59'), ('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid)], context=context) done_statmt = statement_obj.search(cr, uid, [('date', '>=', monday+' 00:00:00'), ('date', '<=', sunday+' 23:59:59'), ('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid)], context=context)
@ -85,21 +85,11 @@ class pos_box_out(osv.osv_memory):
acc_id = product.property_account_income acc_id = product.property_account_income
if not acc_id: if not acc_id:
raise osv.except_osv(_('Error !'), _('please check that account is set to %s')%(product.name)) raise osv.except_osv(_('Error !'), _('please check that account is set to %s')%(product.name))
if not statement_id: if not statement_ids:
raise osv.except_osv(_('Error !'), _('You have to open at least one cashbox')) raise osv.except_osv(_('Error !'), _('You have to open at least one cashbox'))
if statement_id: vals['statement_id'] = statement_ids[0]
statement_id = statement_id[0]
if not statement_id:
statement_id = statement_obj.create(cr, uid, {
'date': time.strftime('%Y-%m-%d 00:00:00'),
'journal_id': data['journal_id'],
'company_id': curr_company,
'user_id': uid,
}, context=context)
vals['statement_id'] = statement_id
vals['journal_id'] = data['journal_id'] vals['journal_id'] = data['journal_id']
if acc_id: vals['account_id'] = acc_id.id
vals['account_id'] = acc_id.id
amount = data['amount'] or 0.0 amount = data['amount'] or 0.0
if data['amount'] > 0: if data['amount'] > 0:
amount = -data['amount'] amount = -data['amount']

View File

@ -25,6 +25,10 @@ from tools.translate import _
class pos_close_statement(osv.osv_memory): class pos_close_statement(osv.osv_memory):
_name = 'pos.close.statement' _name = 'pos.close.statement'
_description = 'Close Statements' _description = 'Close Statements'
def cancel_wizard(self, cr, uid, ids, context=None):
if context.get('cancel_action'):
return context['cancel_action']
def close_statement(self, cr, uid, ids, context=None): def close_statement(self, cr, uid, ids, context=None):
""" """
@ -35,6 +39,7 @@ class pos_close_statement(osv.osv_memory):
@param context: A standard dictionary @param context: A standard dictionary
@return : Blank Dictionary @return : Blank Dictionary
""" """
context = context or {}
mod_obj = self.pool.get('ir.model.data') mod_obj = self.pool.get('ir.model.data')
statement_obj = self.pool.get('account.bank.statement') statement_obj = self.pool.get('account.bank.statement')
journal_obj = self.pool.get('account.journal') journal_obj = self.pool.get('account.journal')

View File

@ -15,7 +15,9 @@
<group col="4" colspan="4"> <group col="4" colspan="4">
<group col="2" colspan="2"/> <group col="2" colspan="2"/>
<button icon='gtk-stop' special="cancel" <button icon='gtk-stop' special="cancel"
string="No" /> string="No" invisible="context.get('cancel_action')"/>
<button icon='gtk-stop' type="object" name="cancel_wizard"
string="No" invisible="not context.get('cancel_action')"/>
<button name="close_statement" string="Yes" <button name="close_statement" string="Yes"
type="object" icon="gtk-ok"/> type="object" icon="gtk-ok"/>
</group> </group>

View File

@ -75,16 +75,9 @@ class pos_open_statement(osv.osv_memory):
form_id = form_res and form_res[1] or False form_id = form_res and form_res[1] or False
search_id = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_pos_open_cash_statement_filter') search_id = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_pos_open_cash_statement_filter')
return { return {
'domain': "[('id', 'in',[ "+','.join(map(str,st_ids))+"])]", 'type': 'ir.actions.client',
'name': _('Open Cash Registers'), 'tag': 'pos.ui',
'view_type': 'form',
'view_mode': 'tree, form',
'search_view_id': search_id and search_id[1] or False ,
'res_model': 'account.bank.statement',
'views': [(tree_id, 'tree'), (form_id, 'form')],
'context': {},
'type': 'ir.actions.act_window'
} }
pos_open_statement() pos_open_statement()

View File

@ -166,7 +166,6 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="search_view_id" ref="product_pricelist_view_search" /> <field name="search_view_id" ref="product_pricelist_view_search" />
<field name="context">{"default_type":"sale", "search_default_type":"sale"}</field> <field name="context">{"default_type":"sale", "search_default_type":"sale"}</field>
<field name="domain">[('type','=','sale')]</field>
<field name="help">A price list contains rules to be evaluated in order to compute the purchase or sales price for all the partners assigned to a price list. Price lists have several versions (2010, 2011, Promotion of February 2010, etc.) and each version has several rules. Example: the customer price of a product category will be based on the supplier price multiplied by 1.80.</field> <field name="help">A price list contains rules to be evaluated in order to compute the purchase or sales price for all the partners assigned to a price list. Price lists have several versions (2010, 2011, Promotion of February 2010, etc.) and each version has several rules. Example: the customer price of a product category will be based on the supplier price multiplied by 1.80.</field>
</record> </record>
<record id="product_pricelist_action_for_purchase" model="ir.actions.act_window"> <record id="product_pricelist_action_for_purchase" model="ir.actions.act_window">
@ -177,7 +176,6 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="search_view_id" ref="product_pricelist_view_search" /> <field name="search_view_id" ref="product_pricelist_view_search" />
<field name="context">{"default_type":"purchase", "search_default_type":"purchase"}</field> <field name="context">{"default_type":"purchase", "search_default_type":"purchase"}</field>
<field name="domain">[('type','=','purchase')]</field>
<field name="help">A price list contains rules to be evaluated in order to compute the purchase or sales price for all the partners assigned to a price list. Price lists have several versions (2010, 2011, Promotion of February 2010, etc.) and each version has several rules. Example: the customer price of a product category will be based on the supplier price multiplied by 1.80.</field> <field name="help">A price list contains rules to be evaluated in order to compute the purchase or sales price for all the partners assigned to a price list. Price lists have several versions (2010, 2011, Promotion of February 2010, etc.) and each version has several rules. Example: the customer price of a product category will be based on the supplier price multiplied by 1.80.</field>
</record> </record>
<menuitem <menuitem

View File

@ -880,14 +880,24 @@ class task(osv.osv):
self.write(cr, uid, ids, {'state': 'draft'}, context=context) self.write(cr, uid, ids, {'state': 'draft'}, context=context)
return True return True
def _delegate_task_attachments(self, cr, uid, task_id, delegated_task_id, context=None):
attachment = self.pool.get('ir.attachment')
attachment_ids = attachment.search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', task_id)], context=context)
new_attachment_ids = []
for attachment_id in attachment_ids:
new_attachment_ids.append(attachment.copy(cr, uid, attachment_id, default={'res_id': delegated_task_id}, context=context))
return new_attachment_ids
def do_delegate(self, cr, uid, ids, delegate_data={}, context=None): def do_delegate(self, cr, uid, ids, delegate_data={}, context=None):
""" """
Delegate Task to another users. Delegate Task to another users.
""" """
assert delegate_data['user_id'], _("Delegated User should be specified") assert delegate_data['user_id'], _("Delegated User should be specified")
delegrated_tasks = {} delegated_tasks = {}
for task in self.browse(cr, uid, ids, context=context): for task in self.browse(cr, uid, ids, context=context):
delegrated_task_id = self.copy(cr, uid, task.id, { delegated_task_id = self.copy(cr, uid, task.id, {
'name': delegate_data['name'], 'name': delegate_data['name'],
'project_id': delegate_data['project_id'] and delegate_data['project_id'][0] or False, 'project_id': delegate_data['project_id'] and delegate_data['project_id'][0] or False,
'user_id': delegate_data['user_id'] and delegate_data['user_id'][0] or False, 'user_id': delegate_data['user_id'] and delegate_data['user_id'][0] or False,
@ -898,6 +908,7 @@ class task(osv.osv):
'child_ids': [], 'child_ids': [],
'work_ids': [] 'work_ids': []
}, context=context) }, context=context)
self._delegate_task_attachments(cr, uid, task.id, delegated_task_id, context=context)
newname = delegate_data['prefix'] or '' newname = delegate_data['prefix'] or ''
task.write({ task.write({
'remaining_hours': delegate_data['planned_hours_me'], 'remaining_hours': delegate_data['planned_hours_me'],
@ -911,8 +922,8 @@ class task(osv.osv):
message = _("The task '%s' has been delegated to %s.") % (delegate_data['name'], delegate_data['user_id'][1]) message = _("The task '%s' has been delegated to %s.") % (delegate_data['name'], delegate_data['user_id'][1])
self.log(cr, uid, task.id, message) self.log(cr, uid, task.id, message)
delegrated_tasks[task.id] = delegrated_task_id delegated_tasks[task.id] = delegated_task_id
return delegrated_tasks return delegated_tasks
def do_pending(self, cr, uid, ids, context={}): def do_pending(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state': 'pending'}, context=context) self.write(cr, uid, ids, {'state': 'pending'}, context=context)

View File

@ -1,6 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data noupdate="1"> <data noupdate="1">
<!-- Requests Links -->
<record id="req_link_project" model="res.request.link">
<field name="name">Project</field>
<field name="object">project.project</field>
</record>
<record id="req_link_task" model="res.request.link">
<field name="name">Project task</field>
<field name="object">project.task</field>
</record>
<!-- Resource: project.project --> <!-- Resource: project.project -->
<record id="all_projects_account" model="account.analytic.account"> <record id="all_projects_account" model="account.analytic.account">
<field name="name">Projects</field> <field name="name">Projects</field>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -54,8 +54,10 @@ and decide on their status as they evolve.
], ],
'demo_xml': ['project_issue_demo.xml'], 'demo_xml': ['project_issue_demo.xml'],
'test': [ 'test': [
'test/convert_issue_to_task.yml', 'test/subscribe_issue.yml',
'test/test_project_issue_states.yml' 'test/issue_process.yml',
'test/cancel_issue.yml',
'test/issue_demo.yml'
], ],
'installable': True, 'installable': True,
'active': False, 'active': False,

View File

@ -314,7 +314,8 @@ class project_issue(crm.crm_case, osv.osv):
'description':bug.description, 'description':bug.description,
'date_deadline': bug.date, 'date_deadline': bug.date,
'project_id': bug.project_id.id, 'project_id': bug.project_id.id,
'priority': bug.priority, # priority must be in ['0','1','2','3','4'], while bug.priority is in ['1','2','3','4','5']
'priority': str(int(bug.priority) - 1),
'user_id': bug.user_id.id, 'user_id': bug.user_id.id,
'planned_hours': 0.0, 'planned_hours': 0.0,
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -0,0 +1,60 @@
-
In order to test process of issue tracking in OpenERP, I cancel the unqualified Issue.
-
!python {model: project.issue}: |
self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check the issue is in cancel state.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
- state == 'cancel'
-
I re-open the Issue.
-
!python {model: project.issue}: |
self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check the state of issue after open it.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in open state}:
- state == 'open'
-
I put the issue in pending state.
-
!python {model: project.issue}: |
self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check the state of issue after put it in pending state.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}:
- state == 'pending'
-
I cancel the issue is in pending state.
-
!python {model: project.issue}: |
self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check the issue is in cancel state.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
- state == 'cancel'
-
I close Issue.
-
!python {model: project.issue}: |
self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check state of Issue after close.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in done state}:
- state == 'done'
-
I cancel the issue is in done state.
-
!python {model: project.issue}: |
self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check the issue is in cancel state.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
- state == 'cancel'

View File

@ -1,32 +0,0 @@
-
Create an issue
-
!record {model: project.issue, id: project_issue_onchangeevent0}:
categ_id: project_issue.bug_categ
name: on_change event does not pass context to the method
project_id: project.project_project_22
working_hours_close: 0.0
working_hours_open: 0.0
-
Check there is no task attached to issue
-
!assert {model: project.issue, id: project_issue_onchangeevent0, string: There must not be any task attached to issue}:
- task_id.id == False
-
Convert issue to task
-
!python {model: project.issue}: |
self.convert_issue_task(cr, uid, [ref("project_issue_onchangeevent0")],
{"lang": "en_US", "project_id": False, "tz": False, "active_model": "ir.ui.menu",
"department_id": False, "section_id": False, "search_default_project_id":
False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs":
1, "active_ids": [ref("project_issue.menu_project_issue_track")], "active_id":
ref("project_issue.menu_project_issue_track"), })
-
Check there is a task attached to issue
-
!assert {model: project.issue, id: project_issue_onchangeevent0, string: After creating a task for the issue there must be a task attached to it}:
- task_id.id != False

View File

@ -0,0 +1,45 @@
Return-Path: <Robert_Adersen@yahoo.com>
X-Original-To: abc@mycompany.com
Delivered-To: abc@mycompany.com
Received: by mail1.mycompany.com (Postfix, from userid 10002)
id 3955EBFACA; Tue, 29 Nov 2011 08:14:47 +0100 (CET)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail1.mycompany.com
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
Received: from nm39-vm6.bullet.mail.ne1.yahoo.com (nm39-vm6.bullet.mail.ne1.yahoo.com [98.138.229.166])
by mail1.mycompany.com (Postfix) with SMTP id 0D074BF53A
for <abc@mycompany.com>; Tue, 29 Nov 2011 08:14:44 +0100 (CET)
Received: from [98.138.90.54] by nm39.bullet.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000
Received: from [98.138.84.39] by tm7.bullet.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000
Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.in; s=s1024; t=1322550806; bh=LFefFqrky41IufKZHP8a86obZoBPxyX1aafgWNcrw7U=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=NB8bd6b4Uk3/3fKhdzbcqFEZGPpKyotLeE0xh8H08rcFEahMFfY5uXgsYZsUFvTLCKfTyQWh/oPTVxHeUTGY/Y5MzAnndghX6S0mzlFtmW2dwLMqdWxQLZwU7EhbyYF9PCHicsmtlUVyo7Ou5ePSviqC0SOyCJJVWwzWlv5W9Zg=
X-Yahoo-Newman-Id: 152218.10448.bm@smtp107.mail.ne1.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: i4zQqJUVM1mab8kxoCTmgMwxw9th.MdiJzmc4Ffbno7QGkl
acotmc0pGoiw_GrhwReSA6uNIveeAUi9WA6NniWAElxbUzGIQplTBHjRhdqF
d_rLG1Yn71DYxllLCZC8xoRzumVHw.kue0ymrl4D0VO.lEeyXbbYoz.TpAvu
ZASBwSV_mESEUu96bb1esfOjI_2MhibMNmt.2egkOG6LS3AcDkVWXJb.VpQe
yZieJ5djjUx9uu4HModjROSUWHKm3Qd5ZwvG.3s1JvHNNvPC3Mo6x.DXi_rj
d70J2pruXhJ9ZnbNooZiSHkrhaugWV.kquq6475ZxKP6Tu7G8iUgZUkHWCf.
aEdBFl2.4RanSkMohEfbNtwpXUQ0eDDOOPatHFB27JSP0jw--
X-Yahoo-SMTP: oNtzSBqswBAqJIGYOgyGesyleENrhUEtEgBkQ053
Received: from [192.168.1.30] (Robert_Adersen@180.211.100.2 with plain)
by smtp107.mail.ne1.yahoo.com with SMTP; 28 Nov 2011 23:13:25 -0800 PST
Message-ID: <4ED48611.6070605@yahoo.in>
Date: Tue, 29 Nov 2011 12:43:21 +0530
From: Robert Adersen <Robert_Adersen@yahoo.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10
MIME-Version: 1.0
To: abc@mycompany.com
Subject: Error in the account module
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hello Sir,
I am using the openerp v6.1 and i have problem in hr module, so try to
check it and solve my problem.
thanks
Robert Adersen

View File

@ -0,0 +1,8 @@
-
!record {model: project.issue, id: project_task_1, view: False}:
task_id: 'project.project_task_17'
name: 'Error in account module'
-
!record {model: project.issue, id: project01, view: False}:
project_id: 'project.project_project_9'
name: 'OpenERP Integration'

View File

@ -0,0 +1,57 @@
-
In order to test process of issue tracking in OpenERP, I Open the Issue.
-
!python {model: project.issue}: |
self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check state of Issue after opened it.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}:
- state == 'open'
-
Now I put Issue in pending due to need more information.
-
!python {model: project.issue}: |
self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check state after put in pending.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}:
- state == 'pending'
-
I send mail to get more details.
-
!python {model: mail.compose.message }: |
ctx = context.copy()
ctx.update({'active_model': 'project.issue', 'active_id': ref("crm_case_buginaccountsmodule0"), 'active_ids': [ref("crm_case_buginaccountsmodule0")]})
vals = self.default_get(cr, uid , [], context=ctx)
try:
new_id = self.create(cr, uid, {'email_from': 'support@mycompany.com','email_to': 'Robert_Adersen@yahoo.com', 'subject': 'Regarding error in account module we nees more details'})
self.send_mail(cr, uid, [new_id], context=ctx)
except Exception, e:
pass
-
After getting sufficient details, I re-open Issue from pending state.
-
!python {model: project.issue}: |
self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I check state of Issue after re-opened.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}:
- state == 'open'
-
I create Task for Issue.
-
!python {model: project.issue}: |
self.convert_issue_task(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I close Issue after resolving it
-
!python {model: project.issue}: |
self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")])
-
I Check state of Issue after closed.
-
!assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in done state}:
- state == 'done'

View File

@ -0,0 +1,17 @@
-
In Order to test process of Issue in OpenERP, Custmer send the issue by email.
-
!python {model: mail.thread}: |
import addons
request_file = open(addons.get_module_resource('project_issue','test', 'issue.eml'),'rb')
request_message = request_file.read()
self.message_process(cr, uid, 'project.issue', request_message)
-
After getting the mail, I check details of new issue of that customer.
-
!python {model: project.issue}: |
issue_ids = self.search(cr, uid, [('email_from', '=', 'Robert Adersen <Robert_Adersen@yahoo.com>')])
assert issue_ids and len(issue_ids), "issue is not created after getting request"
issue = self.browse(cr, uid, issue_ids[0], context=context)
assert not issue.partner_id, "Customer should be a new"
assert issue.name == "Error in the account module", "Subject does not match"

View File

@ -1,112 +0,0 @@
-
Create an issue
-
!record {model: project.issue, id: project_issue_stockmovedates0}:
categ_id: project_issue.bug_categ
name: Stock Move dates
project_id: project.project_project_22
working_hours_close: 0.0
working_hours_open: 0.0
-
Check if issue in 'draft' state
-
!assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in draft state}:
- state == 'draft'
-
Open the issue
-
!python {model: project.issue}: |
self.case_open(cr, uid, [ref("project_issue_stockmovedates0")], {"lang":
"en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], "tz":
False, "active_model": "ir.ui.menu", "search_default_project_id": False, "search_default_my_bugs":
1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id":
False, "active_id": ref("project_issue.menu_project_issue_track"), })
-
Check if issue in 'open' state
-
!assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in open state}:
- state == 'open'
-
Keep issue pending
-
!python {model: project.issue}: |
self.case_pending(cr, uid, [ref("project_issue_stockmovedates0")],
{"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")],
"tz": False, "active_model": "ir.ui.menu", "search_default_project_id":
False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs":
1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"),
})
-
Check if issue in 'pending' state
-
!assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in pending state}:
- state == 'pending'
-
Open the issue
-
!python {model: project.issue}: |
self.case_open(cr, uid, [ref("project_issue_stockmovedates0")], {"lang":
"en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], "tz":
False, "active_model": "ir.ui.menu", "search_default_project_id": False, "search_default_my_bugs":
1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id":
False, "active_id": ref("project_issue.menu_project_issue_track"), })
-
Check if issue in 'open' state
-
!assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in open state}:
- state == 'open'
-
Cancel the issue
-
!python {model: project.issue}: |
self.case_cancel(cr, uid, [ref("project_issue_stockmovedates0")],
{"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")],
"tz": False, "active_model": "ir.ui.menu", "search_default_project_id":
False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs":
1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"),
})
-
Check if issue in 'cancel' state
-
!assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in cancel state}:
- state == 'cancel'
-
Reset the issue
-
!python {model: project.issue}: |
self.case_reset(cr, uid, [ref("project_issue_stockmovedates0")],
{"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")],
"tz": False, "active_model": "ir.ui.menu", "search_default_project_id":
False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs":
1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"),
})
-
Check if issue in 'draft' state
-
!assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in draft state}:
- state == 'draft'
-
Close the issue
-
!python {model: project.issue}: |
self.case_close(cr, uid, [ref("project_issue_stockmovedates0")],
{"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")],
"tz": False, "active_model": "ir.ui.menu", "search_default_project_id":
False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs":
1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"),
})
-
Check if issue in 'done' state
-
!assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in done state}:
- state == 'done'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -7,20 +7,20 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev_rc3\n" "Project-Id-Version: OpenERP Server 6.0dev_rc3\n"
"Report-Msgid-Bugs-To: support@openerp.com\n" "Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2011-01-11 11:16+0000\n" "POT-Creation-Date: 2011-01-11 11:16+0000\n"
"PO-Revision-Date: 2011-10-06 16:03+0000\n" "PO-Revision-Date: 2011-12-15 21:29+0000\n"
"Last-Translator: Francisco Reyes Acuña <Unknown>\n" "Last-Translator: Francisco Reyes Acuña <Unknown>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2011-11-05 05:17+0000\n" "X-Launchpad-Export-Date: 2011-12-16 05:24+0000\n"
"X-Generator: Launchpad (build 14231)\n" "X-Generator: Launchpad (build 14523)\n"
#. module: sale #. module: sale
#: view:board.board:0 #: view:board.board:0
#: model:ir.actions.act_window,name:sale.action_sales_by_salesman #: model:ir.actions.act_window,name:sale.action_sales_by_salesman
msgid "Sales by Salesman in last 90 days" msgid "Sales by Salesman in last 90 days"
msgstr "Ventas por comercial últimos 90 días" msgstr "Ventas por vendedor en los últimos 90 días"
#. module: sale #. module: sale
#: help:sale.installer,delivery:0 #: help:sale.installer,delivery:0

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -27,12 +27,11 @@ class stock_move(osv.osv):
'sale_line_id': fields.many2one('sale.order.line', 'Sales Order Line', ondelete='set null', select=True, readonly=True), 'sale_line_id': fields.many2one('sale.order.line', 'Sales Order Line', ondelete='set null', select=True, readonly=True),
} }
def _create_chained_picking(self, cr, uid, pick_name, picking, ptype, move, context=None): def _prepare_chained_picking(self, cr, uid, picking_name, picking, picking_type, moves_todo, context=None):
res = super(stock_move, self)._create_chained_picking(cr, uid, pick_name, picking, ptype, move, context=context) values = super(stock_move, self)._prepare_chained_picking(cr, uid, picking_name, picking, picking_type, moves_todo, context=context)
if picking.sale_id: if picking.sale_id:
self.pool.get('stock.picking').write(cr, uid, [res], {'sale_id': picking.sale_id.id}) values['sale_id'] = picking.sale_id.id
return res return values
stock_move()
class stock_picking(osv.osv): class stock_picking(osv.osv):
_inherit = 'stock.picking' _inherit = 'stock.picking'
@ -196,7 +195,4 @@ class stock_picking(osv.osv):
}) })
return result return result
stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -9,7 +9,6 @@
close_method: none close_method: none
code: View code: View
name: View name: View
sign: 1
- -
I create Income Account Type. I create Income Account Type.
- -
@ -17,7 +16,6 @@
close_method: unreconciled close_method: unreconciled
code: Income code: Income
name: Income name: Income
sign: 1
- -
I create Expense Account Type. I create Expense Account Type.
- -
@ -25,7 +23,6 @@
close_method: unreconciled close_method: unreconciled
code: Expense code: Expense
name: Expense name: Expense
sign: 1
- -
I create Cash Account Type. I create Cash Account Type.
- -
@ -33,7 +30,6 @@
close_method: balance close_method: balance
code: Cash code: Cash
name: Cash name: Cash
sign: 1
- -
I create Minimal Chart Account. I create Minimal Chart Account.
- -

View File

@ -28,10 +28,11 @@ class res_groups(osv.osv):
help="Group created to set access rights for sharing data with some users.") help="Group created to set access rights for sharing data with some users.")
} }
def __init__(self, pool, cr): def get_application_groups(self, cr, uid, domain=None, context=None):
super(res_groups, self).__init__(pool, cr) if domain is None:
# add domain in get_groups_by_application() domain = []
self.groups_by_application_domain.append(('share', '=', False)) domain.append(('share', '=', False))
return super(res_groups, self).get_application_groups(cr, uid, domain=domain, context=context)
res_groups() res_groups()

View File

@ -1,13 +1,14 @@
.openerp li.oe-share { .openerp li.oe-share {
background: url(../img/share.png) no-repeat; background: url(../img/share.png) no-repeat 0 60%;
padding-left: 20px; padding-left: 20px;
} }
.openerp a.oe-share { .openerp a.oe-share {
background: url(../img/share.png) no-repeat; background: url(../img/share.png) no-repeat center center;
display: block; display: block;
float: left; float: left;
width: 20px; width: 20px;
height: 20px; height: 20px;
margin-top: 3px;
} }

View File

@ -4,21 +4,24 @@ openerp.share = function(instance) {
function launch_wizard(self, view) { function launch_wizard(self, view) {
var action = view.widget_parent.action; var action = view.widget_parent.action;
var Share = new instance.web.DataSet(self, 'share.wizard', view.dataset.get_context()); var Share = new instance.web.DataSet(self, 'share.wizard', view.dataset.get_context());
var domain = view.dataset.domain; var domain = new instance.web.CompoundDomain(view.dataset.domain);
if (view.fields_view.type == 'form') { if (view.fields_view.type == 'form') {
domain = new instance.web.CompoundDomain(domain, [['id', '=', view.datarecord.id]]); domain = new instance.web.CompoundDomain(domain, [['id', '=', view.datarecord.id]]);
} }
self.rpc('/web/session/eval_domain_and_context', {
Share.create({ domains: [domain],
name: action.name, contexts: [view.dataset.context]
domain: domain, }, function (result) {
action_id: action.id, Share.create({
}, function(result) { name: action.name,
var share_id = result.result; domain: result.domain,
var step1 = Share.call('go_step_1', [[share_id],], function(result) { action_id: action.id,
var action = result; }, function(result) {
self.do_action(action); var share_id = result.result;
var step1 = Share.call('go_step_1', [[share_id],], function(result) {
var action = result;
self.do_action(action);
});
}); });
}); });
} }

View File

@ -43,38 +43,6 @@ RANDOM_PASS_CHARACTERS = 'aaaabcdeeeefghjkmnpqrstuvwxyzAAAABCDEEEEFGHJKLMNPQRSTU
def generate_random_pass(): def generate_random_pass():
return ''.join(random.sample(RANDOM_PASS_CHARACTERS,10)) return ''.join(random.sample(RANDOM_PASS_CHARACTERS,10))
# Utils for introspecting the ORM - could be moved to server someday
class column_info(object):
"""Struct containing details about an osv column, either one local to
its model, or one inherited via _inherits.
:attr name: name of the column
:attr column: column instance, subclass of osv.fields.column
:attr parent_model: if the column is inherited, name of the model
that contains it, None for local columns.
:attr parent_column: the name of the column containing the m2o
relationship to the parent model that contains
this column, None for local columns.
"""
def __init__(self, name, column, parent_model=None, parent_column=None):
self.name = name
self.column = column
self.parent_model = parent_model
self.parent_column = parent_column
def get_column_infos(osv_model):
"""Returns a dict mapping all fields names (direct fields and
inherited field via _inherits) to a ``column_info`` struct
giving detailed columns """
result = {}
for k, (parent,m2o,col) in osv_model._inherit_fields.iteritems():
result[k] = column_info(k, col, parent, m2o)
for k, v in osv_model._columns.iteritems():
result[k] = column_info(k,v)
return result
class share_wizard(osv.osv_memory): class share_wizard(osv.osv_memory):
_logger = logging.getLogger('share.wizard') _logger = logging.getLogger('share.wizard')
_name = 'share.wizard' _name = 'share.wizard'
@ -321,7 +289,7 @@ class share_wizard(osv.osv_memory):
models = [x[1].model for x in relation_fields] models = [x[1].model for x in relation_fields]
model_obj = self.pool.get('ir.model') model_obj = self.pool.get('ir.model')
model_osv = self.pool.get(model.model) model_osv = self.pool.get(model.model)
for colinfo in get_column_infos(model_osv).itervalues(): for colinfo in model_osv._all_columns.itervalues():
coldef = colinfo.column coldef = colinfo.column
coltype = coldef._type coltype = coldef._type
relation_field = None relation_field = None
@ -331,7 +299,7 @@ class share_wizard(osv.osv_memory):
relation_osv = self.pool.get(coldef._obj) relation_osv = self.pool.get(coldef._obj)
if coltype == 'one2many': if coltype == 'one2many':
# don't record reverse path if it's not a real m2o (that happens, but rarely) # don't record reverse path if it's not a real m2o (that happens, but rarely)
dest_model_ci = get_column_infos(relation_osv) dest_model_ci = relation_osv._all_columns
reverse_rel = coldef._fields_id reverse_rel = coldef._fields_id
if reverse_rel in dest_model_ci and dest_model_ci[reverse_rel].column._type == 'many2one': if reverse_rel in dest_model_ci and dest_model_ci[reverse_rel].column._type == 'many2one':
relation_field = ('%s.%s'%(reverse_rel, suffix)) if suffix else reverse_rel relation_field = ('%s.%s'%(reverse_rel, suffix)) if suffix else reverse_rel
@ -339,7 +307,7 @@ class share_wizard(osv.osv_memory):
for parent in relation_osv._inherits: for parent in relation_osv._inherits:
if parent not in models: if parent not in models:
parent_model = self.pool.get(parent) parent_model = self.pool.get(parent)
parent_colinfos = get_column_infos(parent_model) parent_colinfos = parent_model._all_columns
parent_model_browse = model_obj.browse(cr, UID_ROOT, parent_model_browse = model_obj.browse(cr, UID_ROOT,
model_obj.search(cr, UID_ROOT, [('model','=',parent)]))[0] model_obj.search(cr, UID_ROOT, [('model','=',parent)]))[0]
if relation_field and coldef._fields_id in parent_colinfos: if relation_field and coldef._fields_id in parent_colinfos:
@ -689,7 +657,7 @@ class share_wizard(osv.osv_memory):
raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.'))
# TODO: also send an HTML version of this mail # TODO: also send an HTML version of this mail
emails_sent = 0 msg_ids = []
for result_line in wizard_data.result_line_ids: for result_line in wizard_data.result_line_ids:
email_to = result_line.user_id.user_email email_to = result_line.user_id.user_email
subject = wizard_data.name subject = wizard_data.name
@ -712,23 +680,23 @@ class share_wizard(osv.osv_memory):
body += _("The documents have been automatically added to your current OpenERP documents.\n") body += _("The documents have been automatically added to your current OpenERP documents.\n")
body += _("You may use your current login (%s) and password to view them.\n") % result_line.user_id.login body += _("You may use your current login (%s) and password to view them.\n") % result_line.user_id.login
body += "\n\n" body += "\n\n"
body += user.signature body += (user.signature or '')
body += "\n\n" body += "\n\n"
body += "--\n" body += "--\n"
body += _("OpenERP is a powerful and user-friendly suite of Business Applications (CRM, Sales, HR, etc.)\n" body += _("OpenERP is a powerful and user-friendly suite of Business Applications (CRM, Sales, HR, etc.)\n"
"It is open source and can be found on http://www.openerp.com.") "It is open source and can be found on http://www.openerp.com.")
if mail_message.schedule_with_attach(cr, uid, msg_ids.append(mail_message.schedule_with_attach(cr, uid,
user.user_email, user.user_email,
[email_to], [email_to],
subject, subject,
body, body,
model='share.wizard'): model='share.wizard',
emails_sent += 1 context=context))
else: # force direct delivery, as users expect instant notification
self._logger.warning('Failed to send share notification from %s to %s, ignored', user.user_email, email_to) mail_message.send(cr, uid, msg_ids, context=context)
self._logger.info('%s share notification(s) successfully sent.', emails_sent) self._logger.info('%d share notification(s) sent.', len(msg_ids))
share_wizard()
class share_result_line(osv.osv_memory): class share_result_line(osv.osv_memory):
_name = 'share.wizard.result.line' _name = 'share.wizard.result.line'
@ -753,6 +721,5 @@ class share_result_line(osv.osv_memory):
_defaults = { _defaults = {
'newly_created': True, 'newly_created': True,
} }
share_result_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1852,23 +1852,41 @@ class stock_move(osv.osv):
result[m.picking_id].append( (m, dest) ) result[m.picking_id].append( (m, dest) )
return result return result
def _create_chained_picking(self, cr, uid, pick_name, picking, ptype, move, context=None): def _prepare_chained_picking(self, cr, uid, picking_name, picking, picking_type, moves_todo, context=None):
res_obj = self.pool.get('res.company') """Prepare the definition (values) to create a new chained picking.
:param str picking_name: desired new picking name
:param browse_record picking: source picking (being chained to)
:param str picking_type: desired new picking type
:param list moves_todo: specification of the stock moves to be later included in this
picking, in the form::
[[move, (dest_location, auto_packing, chained_delay, chained_journal,
chained_company_id, chained_picking_type)],
...
]
See also :meth:`stock_location.chained_location_get`.
"""
res_company = self.pool.get('res.company')
return {
'name': picking_name,
'origin': tools.ustr(picking.origin or ''),
'type': picking_type,
'note': picking.note,
'move_type': picking.move_type,
'auto_picking': moves_todo[0][1][1] == 'auto',
'stock_journal_id': moves_todo[0][1][3],
'company_id': moves_todo[0][1][4] or res_company._company_default_get(cr, uid, 'stock.company', context=context),
'address_id': picking.address_id.id,
'invoice_state': 'none',
'date': picking.date,
}
def _create_chained_picking(self, cr, uid, picking_name, picking, picking_type, moves_todo, context=None):
picking_obj = self.pool.get('stock.picking') picking_obj = self.pool.get('stock.picking')
pick_id= picking_obj.create(cr, uid, { return picking_obj.create(cr, uid, self._prepare_chained_picking(cr, uid, picking_name, picking, picking_type, moves_todo, context=context))
'name': pick_name,
'origin': tools.ustr(picking.origin or ''),
'type': ptype,
'note': picking.note,
'move_type': picking.move_type,
'auto_picking': move[0][1][1] == 'auto',
'stock_journal_id': move[0][1][3],
'company_id': move[0][1][4] or res_obj._company_default_get(cr, uid, 'stock.company', context=context),
'address_id': picking.address_id.id,
'invoice_state': 'none',
'date': picking.date,
})
return pick_id
def create_chained_picking(self, cr, uid, moves, context=None): def create_chained_picking(self, cr, uid, moves, context=None):
res_obj = self.pool.get('res.company') res_obj = self.pool.get('res.company')
location_obj = self.pool.get('stock.location') location_obj = self.pool.get('stock.location')

View File

@ -7,7 +7,6 @@
close_method: balance close_method: balance
code: asset_test code: asset_test
name: Asset For Tests name: Asset For Tests
sign: 1
- -
I create a account type income. I create a account type income.
- -
@ -15,7 +14,6 @@
close_method: unreconciled close_method: unreconciled
code: income_test code: income_test
name: Income For Tests name: Income For Tests
sign: 1
- -
I create a account type Expense. I create a account type Expense.
- -
@ -23,7 +21,6 @@
close_method: unreconciled close_method: unreconciled
code: expense_test code: expense_test
name: Expense For Tests name: Expense For Tests
sign: 1
- -
I create a account type Receivable. I create a account type Receivable.
- -
@ -31,7 +28,6 @@
close_method: unreconciled close_method: unreconciled
code: receivable_test code: receivable_test
name: Receivable For Tests name: Receivable For Tests
sign: 1
- -
I create a account Receivable. I create a account Receivable.