[MERGE]: Merge with lp:openobject-trunk-dev-addons2

bzr revid: ksa@tinyerp.co.in-20100514064906-fbte140kwld456wk
This commit is contained in:
ksa (Open ERP) 2010-05-14 12:19:06 +05:30
commit 1a8ce11d22
246 changed files with 9929 additions and 4551 deletions

View File

@ -1763,52 +1763,6 @@ class account_subscription_line(osv.osv):
_rec_name = 'date'
account_subscription_line()
class account_config_wizard(osv.osv_memory):
_name = 'account.config.wizard'
_inherit = 'res.config'
_columns = {
'name':fields.char(
'Name', required=True, size=64,
help="Name of the fiscal year as displayed on screens."),
'code':fields.char(
'Code', required=True, size=64,
help="Name of the fiscal year as displayed in reports."),
'date1': fields.date('Start Date', required=True),
'date2': fields.date('End Date', required=True),
'period':fields.selection([('month','Month'), ('3months','3 Months')],
'Periods', required=True),
}
_defaults = {
'code': lambda *a: time.strftime('%Y'),
'name': lambda *a: time.strftime('%Y'),
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-12-31'),
'period':lambda *a:'month',
}
def execute(self, cr, uid, ids, context=None):
for res in self.read(cr,uid,ids):
if 'date1' in res and 'date2' in res:
res_obj = self.pool.get('account.fiscalyear')
start_date=res['date1']
end_date=res['date2']
name=res['name']#DateTime.strptime(start_date, '%Y-%m-%d').strftime('%m.%Y') + '-' + DateTime.strptime(end_date, '%Y-%m-%d').strftime('%m.%Y')
vals={
'name':name,
'code':name,
'date_start':start_date,
'date_stop':end_date,
}
new_id=res_obj.create(cr, uid, vals, context=context)
if res['period']=='month':
res_obj.create_period(cr,uid,[new_id])
elif res['period']=='3months':
res_obj.create_period3(cr,uid,[new_id])
account_config_wizard()
# ---------------------------------------------------------------
# Account Templates : Account, Tax, Tax Code and chart. + Wizard
# ---------------------------------------------------------------
@ -2163,6 +2117,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr,uid,[uid],c)[0].company_id.id,
'chart_template_id': _get_chart,
'code_digits': lambda *a:6,
'seq_journal': True
}
def execute(self, cr, uid, ids, context=None):
@ -2435,10 +2390,14 @@ class account_bank_accounts_wizard(osv.osv_memory):
_name='account.bank.accounts.wizard'
_columns = {
'acc_no':fields.many2one('res.partner.bank','Account No.',required=True),
'acc_name':fields.char('Account Name.', size=64, required=True),
'bank_account_id':fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
'currency_id':fields.many2one('res.currency', 'Currency'),
'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
}
_defaults = {
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
}
account_bank_accounts_wizard()

View File

@ -17,17 +17,51 @@
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">You can enhance OpenERP's basic accounting support with a few additional OpenERP applications</attribute>
<attribute name="string">You can enhance OpenERP's basic accounting support with a few additional OpenERP applications.</attribute>
</xpath>
<group colspan="8">
<separator string="Accounting" colspan="4"/>
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Configure</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>23</attribute>
<attribute name='string'></attribute>
</xpath>
<group colspan="8">
<group colspan="4" height="450" width="600">
<field name="charts"/>
<field name="account_analytic_default"/>
<field name="account_analytic_plans"/>
<field name="account_payment"/>
<field name="account_followup"/>
<field name="account_asset"/>
<group colspan="4">
<separator col="4" colspan="4" string="Configure Fiscal Year"/>
<field name="date_start" on_change="on_change_start_date(date_start)"/>
<field name="date_stop"/>
<field name="period" colspan="4"/>
</group>
<group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
<separator col="4" colspan="4" string="Bank and Cost Account"/>
<field colspan="4" mode="tree" name="bank_accounts_id" nolabel="1" widget="one2many_list">
<form string="">
<field name="acc_name"/>
<field name="account_type"/>
<field name="currency_id" widget="selection"/>
</form>
<tree editable="bottom" string="">
<field name="acc_name"/>
<field name="account_type"/>
<field name="currency_id" widget="selection"/>
</tree>
</field>
</group>
<group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
<field name="sale_tax" colspan="2" on_change="on_change_tax(sale_tax)"/>
<field name="purchase_tax" colspan="2" />
</group>
<group colspan="4" groups="base.group_extended">
<separator col="4" colspan="4" string="Install Extra Account Module"/>
<field name="account_analytic_plans"/>
<field name="account_payment"/>
<field name="account_followup"/>
<field name="account_asset"/>
</group>
</group>
</group>
</data>
</field>
@ -46,6 +80,20 @@
<record id="account_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="action_account_installer"/>
<field name="sequence">3</field>
<field name="restart">onskip</field>
</record>
<record id="account_ir_actions_todo_tree" model="ir.ui.view">
<field name="model">ir.actions.todo</field>
<field name="name">account_installer_action_replace</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base.ir_actions_todo_tree"/>
<field name="arch" type="xml">
<xpath expr="//button[@string='Launch']" position="replace">
<button name="%(action_account_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -1445,49 +1445,6 @@
<act_window domain="[('partner_id', '=', active_id)]" id="act_account_partner_account_move" name="All account entries" res_model="account.move.line" src_model="res.partner"/>
<!-- configuration wizard view -->
<record id="view_account_config_wizard_form" model="ir.ui.view">
<field name="name">Account Configure wizard</field>
<field name="model">account.config.wizard</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Account Configure</attribute>
</form>
<group string="res_config_contents" position="replace">
<separator col="4" colspan="4" string="Create a Fiscal Year"/>
<field name="name"/>
<field name="code"/>
<field name="date1"/>
<field name="date2"/>
<field name="period" colspan="4"/>
</group>
<xpath expr='//button[@name="action_skip"]' position="replace"/>
</data>
</field>
</record>
<record id="action_account_config_wizard_form" model="ir.actions.act_window">
<field name="name">Account Configure Wizard </field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.config.wizard</field>
<field name="view_id" ref="view_account_config_wizard_form"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<!-- register configuration wizard -->
<record id="config_fiscalyear" model="ir.actions.todo">
<field name="action_id" ref="action_account_config_wizard_form"/>
<field name="restart">onskip</field>
</record>
<record id="view_account_addtmpl_wizard_form" model="ir.ui.view">
<field name="name">Account Add wizard</field>
<field name="model">account.addtmpl.wizard</field>
@ -1741,25 +1698,35 @@
<form position="attributes">
<attribute name="string">Generate Chart of Accounts from a Chart Template</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string"
>Generate Chart of Accounts from a Chart Template</attribute>
</separator>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">This will automatically configure your chart of accounts, bank accounts, taxes and journals according to the selected template</attribute>
<attribute name="width">150</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>15</attribute>
<attribute name='string'></attribute>
</xpath>
<group string="res_config_contents" position="replace">
<separator col="4" colspan="4" string="
Generate Chart of Accounts from a Chart Template"/>
<label align="0.0" colspan="4"
string="This will automatically configure your chart of accounts, bank accounts, taxes and journals according to the selected template"/>
<field name="company_id" widget="selection"
groups="base.group_multi_company"/>
/>
<field name ="code_digits" />
<field name="chart_template_id"/>
<field name ="seq_journal" />
<field colspan="4" mode="tree" name="bank_accounts_id"
nolabel="1" widget="one2many_list">
<form string="Bank Information">
<field name="acc_no"/>
<field name="currency_id"/>
<field name="acc_name"/>
<field name="account_type"/>
<field name="currency_id" widget="selection"/>
</form>
<tree editable="bottom" string="Bank Information">
<field name="acc_no"/>
<field name="currency_id"/>
<field name="acc_name"/>
<field name="account_type"/>
<field name="currency_id" widget="selection"/>
</tree>
</field>
</group>

View File

@ -0,0 +1,516 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Types -->
<record model="account.account.type" id="conf_account_type_receivable" >
<field name="name">Receivable</field>
<field name="code">receivable</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="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="conf_account_type_income" >
<field name="name">Income</field>
<field name="code">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="close_method">none</field>
</record>
<record model="account.account.type" id="conf_account_type_tax">
<field name="name">Tax</field>
<field name="code">tax</field>
<field name="close_method">unreconciled</field>
</record>
<record model="account.account.type" id="conf_account_type_cash">
<field name="name">Cash</field>
<field name="code">cash</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="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_equity">
<field name="name">Equity</field>
<field name="code">equity</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_bnk">
<field name="name">Bank</field>
<field name="code">bank</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="code">check</field>
<field name="close_method">balance</field>
</record>
<!-- Account Templates-->
<record id="conf_chart0" model="account.account.template">
<field name="code">0</field>
<field name="name">Configurable Account Chart</field>
<field eval="0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<!-- Balance Sheet -->
<record id="conf_bal" model="account.account.template">
<field name="code">1</field>
<field name="name">Balance Sheet</field>
<field ref="conf_chart0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_fas" model="account.account.template">
<field name="code">10</field>
<field name="name">Fixed Assets</field>
<field ref="conf_bal" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_xfa" model="account.account.template">
<field name="code">100</field>
<field name="name">Fixed Asset Account</field>
<field ref="conf_fas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_asset"/>
</record>
<record id="conf_nca" model="account.account.template">
<field name="code">11</field>
<field name="name">Net Current Assets</field>
<field ref="conf_bal" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_cas" model="account.account.template">
<field name="code">110</field>
<field name="name">Current Assets</field>
<field ref="conf_nca" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_stk" model="account.account.template">
<field name="code">1101</field>
<field name="name">Purchased Stocks</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_asset"/>
</record>
<record id="conf_a_recv" model="account.account.template">
<field name="code">1102</field>
<field name="name">Debtors</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">receivable</field>
<field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_receivable"/>
</record>
<!-- <record id="account.property_account_receivable" model="ir.property">
<field eval="'account.account,'+str(a_recv)" name="value"/>
</record> -->
<record id="conf_ova" model="account.account.template">
<field name="code">1103</field>
<field name="name">Output VAT</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_tax"/>
</record>
<record id="conf_bnk" model="account.account.template">
<field name="code">1104</field>
<field name="name">Bank Current Account</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_cash"/>
</record>
<record id="conf_cash" model="account.account.template">
<field name="code">1105</field>
<field name="name">Cash</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_cash"/>
</record>
<record id="conf_cli" model="account.account.template">
<field name="code">111</field>
<field name="name">Current Liabilities</field>
<field ref="conf_nca" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_a_pay" model="account.account.template">
<field name="code">1111</field>
<field name="name">Creditors</field>
<field ref="conf_cli" name="parent_id"/>
<field name="type">payable</field>
<field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_payable"/>
</record>
<!-- <record id="account.property_account_payable" model="ir.property">
<field eval="'account.account,'+str(a_pay)" name="value"/>
</record>-->
<record id="conf_iva" model="account.account.template">
<field name="code">1112</field>
<field name="name">Input VAT</field>
<field ref="conf_cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_tax"/>
</record>
<!-- Profit and Loss -->
<record id="conf_gpf" model="account.account.template">
<field name="code">2</field>
<field name="name">Profit and Loss</field>
<field ref="conf_chart0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_rev" model="account.account.template">
<field name="code">20</field>
<field name="name">Revenue</field>
<field ref="conf_gpf" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_a_sale" model="account.account.template">
<field name="code">200</field>
<field name="name">Product Sales</field>
<field ref="conf_rev" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_income"/>
</record>
<!-- <record id="account.property_account_income_categ" model="ir.property">
<field eval="'account.account,'+str(a_sale)" name="value"/>
</record> -->
<record id="conf_cos" model="account.account.template">
<field name="code">21</field>
<field name="name">Cost of Sales</field>
<field ref="conf_gpf" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_cog" model="account.account.template">
<field name="code">210</field>
<field name="name">Cost of Goods Sold</field>
<field ref="conf_cos" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/>
</record>
<record id="conf_ovr" model="account.account.template">
<field name="code">22</field>
<field name="name">Overheads</field>
<field ref="conf_gpf" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
</record>
<record id="conf_a_expense" model="account.account.template">
<field name="code">220</field>
<field name="name">Expenses</field>
<field ref="conf_ovr" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/>
</record>
<!-- <record id="account.property_account_expense_categ" model="ir.property">
<field eval="'account.account,'+str(a_expense)" name="value"/>
</record> -->
<!-- Taxes -->
<!-- VAT Code Definitions -->
<!-- Invoiced VAT -->
<!-- Input VAT -->
<record id="vat_code_chart_root" model="account.tax.code.template">
<field name="name">Plan Fees </field>
</record>
<record id="vat_code_balance_net" model="account.tax.code.template">
<field name="name">VAT Balance to Pay</field>
<field name="parent_id" ref="vat_code_chart_root"/>
</record>
<record id="vat_code_input" model="account.tax.code.template">
<field name="name">Input VAT</field>
<field name="parent_id" ref="vat_code_balance_net"/>
<field eval="-1" name="sign"/>
</record>
<record id="vat_code_input_S" model="account.tax.code.template">
<field name="name">Input VAT Rate S (15%)</field>
<field name="parent_id" ref="vat_code_input"/>
</record>
<record id="vat_code_input_R" model="account.tax.code.template">
<field name="name">Input VAT Rate R (5%)</field>
<field name="parent_id" ref="vat_code_input"/>
</record>
<!-- Output VAT -->
<record id="vat_code_output" model="account.tax.code.template">
<field name="name">Output VAT</field>
<field name="parent_id" ref="vat_code_balance_net"/>
</record>
<record id="vat_code_output_S" model="account.tax.code.template">
<field name="name">Output VAT Rate S (15%)</field>
<field name="parent_id" ref="vat_code_output"/>
</record>
<record id="vat_code_output_R" model="account.tax.code.template">
<field name="name">Output VAT Rate R (5%)</field>
<field name="parent_id" ref="vat_code_output"/>
</record>
<!-- Invoiced Base of VAT -->
<!-- Purchases -->
<record id="vat_code_base_net" model="account.tax.code.template">
<field name="name">Tax Bases</field>
<field name="parent_id" ref="vat_code_chart_root"/>
</record>
<record id="vat_code_base_purchases" model="account.tax.code.template">
<field name="name">Taxable Purchases Base</field>
<field name="parent_id" ref="vat_code_base_net"/>
</record>
<record id="vat_code_purch_S" model="account.tax.code.template">
<field name="name">Taxable Purchases Rated S (15%)</field>
<field name="parent_id" ref="vat_code_base_purchases"/>
</record>
<record id="vat_code_purch_R" model="account.tax.code.template">
<field name="name">Taxable Purchases Rated R (5%)</field>
<field name="parent_id" ref="vat_code_base_purchases"/>
</record>
<record id="vat_code_purch_Z" model="account.tax.code.template">
<field name="name">Taxable Purchases Rated Z (0%)</field>
<field name="parent_id" ref="vat_code_base_purchases"/>
</record>
<record id="vat_code_purch_X" model="account.tax.code.template">
<field name="name">Taxable Purchases Type X (Exempt)</field>
<field name="parent_id" ref="vat_code_base_purchases"/>
</record>
<record id="vat_code_purch_O" model="account.tax.code.template">
<field name="name">Taxable Purchases Type O (Out of scope)</field>
<field name="parent_id" ref="vat_code_base_purchases"/>
</record>
<!-- Sales -->
<record id="vat_code_base_sales" model="account.tax.code.template">
<field name="name">Base of Taxable Sales</field>
<field name="parent_id" ref="vat_code_base_net"/>
</record>
<record id="vat_code_sales_S" model="account.tax.code.template">
<field name="name">Taxable Sales Rated S (15%)</field>
<field name="parent_id" ref="vat_code_base_sales"/>
</record>
<record id="vat_code_sales_R" model="account.tax.code.template">
<field name="name">Taxable Sales Rated R (5%)</field>
<field name="parent_id" ref="vat_code_base_sales"/>
</record>
<record id="vat_code_sales_Z" model="account.tax.code.template">
<field name="name">Taxable Sales Rated Z (0%)</field>
<field name="parent_id" ref="vat_code_base_sales"/>
</record>
<record id="vat_code_sales_X" model="account.tax.code.template">
<field name="name">Taxable Sales Type X (Exempt)</field>
<field name="parent_id" ref="vat_code_base_sales"/>
</record>
<record id="vat_code_sales_O" model="account.tax.code.template">
<field name="name">Taxable Sales Type O (Out of scope)</field>
<field name="parent_id" ref="vat_code_base_sales"/>
</record>
<record id="configurable_chart_template" model="account.chart.template">
<field name="name">Configurable Account Chart Template</field>
<field name="account_root_id" ref="conf_chart0"/>
<field name="tax_code_root_id" ref="vat_code_chart_root"/>
<field name="bank_account_view_id" ref="conf_bnk"/>
<field name="property_account_receivable" ref="conf_a_recv"/>
<field name="property_account_payable" ref="conf_a_pay"/>
<field name="property_account_expense_categ" ref="conf_a_expense"/>
<field name="property_account_income_categ" ref="conf_a_sale"/>
</record>
<!-- VAT Codes -->
<!-- Purchases + Input VAT -->
<record id="ivats" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">IVAT S</field>
<field eval="0.15" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="conf_iva"/>
<field name="account_paid_id" ref="conf_iva"/>
<field name="base_code_id" ref="vat_code_purch_S"/>
<field name="tax_code_id" ref="vat_code_input_S"/>
<field name="ref_base_code_id" ref="vat_code_purch_S"/>
<field name="ref_tax_code_id" ref="vat_code_input_S"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="ivatr" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">IVAT R</field>
<field eval="0.005" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="conf_iva"/>
<field name="account_paid_id" ref="conf_iva"/>
<field name="base_code_id" ref="vat_code_purch_R"/>
<field name="tax_code_id" ref="vat_code_input_R"/>
<field name="ref_base_code_id" ref="vat_code_purch_R"/>
<field name="ref_tax_code_id" ref="vat_code_input_R"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="ivatz" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">IVAT Z</field>
<field eval="0.0" name="amount"/>
<field name="type">percent</field>
<field name="base_code_id" ref="vat_code_purch_Z"/>
<field name="ref_base_code_id" ref="vat_code_purch_Z"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="ivatx" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">IVAT X</field>
<field eval="0.0" name="amount"/>
<field name="type">percent</field>
<field name="base_code_id" ref="vat_code_purch_X"/>
<field name="ref_base_code_id" ref="vat_code_purch_X"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="ivato" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">IVAT O</field>
<field eval="0.0" name="amount"/>
<field name="type">percent</field>
<field name="base_code_id" ref="vat_code_purch_O"/>
<field name="ref_base_code_id" ref="vat_code_purch_O"/>
<field name="type_tax_use">purchase</field>
</record>
<!-- Sales + Output VAT -->
<record id="ovats" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">OVAT S</field>
<field eval="0.15" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="conf_ova"/>
<field name="account_paid_id" ref="conf_ova"/>
<field name="base_code_id" ref="vat_code_sales_S"/>
<field name="tax_code_id" ref="vat_code_output_S"/>
<field name="ref_base_code_id" ref="vat_code_sales_S"/>
<field name="ref_tax_code_id" ref="vat_code_output_S"/>
<field name="type_tax_use">sale</field>
</record>
<record id="ovatr" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">OVAT R</field>
<field eval="0.005" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="conf_ova"/>
<field name="account_paid_id" ref="conf_ova"/>
<field name="base_code_id" ref="vat_code_sales_R"/>
<field name="tax_code_id" ref="vat_code_output_R"/>
<field name="ref_base_code_id" ref="vat_code_sales_R"/>
<field name="ref_tax_code_id" ref="vat_code_output_R"/>
<field name="type_tax_use">sale</field>
</record>
<record id="ovatz" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">OVAT Z</field>
<field eval="0.0" name="amount"/>
<field name="type">percent</field>
<field name="base_code_id" ref="vat_code_sales_Z"/>
<field name="ref_base_code_id" ref="vat_code_sales_Z"/>
<field name="type_tax_use">sale</field>
</record>
<record id="ovatx" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">OVAT X</field>
<field eval="0.0" name="amount"/>
<field name="type">percent</field>
<field name="base_code_id" ref="vat_code_sales_X"/>
<field name="ref_base_code_id" ref="vat_code_sales_X"/>
<field name="type_tax_use">sale</field>
</record>
<record id="ovato" model="account.tax.template">
<field name="chart_template_id" ref="configurable_chart_template"/>
<field name="name">OVAT O</field>
<field eval="0.0" name="amount"/>
<field name="type">percent</field>
<field name="base_code_id" ref="vat_code_sales_O"/>
<field name="ref_base_code_id" ref="vat_code_sales_O"/>
<field name="type_tax_use">sale</field>
</record>
</data>
</openerp>

View File

@ -785,10 +785,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree

View File

@ -805,10 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree

View File

@ -819,11 +819,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -816,11 +816,6 @@ msgstr "(Ostaviti prazno za sve otvorene fiskalne godine)"
msgid "Move Lines"
msgstr "Retci prijenosa"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -829,11 +829,6 @@ msgstr "(deixar-lo buit per a tots els exercicis fiscals oberts)"
msgid "Move Lines"
msgstr "Línies moviment"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.assistent"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -809,11 +809,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -811,11 +811,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -827,11 +827,6 @@ msgstr "(frei lassen für alle Wirtschaftsjahre)"
msgid "Move Lines"
msgstr "Buchungszeilen"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -829,11 +829,6 @@ msgstr "(Διατηρήστε κενό για όλα τα ανοιχτά λογ
msgid "Move Lines"
msgstr "Μετακίνηση Γραμμών"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -828,11 +828,6 @@ msgstr "(dejarlo vacío para todos los ejercicios fiscales abiertos)"
msgid "Move Lines"
msgstr "Líneas movimiento"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.asistente"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -827,11 +827,6 @@ msgstr "(dejar vacío para todos los ejercicios fiscales abiertos)"
msgid "Move Lines"
msgstr "Líneas del movimiento"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "asistente.configuracion.contable"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -826,11 +826,6 @@ msgstr "(dejarlo vacío para todos los ejercicios fiscales abiertos)"
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -807,11 +807,6 @@ msgstr "(Jäta tühjaks kõigi avatud majandusaastate jaoks)"
msgid "Move Lines"
msgstr "Liiguta read"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -826,11 +826,6 @@ msgstr "(Jätä tyhjäksi käyttääksesi kaikkia avoimia tilikausia)"
msgid "Move Lines"
msgstr "Siirron rivit"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -1240,11 +1240,6 @@ msgstr "Livre de coûts"
msgid "Move Lines"
msgstr "Lignes de mouvements"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,10 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -805,11 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -805,11 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -826,11 +826,6 @@ msgstr "(Lasciare vuoto per tutti gli esercizi fiscali aperti)"
msgid "Move Lines"
msgstr "Righe Movimentate"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,10 +806,7 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -809,11 +809,6 @@ msgstr "(palikite tuščią, jei norite visų atvirų fiskalinių metų)"
msgid "Move Lines"
msgstr "Didžiosios knygos įrašai"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -818,11 +818,6 @@ msgstr "(Atstāt tukšu visiem nenoslēgtajiem fiskālajiem gadiem)"
msgid "Move Lines"
msgstr "Grāmatojumu Rindas"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -827,11 +827,6 @@ msgstr "(laat leeg om alle boekjaren mee te nemen)"
msgid "Move Lines"
msgstr "Verplaats boekingsregels"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -805,11 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -808,10 +808,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree

View File

@ -825,11 +825,6 @@ msgstr "(Pozostaw puste dla wszystkich otwartych lat podatkowych)"
msgid "Move Lines"
msgstr "Pozycje zapisów"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -823,11 +823,6 @@ msgstr "(Manter vazio para todos os anos fiscais aberto)"
msgid "Move Lines"
msgstr "Linhas de movimentos"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -826,11 +826,6 @@ msgstr "(Manter vazio para todos os anos fiscais abertos)"
msgid "Move Lines"
msgstr "Mover Linhas"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -827,11 +827,6 @@ msgstr "(Lasaţi necompletat pentru toţi anii fiscali deschişi)"
msgid "Move Lines"
msgstr "Linii mişcări"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -820,11 +820,6 @@ msgstr "Оставить пустым для всех открытых фина
msgid "Move Lines"
msgstr "Строки финансового документа"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "Мастер конфигурации"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -809,11 +809,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -818,11 +818,6 @@ msgstr "(Prazno za vsa odprta davčna leta)"
msgid "Move Lines"
msgstr "Postavke knjižb"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -828,11 +828,6 @@ msgstr "(Mbaje zbrazët për të gjitha vitet fiskale)"
msgid "Move Lines"
msgstr "Lëviz Linjat"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -809,11 +809,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -815,11 +815,6 @@ msgstr "(tomt för alla öppna verksamhetsår)"
msgid "Move Lines"
msgstr "Flytta rader"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "account.config.wizard"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -805,11 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -805,11 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr "Hareket Kalemleri"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -805,11 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -817,11 +817,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -808,11 +808,6 @@ msgstr "(留空为所有开启的会计年度)"
msgid "Move Lines"
msgstr "凭证明细"
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr "科目.设置.向导"
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -806,11 +806,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -805,11 +805,6 @@ msgstr ""
msgid "Move Lines"
msgstr ""
#. module: account
#: model:ir.model,name:account.model_account_config_wizard
msgid "account.config.wizard"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree
#: model:ir.ui.menu,name:account.report_account_analytic_journal_print

View File

@ -18,22 +18,34 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import datetime
from dateutil.relativedelta import relativedelta
from tools.translate import _
from operator import itemgetter
from osv import fields, osv
import netsvc
import tools
from os.path import join as opj
class account_installer(osv.osv_memory):
_name = 'account.installer'
_inherit = 'res.config.installer'
def _get_default_accounts(self, cr, uid, context=None):
accounts = [{'acc_name':'Current','account_type':'cash'},
{'acc_name':'Deposit','account_type':'cash'}]
return accounts
def _get_charts(self, cr, uid, context=None):
modules = self.pool.get('ir.module.module')
ids = modules.search(cr, uid, [('category_id','=','Account Charts')])
return list(
charts = list(
sorted(((m.name, m.shortdesc)
for m in modules.browse(cr, uid, ids)),
key=itemgetter(1)))
charts.insert(0,('configurable','Generic Chart Of Account'))
return charts
_columns = {
# Accounting
@ -42,9 +54,6 @@ class account_installer(osv.osv_memory):
help="Installs localized accounting charts to match as closely as "
"possible the accounting needs of your company based on your "
"country."),
'account_analytic_default':fields.boolean('Analytic Accounting',
help="Automatically selects analytic accounts based on various "
"criteria."),
'account_analytic_plans':fields.boolean('Multiple Analytic Plans',
help="Allows invoice lines to impact multiple analytic accounts "
"simultaneously."),
@ -57,16 +66,423 @@ class account_installer(osv.osv_memory):
"per-partner policies."),
'account_asset':fields.boolean('Assets Management',
help="Enables asset management in the accounting application, "
"including asset categories and usage periods.")
"including asset categories and usage periods."),
'date_start': fields.date('Start Date', required=True),
'date_stop': fields.date('End Date', required=True),
'period':fields.selection([('month','Monthly'), ('3months','3 Monthly')],
'Periods', required=True),
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Bank Accounts',required=True),
'sale_tax':fields.float('Sale Tax(%)'),
'purchase_tax':fields.float('Purchase Tax(%)')
}
_defaults = {
'account_analytic_default':True,
'date_start': lambda *a: time.strftime('%Y-01-01'),
'date_stop': lambda *a: time.strftime('%Y-12-31'),
'period':lambda *a:'month',
'sale_tax':lambda *a:0.0,
'purchase_tax':lambda *a:0.0,
#'charts':'configurable',
'bank_accounts_id':_get_default_accounts
}
def on_change_tax(self, cr, uid, id, tax):
return{'value':{'purchase_tax':tax}}
def on_change_start_date(self, cr, uid, id, start_date):
if start_date:
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d")
end_date = (start_date + relativedelta(months=12)) - relativedelta(days=1)
return {'value':{'date_stop':end_date.strftime('%Y-%m-%d')}}
return {}
def generate_configurable_chart(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
obj_multi = self.pool.get('account.chart.template').browse(cr,uid, id)
obj_acc = self.pool.get('account.account')
obj_acc_tax = self.pool.get('account.tax')
obj_journal = self.pool.get('account.journal')
obj_sequence = self.pool.get('ir.sequence')
obj_acc_template = self.pool.get('account.account.template')
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
obj_fiscal_position = self.pool.get('account.fiscal.position')
company_id = self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id
seq_journal = True
# Creating Account
obj_acc_root = obj_multi.account_root_id
tax_code_root_id = obj_multi.tax_code_root_id.id
#new code
acc_template_ref = {}
tax_template_ref = {}
tax_code_template_ref = {}
todo_dict = {}
#create all the tax code
children_tax_code_template = self.pool.get('account.tax.code.template').search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id')
children_tax_code_template.sort()
for tax_code_template in self.pool.get('account.tax.code.template').browse(cr, uid, children_tax_code_template):
vals={
'name': (tax_code_root_id == tax_code_template.id) and company_id.name or tax_code_template.name,
'code': tax_code_template.code,
'info': tax_code_template.info,
'parent_id': tax_code_template.parent_id and ((tax_code_template.parent_id.id in tax_code_template_ref) and tax_code_template_ref[tax_code_template.parent_id.id]) or False,
'company_id': company_id.id,
'sign': tax_code_template.sign,
}
new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals)
#recording the new tax code to do the mapping
tax_code_template_ref[tax_code_template.id] = new_tax_code
#create all the tax
for tax in obj_multi.tax_template_ids:
#create it
vals_tax = {
'name':tax.name,
'sequence': tax.sequence,
'amount':tax.amount,
'type':tax.type,
'applicable_type': tax.applicable_type,
'domain':tax.domain,
'parent_id': tax.parent_id and ((tax.parent_id.id in tax_template_ref) and tax_template_ref[tax.parent_id.id]) or False,
'child_depend': tax.child_depend,
'python_compute': tax.python_compute,
'python_compute_inv': tax.python_compute_inv,
'python_applicable': tax.python_applicable,
'tax_group':tax.tax_group,
'base_code_id': tax.base_code_id and ((tax.base_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.base_code_id.id]) or False,
'tax_code_id': tax.tax_code_id and ((tax.tax_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.tax_code_id.id]) or False,
'base_sign': tax.base_sign,
'tax_sign': tax.tax_sign,
'ref_base_code_id': tax.ref_base_code_id and ((tax.ref_base_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.ref_base_code_id.id]) or False,
'ref_tax_code_id': tax.ref_tax_code_id and ((tax.ref_tax_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.ref_tax_code_id.id]) or False,
'ref_base_sign': tax.ref_base_sign,
'ref_tax_sign': tax.ref_tax_sign,
'include_base_amount': tax.include_base_amount,
'description':tax.description,
'company_id': company_id.id,
'type_tax_use': tax.type_tax_use
}
new_tax = obj_acc_tax.create(cr,uid,vals_tax)
#as the accounts have not been created yet, we have to wait before filling these fields
todo_dict[new_tax] = {
'account_collected_id': tax.account_collected_id and tax.account_collected_id.id or False,
'account_paid_id': tax.account_paid_id and tax.account_paid_id.id or False,
}
tax_template_ref[tax.id] = new_tax
#deactivate the parent_store functionnality on account_account for rapidity purpose
self.pool._init = True
children_acc_template = obj_acc_template.search(cr, uid, [('parent_id','child_of',[obj_acc_root.id]),('nocreate','!=',True)])
children_acc_template.sort()
for account_template in obj_acc_template.browse(cr, uid, children_acc_template):
tax_ids = []
for tax in account_template.tax_ids:
tax_ids.append(tax_template_ref[tax.id])
#create the account_account
dig = 6
code_main = account_template.code and len(account_template.code) or 0
code_acc = account_template.code or ''
if code_main>0 and code_main<=dig and account_template.type != 'view':
code_acc=str(code_acc) + (str('0'*(dig-code_main)))
vals={
'name': (obj_acc_root.id == account_template.id) and company_id.name or account_template.name,
#'sign': account_template.sign,
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
'code': code_acc,
'type': account_template.type,
'user_type': account_template.user_type and account_template.user_type.id or False,
'reconcile': account_template.reconcile,
'shortcut': account_template.shortcut,
'note': account_template.note,
'parent_id': account_template.parent_id and ((account_template.parent_id.id in acc_template_ref) and acc_template_ref[account_template.parent_id.id]) or False,
'tax_ids': [(6,0,tax_ids)],
'company_id': company_id.id,
}
new_account = obj_acc.create(cr,uid,vals)
acc_template_ref[account_template.id] = new_account
if account_template.name == 'Bank Current Account':
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Cash Journal View')])[0]
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Multi-Currency Cash Journal View')])[0]
ref_acc_bank = obj_multi.bank_account_view_id
cash_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_cash')
cash_type_id = mod_obj.read(cr, uid, [cash_result], ['res_id'])[0]['res_id']
bank_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_bnk')
bank_type_id = mod_obj.read(cr, uid, [bank_result], ['res_id'])[0]['res_id']
check_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_chk')
check_type_id = mod_obj.read(cr, uid, [check_result], ['res_id'])[0]['res_id']
record = self.browse(cr, uid, ids, context=context)[0]
code_cnt = 1
vals_seq = {
'name': _('Bank Journal '),
'code': 'account.journal',
}
seq_id = obj_sequence.create(cr,uid,vals_seq)
#create the bank journal
vals_journal = {}
vals_journal['name']= _('Bank Journal ')
vals_journal['code']= _('BNK')
vals_journal['sequence_id'] = seq_id
vals_journal['type'] = 'cash'
if vals.get('currency_id', False):
vals_journal['view_id'] = view_id_cur
vals_journal['currency'] = vals.get('currency_id', False)
else:
vals_journal['view_id'] = view_id_cash
vals_journal['default_credit_account_id'] = new_account
vals_journal['default_debit_account_id'] = new_account
obj_journal.create(cr,uid,vals_journal)
for val in record.bank_accounts_id:
if val.account_type == 'cash':type = cash_type_id
elif val.account_type == 'bank':type = bank_type_id
else:type = check_type_id
vals_bnk = {'name': val.acc_name or '',
'currency_id': val.currency_id.id or False,
'code': str(110400 + code_cnt),
'type': 'other',
'user_type': type,
'parent_id':new_account,
'company_id': company_id.id }
child_bnk_acc = obj_acc.create(cr, uid, vals_bnk)
vals_seq_child = {
'name': _(vals_bnk['name']),
'code': 'account.journal',
}
seq_id = obj_sequence.create(cr, uid, vals_seq_child)
#create the bank journal
vals_journal = {}
vals_journal['name']= vals_bnk['name'] + ' Journal'
vals_journal['code']= _(vals_bnk['name'][:3])
vals_journal['sequence_id'] = seq_id
vals_journal['type'] = 'cash'
if vals.get('currency_id', False):
vals_journal['view_id'] = view_id_cur
vals_journal['currency'] = vals_bnk.get('currency_id', False)
else:
vals_journal['view_id'] = view_id_cash
vals_journal['default_credit_account_id'] = child_bnk_acc
vals_journal['default_debit_account_id'] = child_bnk_acc
obj_journal.create(cr,uid,vals_journal)
code_cnt += 1
#reactivate the parent_store functionnality on account_account
self.pool._init = False
self.pool.get('account.account')._parent_store_compute(cr)
for key,value in todo_dict.items():
if value['account_collected_id'] or value['account_paid_id']:
obj_acc_tax.write(cr, uid, [key], {
'account_collected_id': acc_template_ref[value['account_collected_id']],
'account_paid_id': acc_template_ref[value['account_paid_id']],
})
# Creating Journals
vals_journal={}
view_id = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Journal View')])[0]
seq_id = obj_sequence.search(cr,uid,[('name','=','Account Journal')])[0]
if seq_journal:
seq_id_sale = obj_sequence.search(cr,uid,[('name','=','Sale Journal')])[0]
seq_id_purchase = obj_sequence.search(cr,uid,[('name','=','Purchase Journal')])[0]
else:
seq_id_sale = seq_id
seq_id_purchase = seq_id
vals_journal['view_id'] = view_id
#Sales Journal
vals_journal['name'] = _('Sales Journal')
vals_journal['type'] = 'sale'
vals_journal['code'] = _('SAJ')
vals_journal['sequence_id'] = seq_id_sale
if obj_multi.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
obj_journal.create(cr,uid,vals_journal)
# Purchase Journal
vals_journal['name'] = _('Purchase Journal')
vals_journal['type'] = 'purchase'
vals_journal['code'] = _('EXJ')
vals_journal['sequence_id'] = seq_id_purchase
if obj_multi.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
obj_journal.create(cr,uid,vals_journal)
# Bank Journals
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Cash Journal View')])[0]
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Multi-Currency Cash Journal View')])[0]
ref_acc_bank = obj_multi.bank_account_view_id
#create the properties
property_obj = self.pool.get('ir.property')
fields_obj = self.pool.get('ir.model.fields')
todo_list = [
('property_account_receivable','res.partner','account.account'),
('property_account_payable','res.partner','account.account'),
('property_account_expense_categ','product.category','account.account'),
('property_account_income_categ','product.category','account.account'),
('property_account_expense','product.template','account.account'),
('property_account_income','product.template','account.account')
]
for record in todo_list:
r = []
r = property_obj.search(cr, uid, [('name','=', record[0] ),('company_id','=',company_id.id)])
account = getattr(obj_multi, record[0])
field = fields_obj.search(cr, uid, [('name','=',record[0]),('model','=',record[1]),('relation','=',record[2])])
vals = {
'name': record[0],
'company_id': company_id.id,
'fields_id': field[0],
'value': account and 'account.account,'+str(acc_template_ref[account.id]) or False,
}
if r:
#the property exist: modify it
property_obj.write(cr, uid, r, vals)
else:
#create the property
property_obj.create(cr, uid, vals)
fp_ids = obj_fiscal_position_template.search(cr, uid,[('chart_template_id', '=', obj_multi.id)])
if fp_ids:
for position in obj_fiscal_position_template.browse(cr, uid, fp_ids):
vals_fp = {
'company_id' : company_id.id,
'name' : position.name,
}
new_fp = obj_fiscal_position.create(cr, uid, vals_fp)
obj_tax_fp = self.pool.get('account.fiscal.position.tax')
obj_ac_fp = self.pool.get('account.fiscal.position.account')
for tax in position.tax_ids:
vals_tax = {
'tax_src_id' : tax_template_ref[tax.tax_src_id.id],
'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
'position_id' : new_fp,
}
obj_tax_fp.create(cr, uid, vals_tax)
for acc in position.account_ids:
vals_acc = {
'account_src_id' : acc_template_ref[acc.account_src_id.id],
'account_dest_id' : acc_template_ref[acc.account_dest_id.id],
'position_id' : new_fp,
}
obj_ac_fp.create(cr, uid, vals_acc)
def execute(self, cr, uid, ids, context=None):
super(account_installer, self).execute(cr, uid, ids, context=context)
record = self.browse(cr, uid, ids, context=context)[0]
company_id = self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id
for res in self.read(cr,uid,ids):
if record.charts == 'configurable':
mod_obj = self.pool.get('ir.model.data')
fp = tools.file_open(opj('account','configurable_account_chart.xml'))
tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None)
fp.close()
self.generate_configurable_chart(cr, uid, ids, context=context)
obj_tax = self.pool.get('account.tax')
obj_product = self.pool.get('product.product')
ir_values = self.pool.get('ir.values')
s_tax = (res.get('sale_tax',0.0))/100
p_tax = (res.get('purchase_tax',0.0))/100
tax_val = {}
default_tax = []
pur_tax_parent = mod_obj._get_id(cr, uid, 'account', 'vat_code_base_purchases')
pur_tax_parent_id = mod_obj.read(cr, uid, [pur_tax_parent], ['res_id'])[0]['res_id']
sal_tax_parent = mod_obj._get_id(cr, uid, 'account', 'vat_code_base_sales')
sal_tax_parent_id = mod_obj.read(cr, uid, [sal_tax_parent], ['res_id'])[0]['res_id']
if s_tax*100 > 0.0:
vals_tax_code = {
'name': 'VAT%s%%'%(s_tax*100),
'code': 'VAT%s%%'%(s_tax*100),
'company_id': company_id.id,
'sign': 1,
'parent_id':sal_tax_parent_id
}
new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals_tax_code)
sales_tax = obj_tax.create(cr, uid,
{'name':'VAT%s%%'%(s_tax*100),
'description':'VAT%s%%'%(s_tax*100),
'amount':s_tax,
'base_code_id':new_tax_code,
'tax_code_id':new_tax_code,
'type_tax_use':'sale'
})
tax_val.update({'taxes_id':[(6,0,[sales_tax])]})
default_tax.append(('taxes_id',sales_tax))
if p_tax*100 > 0.0:
vals_tax_code = {
'name': 'VAT%s%%'%(p_tax*100),
'code': 'VAT%s%%'%(p_tax*100),
'company_id': company_id.id,
'sign': 1,
'parent_id':pur_tax_parent_id
}
new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals_tax_code)
purchase_tax = obj_tax.create(cr, uid,
{'name':'VAT%s%%'%(p_tax*100),
'description':'VAT%s%%'%(p_tax*100),
'amount':p_tax,
'base_code_id':new_tax_code,
'tax_code_id':new_tax_code,
'type_tax_use':'purchase'
})
tax_val.update({'supplier_taxes_id':[(6,0,[purchase_tax])]})
default_tax.append(('supplier_taxes_id',purchase_tax))
if len(tax_val):
product_ids = obj_product.search(cr,uid, [])
for product in obj_product.browse(cr, uid, product_ids):
obj_product.write(cr, uid, product.id, tax_val)
for name, value in default_tax:
ir_values.set(cr, uid, key='default', key2=False, name=name, models =[('product.product',False)], value=[value])
if 'date_start' in res and 'date_stop' in res:
name = code = res['date_start'][:4]
if int(name) != int(res['date_stop'][:4]):
name = res['date_start'][:4] +'-'+ res['date_stop'][:4]
code = res['date_start'][2:4] +'-'+ res['date_stop'][2:4]
res_obj = self.pool.get('account.fiscalyear')
vals = {'name':name,
'code':code,
'date_start':res['date_start'],
'date_stop':res['date_stop'],
}
period_id = res_obj.create(cr, uid, vals, context=context)
if res['period'] == 'month':
res_obj.create_period(cr, uid, [period_id])
elif res['period'] == '3months':
res_obj.create_period3(cr, uid, [period_id])
def modules_to_install(self, cr, uid, ids, context=None):
modules = super(account_installer, self).modules_to_install(
cr, uid, ids, context=context)
chart = self.read(cr, uid, ids, ['charts'],
context=context)[0]['charts']
self.logger.notifyChannel(
@ -76,3 +492,18 @@ class account_installer(osv.osv_memory):
account_installer()
class account_bank_accounts_wizard(osv.osv_memory):
_name='account.bank.accounts.wizard'
_columns = {
'acc_name':fields.char('Account Name.', size=64, required=True),
'bank_account_id':fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
'currency_id':fields.many2one('res.currency', 'Currency'),
'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
}
_defaults = {
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
}
account_bank_accounts_wizard()

View File

@ -1,26 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="analytic_root" model="account.analytic.account">
<field name="name">Analytic Chart</field>
<field name="code">0</field>
</record>
<record id="analytic_absences" model="account.analytic.account">
<field name="name">Leaves</field>
<field name="code">1</field>
<field name="parent_id" ref="analytic_root"/>
</record>
<record id="analytic_internal" model="account.analytic.account">
<field name="name">Internal</field>
<field name="code">2</field>
<field name="parent_id" ref="analytic_root"/>
</record>
<record id="analytic_our_super_product" model="account.analytic.account">
<field name="name">Our Super Product</field>
<field name="code">100</field>
<field name="state">open</field>
<field name="parent_id" ref="analytic_root"/>
</record>
<record id="analytic_project_1" model="account.analytic.account">
<field name="name">Project 1</field>
<field name="code">101</field>
<field name="parent_id" ref="analytic_root"/>
</record>
<record id="analytic_project_2" model="account.analytic.account">
<field name="name">Project 2</field>
<field name="code">102</field>
<field name="parent_id" ref="analytic_root"/>
</record>
<record id="analytic_journal_trainings" model="account.analytic.account">
<field name="name">Training</field>

View File

@ -65,8 +65,6 @@
"access_account_fiscalyear_invoice","account.fiscalyear.invoice","model_account_fiscalyear","account.group_account_invoice",1,0,0,0
"access_res_currency_account_manager","res.currency account manager","base.model_res_currency","group_account_manager",1,1,1,1
"access_res_currency_rate_account_manager","res.currency.rate account manager","base.model_res_currency_rate","group_account_manager",1,1,1,1
"access_account_config_wizard_account_manager","account.config.wizard account manager","model_account_config_wizard","group_account_manager",1,1,1,1
"access_account_config_wizard_system_manager","account.config.wizard system manager","model_account_config_wizard","base.group_system",1,1,1,1
"access_account_add_tmpl_wizard_account_manager","account.addtmpl.wizard account manager","model_account_addtmpl_wizard","group_account_manager",1,1,1,1
"access_account_add_tmpl_wizard_system_manager","account.addtmpl.wizard system manager","model_account_addtmpl_wizard","base.group_system",1,1,1,1
"access_account_invoice_user","account.invoice user","model_account_invoice","base.group_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
65 access_account_fiscalyear_invoice account.fiscalyear.invoice model_account_fiscalyear account.group_account_invoice 1 0 0 0
66 access_res_currency_account_manager res.currency account manager base.model_res_currency group_account_manager 1 1 1 1
67 access_res_currency_rate_account_manager res.currency.rate account manager base.model_res_currency_rate group_account_manager 1 1 1 1
access_account_config_wizard_account_manager account.config.wizard account manager model_account_config_wizard group_account_manager 1 1 1 1
access_account_config_wizard_system_manager account.config.wizard system manager model_account_config_wizard base.group_system 1 1 1 1
68 access_account_add_tmpl_wizard_account_manager account.addtmpl.wizard account manager model_account_addtmpl_wizard group_account_manager 1 1 1 1
69 access_account_add_tmpl_wizard_system_manager account.addtmpl.wizard system manager model_account_addtmpl_wizard base.group_system 1 1 1 1
70 access_account_invoice_user account.invoice user model_account_invoice base.group_user 1 0 0 0

View File

@ -11,6 +11,9 @@
<form position="attributes">
<attribute name="string">Install Extra Modules</attribute>
</form>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>
</xpath>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">Install more modules. A few modules are proposed according to the Association Profile you selected. You will be able to install them based on our requirements.</attribute>
@ -45,5 +48,16 @@
<field name="action_id" ref="action_config_install_module"/>
<field name="sequence">3</field>
</record>
<record id="association_ir_actions_todo_tree" model="ir.ui.view">
<field name="model">ir.actions.todo</field>
<field name="name">association_installer_action_replace</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base.ir_actions_todo_tree"/>
<field name="arch" type="xml">
<xpath expr="//button[@string='Launch']" position="replace">
<button name="%(action_config_install_module)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -44,15 +44,6 @@ class base_action_rule(osv.osv):
return self.state_get(cr, uid, context=context)
def _priority_get(self, cr, uid, context={}):
""" Get Priority
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values """
return self.priority_get(cr, uid, context=context)
def state_get(self, cr, uid, context={}):
""" Get State
@param self: The object pointer
@ -60,7 +51,7 @@ class base_action_rule(osv.osv):
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values """
return [('','')]
return [('', '')]
def priority_get(self, cr, uid, context={}):
""" Get Priority
@ -69,81 +60,78 @@ class base_action_rule(osv.osv):
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values """
return [('','')]
return [('', '')]
_columns = {
'name': fields.many2one('ir.model', 'Model', required=True),
'max_level': fields.integer('Max Level', help='Specifies maximum level.'),
'create_date': fields.datetime('Create Date', readonly=1),
'name': fields.many2one('ir.model', 'Object', required=True),
'max_level': fields.integer('Max Level', help='Specifies maximum level.'),
'create_date': fields.datetime('Create Date', readonly=1),
'active': fields.boolean('Active', help="If the active field is set to true,\
it will allow you to hide the rule without removing it."),
'sequence': fields.integer('Sequence', help="Gives the sequence order when\
displaying a list of rules."),
it will allow you to hide the rule without removing it."),
'sequence': fields.integer('Sequence', help="Gives the sequence order \
when displaying a list of rules."),
'trg_date_type': fields.selection([
('none','None'),
('create','Creation Date'),
('action_last','Last Action Date'),
('date','Date'),
('deadline', 'Deadline'),
], 'Trigger Date', size=16),
'trg_date_range': fields.integer('Delay after trigger date',help="Delay After Trigger Date,\
specifies you can put a negative number " \
"if you need a delay before the trigger date, like sending a reminder 15 minutes before a meeting."),
'trg_date_range_type': fields.selection([('minutes', 'Minutes'),('hour','Hours'),\
('day','Days'),('month','Months')], 'Delay type'),
('none', 'None'),
('create', 'Creation Date'),
('action_last', 'Last Action Date'),
('date', 'Date'),
('deadline', 'Deadline'),
], 'Trigger Date', size=16),
'trg_date_range': fields.integer('Delay after trigger date', \
help="Delay After Trigger Date,\
specifies you can put a negative number. If you need a delay before the \
trigger date, like sending a reminder 15 minutes before a meeting."),
'trg_date_range_type': fields.selection([('minutes', 'Minutes'), ('hour', 'Hours'), \
('day', 'Days'), ('month', 'Months')], 'Delay type'),
'trg_user_id': fields.many2one('res.users', 'Responsible'),
'trg_user_id': fields.many2one('res.users', 'Responsible'),
'trg_partner_id': fields.many2one('res.partner', 'Partner'),
'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'),
'trg_state_from': fields.selection(_state_get, 'State', size=16),
'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16),
'trg_priority_from': fields.selection(_priority_get, 'Minimum Priority'),
'trg_priority_to': fields.selection(_priority_get, 'Maximum Priority'),
'trg_partner_id': fields.many2one('res.partner', 'Partner'),
'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'),
'trg_state_from': fields.selection(_state_get, 'State', size=16),
'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16),
'act_method': fields.char('Call Object Method', size=64),
'act_user_id': fields.many2one('res.users', 'Set responsible to'),
'act_state': fields.selection(_state_get, 'Set state to', size=16),
'act_priority': fields.selection(_priority_get, 'Set priority to'),
'act_email_cc': fields.char('Add watchers (Cc)', size=250, help="These people\
will receive a copy of the future communication between partner and users by email"),
'act_remind_partner': fields.boolean('Remind Partner', help="Check this if\
you want the rule to send a reminder by email to the partner."),
'act_remind_user': fields.boolean('Remind responsible', help="Check this if \
you want the rule to send a reminder by email to the user."),
'act_reply_to': fields.char('Reply-To', size=64),
'act_remind_attach': fields.boolean('Remind with attachment', help="Check this if\
you want that all documents attached to the object be attached \
to the reminder email sent."),
'act_mail_to_user': fields.boolean('Mail to responsible',help="Check this if \
you want the rule to send an email to the responsible person."),
'act_mail_to_watchers': fields.boolean('Mail to watchers (CC)',help="Check this\
if you want the rule to mark CC(mail to any other person\
defined in actions)."),
'act_mail_to_email': fields.char('Mail to these emails', size=128,help="Email-id \
of the persons whom mail is to be sent"),
'act_mail_body': fields.text('Mail body',help="Content of mail"),
'regex_name': fields.char('Regular Expression on Model Name', size=128),
'server_action_id': fields.many2one('ir.actions.server','Server Action',help="Describes the\
action name." \
"eg:on which object which action to be taken on basis of which condition"),
'act_method': fields.char('Call Object Method', size=64),
'act_user_id': fields.many2one('res.users', 'Set responsible to'),
'act_state': fields.selection(_state_get, 'Set state to', size=16),
'act_email_cc': fields.char('Add watchers (Cc)', size=250, help="\
These people will receive a copy of the future communication between partner \
and users by email"),
'act_remind_partner': fields.boolean('Remind Partner', help="Check \
this if you want the rule to send a reminder by email to the partner."),
'act_remind_user': fields.boolean('Remind responsible', help="Check \
this if you want the rule to send a reminder by email to the user."),
'act_reply_to': fields.char('Reply-To', size=64),
'act_remind_attach': fields.boolean('Remind with attachment', help="Check this if you want that all documents attached to the object be attached to the reminder email sent."),
'act_mail_to_user': fields.boolean('Mail to responsible', help="Check\
this if you want the rule to send an email to the responsible person."),
'act_mail_to_watchers': fields.boolean('Mail to watchers (CC)',
help="Check this if you want \
the rule to mark CC(mail to any other person defined in actions)."),
'act_mail_to_email': fields.char('Mail to these emails', size=128, \
help="Email-id of the persons whom mail is to be sent"),
'act_mail_body': fields.text('Mail body', help="Content of mail"),
'regex_name': fields.char('Regular Expression on Model Name', size=128),
'server_action_id': fields.many2one('ir.actions.server', 'Server Action', help="Describes the action name.\neg:on which object which action to be taken on basis of which condition"),
'filter_id':fields.many2one('ir.filters', 'Filter', required=False),
'domain':fields.char('Domain', size=124, required=False, readonly=False),
}
_defaults = {
'active': lambda *a: True,
'max_level': lambda *a: 15,
'trg_date_type': lambda *a: 'none',
'trg_date_range_type': lambda *a: 'day',
'act_mail_to_user': lambda *a: 0,
'act_remind_partner': lambda *a: 0,
'act_remind_user': lambda *a: 0,
'act_mail_to_watchers': lambda *a: 0,
'active': lambda *a: True,
'max_level': lambda *a: 15,
'trg_date_type': lambda *a: 'none',
'trg_date_range_type': lambda *a: 'day',
'act_mail_to_user': lambda *a: 0,
'act_remind_partner': lambda *a: 0,
'act_remind_user': lambda *a: 0,
'act_mail_to_watchers': lambda *a: 0,
'domain': lambda *a: '[]'
}
_order = 'sequence'
def format_body(self, body):
""" Foramat Action rule's body
@param self: The object pointer """
@ -155,22 +143,22 @@ class base_action_rule(osv.osv):
@param self: The object pointer """
data = {
'object_id': obj.id,
'object_subject': hasattr(obj, 'name') and obj.name or False,
'object_date': hasattr(obj, 'date') and obj.date or False,
'object_description': hasattr(obj, 'description') and obj.description or False,
'object_user': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.name) or '/',
'object_id': obj.id,
'object_subject': hasattr(obj, 'name') and obj.name or False,
'object_date': hasattr(obj, 'date') and obj.date or False,
'object_description': hasattr(obj, 'description') and obj.description or False,
'object_user': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.name) or '/',
'object_user_email': hasattr(obj, 'user_id') and (obj.user_id and \
obj.user_id.address_id and obj.user_id.address_id.email) or '/',
obj.user_id.address_id and obj.user_id.address_id.email) or '/',
'object_user_phone': hasattr(obj, 'user_id') and (obj.user_id and\
obj.user_id.address_id and obj.user_id.address_id.phone) or '/',
'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/',
obj.user_id.address_id and obj.user_id.address_id.phone) or '/',
'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/',
'partner_email': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and\
obj.partner_address_id.email) or '/',
obj.partner_address_id.email) or '/',
}
return self.format_body(body % data)
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from',False), context={}):
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from', False), context={}):
""" send email
@param self: The object pointer
@param cr: the current row, from the database cursor,
@ -189,7 +177,7 @@ class base_action_rule(osv.osv):
emailfrom = tools.ustr(emailfrom)
reply_to = emailfrom
if not emailfrom:
raise osv.except_osv(_('Error!'),
raise osv.except_osv(_('Error!'),
_("No E-Mail ID Found for your Company address!"))
return tools.email_send(emailfrom, emails, name, body, reply_to=reply_to, openobject_id=str(obj.id))
@ -202,6 +190,10 @@ class base_action_rule(osv.osv):
@param context: A standard dictionary for contextual values """
ok = True
if eval(action.domain):
obj_ids = obj._table.search(cr, uid, eval(action.domain), context=context)
if not obj.id in obj_ids:
ok = False
if hasattr(obj, 'user_id'):
ok = ok and (not action.trg_user_id.id or action.trg_user_id.id==obj.user_id.id)
if hasattr(obj, 'partner_id'):
@ -219,10 +211,6 @@ class base_action_rule(osv.osv):
if state_to:
ok = ok and (not action.trg_state_to or action.trg_state_to==state_to)
if hasattr(obj, 'priority'):
ok = ok and (not action.trg_priority_from or action.trg_priority_from>=obj.priority)
ok = ok and (not action.trg_priority_to or action.trg_priority_to<=obj.priority)
reg_name = action.regex_name
result_name = True
if reg_name:
@ -244,7 +232,7 @@ class base_action_rule(osv.osv):
@param context: A standard dictionary for contextual values """
if action.server_action_id:
context.update({'active_id':obj.id,'active_ids':[obj.id]})
context.update({'active_id':obj.id, 'active_ids':[obj.id]})
self.pool.get('ir.actions.server').run(cr, uid, [action.server_action_id.id], context)
write = {}
if hasattr(obj, 'user_id') and action.act_user_id:
@ -260,10 +248,6 @@ class base_action_rule(osv.osv):
obj.categ_id = action.act_categ_id
write['categ_id'] = action.act_categ_id.id
if hasattr(obj, 'priority') and action.act_priority:
obj.priority = action.act_priority
write['priority'] = action.act_priority
model_obj.write(cr, uid, [obj.id], write, context)
if hasattr(model_obj, 'remind_user') and action.act_remind_user:
@ -298,7 +282,9 @@ class base_action_rule(osv.osv):
if not scrit:
scrit = []
for action in self.browse(cr, uid, ids):
cr.execute("select id from base_action_rule order by sequence")
rule_ids = map(lambda x: x[0], cr.fetchall())
for action in self.browse(cr, uid, rule_ids):
level = action.max_level
if not level:
break
@ -323,10 +309,10 @@ class base_action_rule(osv.osv):
base = mx.DateTime.strptime(obj.date, '%Y-%m-%d %H:%M:%S')
if base:
fnct = {
'minutes': lambda interval: mx.DateTime.RelativeDateTime(minutes=interval),
'day': lambda interval: mx.DateTime.RelativeDateTime(days=interval),
'hour': lambda interval: mx.DateTime.RelativeDateTime(hours=interval),
'month': lambda interval: mx.DateTime.RelativeDateTime(months=interval),
'minutes': lambda interval: mx.DateTime.RelativeDateTime(minutes=interval),
'day': lambda interval: mx.DateTime.RelativeDateTime(days=interval),
'hour': lambda interval: mx.DateTime.RelativeDateTime(hours=interval),
'month': lambda interval: mx.DateTime.RelativeDateTime(months=interval),
}
d = base + fnct[action.trg_date_range_type](action.trg_date_range)
dt = d.strftime('%Y-%m-%d %H:%M:%S')
@ -368,7 +354,7 @@ class base_action_rule(osv.osv):
return True
_constraints = [
(_check_mail, 'Error: The mail is not well formated', ['act_mail_body']),
(_check_mail, 'Error: The mail is not well formated', ['act_mail_body']),
]
base_action_rule()

View File

@ -16,7 +16,9 @@
<form string="Action Rule">
<field name="name" select="1"/>
<field name="active"/>
<field name="sequence"/>
<field name="max_level" />
<field name="domain" colspan="4"/>
<notebook colspan="4">
<page string="Conditions">
<group col="2" colspan="2" name="model">
@ -34,45 +36,46 @@
<field name="trg_state_from"/>
<field name="trg_state_to"/>
</group>
<group col="2" colspan="2">
<separator colspan="4" string="Conditions on Priority Range"/>
<field name="trg_priority_from"/>
<field name="trg_priority_to"/>
</group>
<group col="2" colspan="2">
<separator colspan="4" string="Conditions on Timing"/>
<field name="trg_date_type"/>
<label align="1.0" string="Delay After Trigger Date:"/>
<group col="2" colspan="1">
<field name="trg_date_range" nolabel="1"/>
<group col="3" colspan="2" attrs="{'invisible': [('trg_date_type', '=', 'none')]}">
<field name="trg_date_range" string="Delay After Trigger Date"/>
<field name="trg_date_range_type" nolabel="1"/>
</group>
</group>
</group>
<separator colspan="4" string="Note"/>
<label align="0.0" string="The rule use a AND operator. The model must match all non empty fields so that the rule execute the action described in the 'Actions' tab." colspan="4"/>
<label align="0.0" colspan="4" width="900"
string="The rule use a AND operator. The model must match all non empty fields so that the rule execute the action described in the 'Actions' tab." />
</page>
<page string="Actions">
<separator colspan="4" string="Fields to Change"/>
<field name="act_user_id"/>
<field name="act_state"/>
<field name="act_priority"/>
<separator colspan="4" string="E-Mail Reminders (includes the content of the object)"/>
<field name="act_remind_partner"/>
<field name="act_remind_attach"/>
<field name="act_remind_user"/>
<group col="2" colspan="2" attrs="{'invisible': [('act_remind_user','=',False)]}">
<field name="act_reply_to" attrs="{'required':[('act_remind_user','=',True)]}"/>
</group>
<field colspan="4" name="act_email_cc"/>
<separator colspan="4" string="Server Action to be Triggered"/>
<field name="server_action_id"/>
<field name="filter_id"/>
</page>
<page string="E-Mail Actions">
<separator colspan="4" string="Template of Email to Send"/>
<field name="act_mail_to_user"/>
<field name="act_mail_to_watchers"/>
<field colspan="4" name="act_mail_to_email"/>
<field colspan="4" name="act_mail_body" attrs="{'required':[('act_remind_user','=',True)]}"/>
<!-- <group col="4" colspan="2">-->
<separator colspan="4" string="Template of Email to Send"/>
<field name="act_mail_to_watchers"/>
<field name="act_mail_to_user"/>
<field colspan="4" name="act_mail_to_email"/>
<!-- </group>-->
<!-- <group col="4" colspan="2">-->
<separator colspan="4" string="E-Mail Reminders (includes the content of the object)"/>
<field name="act_remind_partner"/>
<field name="act_remind_attach"/>
<field name="act_remind_user"/>
<group col="2" colspan="2" attrs="{'invisible': [('act_remind_user','=',False)]}">
<field name="act_reply_to" attrs="{'required':[('act_remind_user','=',True)]}"/>
</group>
<field colspan="4" name="act_email_cc"/>
<!-- </group>-->
<separator colspan="4" string="Mail Body"/>
<field colspan="4" name="act_mail_body" height="250"
nolabel="1" attrs="{'required':[('act_remind_user','=',True)]}" />
<separator colspan="4" string="Special Keywords to Be Used in The Body"/>
<label align="0.0" string="%%(object_id)s = Object ID" colspan="2"/>
<label align="0.0" string="%%(object_subject)s = Object subject" colspan="2"/>
@ -83,7 +86,6 @@
<label align="0.0" string="%%(object_user)s = Responsible name" colspan="2"/>
<label align="0.0" string="%%(object_user_email)s = Responsible email" colspan="2"/>
<label align="0.0" string="%%(object_user_phone)s = Responsible phone" colspan="2"/>
<label align="0.0" string="%% = The &apos;%%&apos; Character" colspan="2"/>
</page>
</notebook>
</form>
@ -99,7 +101,9 @@
<field name="arch" type="xml">
<tree string="Action Rule">
<field name="name" colspan="4"/>
<field name="sequence"/>
<field name="max_level"/>
<field name="domain"/>
</tree>
</field>
</record>

View File

@ -177,28 +177,12 @@ html_invitation = """
</div>
</td>
</tr>
<tr valign="top">
<td><b>Are you coming?</b></td>
<td><b>:</b></td>
<td colspan="3">
<UL>
<LI>YES</LI>
<LI>NO</LI>
<LI>MAYBE</LI>
</UL>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border="0" cellspacing="10" cellpadding="0" width="100%%"
style="font-family: Arial, Sans-serif; font-size: 14">
<tr>
<td width="100%%"><b>Note:</b> If you are interested please reply this
mail and keep only your response from options <i>YES, NO</i>
and <i>MAYBE</i>.</td>
</tr>
<tr>
<td width="100%%">From:</td>
</tr>
@ -258,22 +242,22 @@ class calendar_attendee(osv.osv):
attdata.sent_by_uid.address_id.email)
if name == 'cn':
if attdata.user_id:
result[id][name] = self._get_address(attdata.user_id.name, attdata.email)
result[id][name] = attdata.user_id.name
elif attdata.partner_address_id:
result[id][name] = self._get_address(attdata.partner_id.name, attdata.email)
result[id][name] = attdata.partner_address_id.name or attdata.partner_id.name
else:
result[id][name] = self._get_address(None, attdata.email)
result[id][name] = attdata.email or ''
if name == 'delegated_to':
todata = []
for parent in attdata.parent_ids:
if parent.email:
todata.append('MAILTO:' + parent.email)
for child in attdata.child_ids:
if child.email:
todata.append('MAILTO:' + child.email)
result[id][name] = ', '.join(todata)
if name == 'delegated_from':
fromdata = []
for child in attdata.child_ids:
if child.email:
fromdata.append('MAILTO:' + child.email)
for parent in attdata.parent_ids:
if parent.email:
fromdata.append('MAILTO:' + parent.email)
result[id][name] = ', '.join(fromdata)
if name == 'event_date':
if attdata.ref:
@ -384,49 +368,6 @@ property or property parameter."),
'state': lambda *x: 'needs-action',
}
response_re = re.compile("Are you coming\?.*\n*.*(YES|NO|MAYBE).*", re.UNICODE)
def msg_new(self, cr, uid, msg):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
"""
return False
def msg_act_get(self, msg):
"""
Get Message.
@param self: The object pointer
@return: dictionary of actions which contain state field value.
"""
mailgate_obj = self.pool.get('mail.gateway')
body = mailgate_obj.msg_body_get(msg)
actions = {}
res = self.response_re.findall(body['body'])
if res:
actions['state'] = res[0]
return actions
def msg_update(self, cr, uid, ids, msg, data={}, default_act='None'):
"""
Update msg state which may be accepted.declined.tentative.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs.
@param context: A standard dictionary for contextual values
@return: True
"""
msg_actions = self.msg_act_get(msg)
if msg_actions.get('state'):
if msg_actions['state'] in ['YES', 'NO', 'MAYBE']:
mapping = {'YES': 'accepted', 'NO': 'declined', 'MAYBE': 'tentative'}
status = mapping[msg_actions['state']]
print 'Got response for invitation id: %s as %s' % (ids, status)
self.write(cr, uid, ids, {'state': status})
return True
def get_ics_file(self, cr, uid, event_obj, context=None):
"""
Returns iCalendar file for the event invitation
@ -638,7 +579,7 @@ class res_alarm(osv.osv):
are both optional, but if one occurs, so MUST the other"""),
'repeat': fields.integer('Repeat'),
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.")
true, it will allow you to hide the event alarm information without removing it.")
}
_defaults = {
'trigger_interval': lambda *x: 'minutes',
@ -1050,9 +991,9 @@ class calendar_event(osv.osv):
'Show as'),
'base_calendar_url': fields.char('Caldav URL', size=264),
'exdate': fields.text('Exception Date/Times', help="This property \
defines the list of date/time exceptions for arecurring calendar component."),
defines the list of date/time exceptions for arecurring calendar component."),
'exrule': fields.char('Exception Rule', size=352, help="defines a \
rule or repeating pattern for anexception to a recurrence set"),
rule or repeating pattern for an exception to a recurrence set"),
'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \
string='Recurrent Rule', store=True, \
fnct_inv=_set_rrulestring, help='Defines a\
@ -1100,7 +1041,9 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
'end_date': fields.date('Repeat Until'),
'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', \
'event_id', 'attendee_id', 'Attendees'),
'allday': fields.boolean('All Day')
'allday': fields.boolean('All Day'),
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.")
}
_defaults = {
@ -1109,6 +1052,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
'freq': lambda *x: 'None',
'select1': lambda *x: 'date',
'interval': lambda *x: 1,
'active': lambda *x: 1,
}
def open_event(self, cr, uid, ids, context=None):
@ -1404,6 +1348,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
event_id = base_calendar_id2real_id(event_id)
if not event_id in new_ids:
new_ids.append(event_id)
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context)
if vals.has_key('alarm_id') or vals.has_key('base_calendar_alarm_id'):
alarm_obj = self.pool.get('res.alarm')

View File

@ -8,8 +8,13 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invitation details">
<field name="email" string="Invitation To"/>
<field name="sent_by_uid" string="Invitation From" />
<group col="6" colspan="4">
<field name="email" string="Invitation To"/>
<field name="cutype" string="Invitation type" />
<field name="rsvp" />
<field name="role" string="Role" />
<field name="sent_by_uid" string="Invitation From" />
</group>
<notebook colspan="4">
<page string="Invitation">
<separator string="Invitation Detail" colspan="4" />
@ -20,9 +25,6 @@
string="Partner Contact" />
<field name="partner_id"
string="Partner" readonly="1" />
<field name="role" string="Role" />
<field name="cutype" string="Invitation type" />
<field name="rsvp" />
</group>
<separator string="Event Detail" colspan="4" />
<group colspan="4" col="4">
@ -181,7 +183,7 @@
<field name="model">calendar.event</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Meetings">
<form string="Events">
<group col="6" colspan="4">
<field name="name" select="1" string="Summary"
colspan="4" />
@ -257,7 +259,6 @@
<field name="user_id" string="Responsible User" />
<field name="show_as" string="Show time as"/>
<field name="class" string="Privacy"/>
<field name="rrule" groups="base.group_extended" />
<field name="recurrent_id" invisible="1" />
<field name="recurrent_uid" invisible="1" />
</group>
@ -333,6 +334,7 @@
<field name="location" />
<field name="show_as" />
<field name="class" string="Privacy" />
<field name="user_id" invisible="1"/>
</tree>
</field>
</record>
@ -353,6 +355,44 @@
</field>
</record>
<!-- Event Search View-->
<record id="view_calendar_event_filter" model="ir.ui.view">
<field name="name">Calendar Events Search</field>
<field name="model">calendar.event</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Events">
<group col="12" colspan="4">
<filter icon="terp-partner" string="My Events"
domain="[('user_id','=',uid)]"
help="My Events" />
<separator orientation="vertical"/>
<field name="name" select="1" string="Summary"/>
<field name="location" select="1" string="Location"/>
<separator orientation="vertical"/>
<field name="user_id" select="1" widget="selection"/>
<separator orientation="vertical"/>
<field name="show_as" select="1"/>
<field name="class" select="1"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="16">
<filter string="Date" icon="terp-project"
domain="[]" context="{'group_by':'date'}" />
<filter string="Availability" icon="terp-project"
domain="[]" context="{'group_by':'show_as'}" />
<filter string="Privacy" icon="terp-crm"
domain="[]" context="{'group_by':'class'}" />
<separator orientation="vertical" />
<filter string="Responsible" icon="terp-crm" domain="[]"
context="{'group_by':'user_id'}" />
</group>
</search>
</field>
</record>
<!-- Event action -->
<record id="action_view_event" model="ir.actions.act_window">
@ -361,6 +401,7 @@
<field name="res_model">calendar.event</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="search_view_id" ref="view_calendar_event_filter"/>
</record>
<!-- Event menu -->

View File

@ -44,7 +44,7 @@ class base_calendar_invite_attendee(osv.osv_memory):
'contact_ids': fields.many2many('res.partner.address', 'invite_contact_rel',
'invite_id', 'contact_id', 'Contacts'),
'send_mail': fields.boolean('Send mail?', help='Check this if you want to \
send an Email to Invited Person')
send an Email to Invited Person')
}
_defaults = {
@ -66,20 +66,19 @@ class base_calendar_invite_attendee(osv.osv_memory):
model = False
model_field = False
context_id = context and context.get('active_id', False) or False
if not context or not context.get('model'):
return {}
else:
model = context.get('model')
model_field = context.get('attendee_field', False)
obj = self.pool.get(model)
res_obj = obj.browse(cr, uid, context_id)
att_obj = self.pool.get('calendar.attendee')
for datas in self.read(cr, uid, ids, context=context):
obj = self.pool.get(model)
res_obj = obj.browse(cr, uid, context_id)
type = datas.get('type')
att_obj = self.pool.get('calendar.attendee')
vals = []
mail_to = []
attendees = []
@ -123,15 +122,13 @@ class base_calendar_invite_attendee(osv.osv_memory):
if contact.email:
mail_to.append(contact.email)
att = att_obj.browse(cr, uid, context_id)
for att_val in vals:
if model == 'calendar.attendee':
if ref:
att_val.update({
'parent_ids': [(4, att.id)],
'ref': att.ref._name + ',' +str(att.ref.id)
})
att = att_obj.browse(cr, uid, context_id)
att_val.update({
'parent_ids': [(4, att.id)],
'ref': att.ref._name + ',' +str(att.ref.id)
})
attendees.append(att_obj.create(cr, uid, att_val))
if model_field:
for attendee in attendees:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,16 +15,21 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import installer
import todo
import gtk_contact_form
import wizard
from osv import osv
import os
import base64
import random
import tools
from osv import fields, osv
import netsvc
from tools.translate import _
class base_setup_config_choice(osv.osv_memory):
"""
@ -32,6 +37,29 @@ class base_setup_config_choice(osv.osv_memory):
_name = 'base.setup.config'
logger = netsvc.Logger()
def _get_image(self, cr, uid, context=None):
file_no = str(random.randint(1,3))
path = os.path.join('base','res','config_pixmaps/%s.png'%file_no)
file_data = tools.file_open(path,'rb').read()
return base64.encodestring(file_data)
def get_users(self, cr, uid, context={}):
user_obj = self.pool.get('res.users')
user_ids = user_obj.search(cr, uid, [])
users = user_obj.browse(cr, uid, user_ids)
user_str = '\n'.join(map(lambda x: ' - %s: %s / %s' % (x.name, x.login, x.password), users))
return _('The following users have been installed on your database: \n')+ user_str
_columns = {
'installed_users':fields.text('Installed Users', readonly=True),
'config_logo' : fields.binary('Image', readonly=True),
}
_defaults = {
'installed_users':get_users,
'config_logo' : _get_image
}
def set_default_menu(self, cr, uid, menu, context=None):
user = self.pool.get('res.users')\
.browse(cr, uid, uid, context=context)

View File

@ -43,7 +43,7 @@
'init_xml': ['base_setup_data.xml'],
'update_xml': ['security/ir.model.access.csv',
'base_setup_installer.xml',
'base_setup_todo.xml',],
'base_setup_todo.xml','gtk_contact_form.xml'],
'demo_xml': ['base_setup_demo.xml'],
'installable': True,
'active': True,

View File

@ -6,25 +6,29 @@
<field name="model">base.setup.config</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Setup">
<group colspan="4">
<image name="gtk-dialog-info"/>
<group colspan="2" col="4">
<separator colspan="4" string="Installation Done"/>
<label align="0.0" colspan="4"
string="Your new database is now fully installed."/>
<label align="0.0" colspan="4"
string="You can start configuring the system or connect directly to the database using the default setup."/>
</group>
</group>
<separator string="" colspan="4"/>
<button name="menu" icon="gtk-ok" type="object"
string="Use Directly"/>
<button name="config" icon="gtk-go-forward" type="object"
string="Start Configuration"/>
</form>
</field>
</record>
<form string="Setup">
<group colspan="4" col="8">
<group colspan="3" width="200">
<field name="config_logo" widget="image" width="150" height="100" nolabel="1" colspan="1"/>
<newline/>
<label align="0.0" string="You can start configuring the system or connect directly to the database as an administrator." width="200" colspan="2"/>
</group>
<separator string="" position="vertical" colspan="1" rowspan="8"/>
<group colspan="4" width="400">
<separator string="Installation Done" colspan="4"/>
<label align="0.0" string="Your new database is now fully installed." colspan="4"/>
<field name="installed_users" nolabel= "1" colspan="4"/>
</group>
</group>
<group colspan="8" col="8">
<separator string="" colspan="8"/>
<label string="" colspan="6"/>
<button name="menu" icon="gtk-ok" type="object" string="Use Directly" colspan="1"/>
<button name="config" icon="gtk-go-forward" type="object" string="Start Configuration" colspan="1"/>
</group>
</form>
</field>
</record>
<record id="action_base_setup" model="ir.actions.act_window">
<field name="name">Setup</field>

View File

@ -8,31 +8,34 @@
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Base Setup Modules Installation</attribute>
<attribute name="string">Install OpenERP Modules</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Install Modules</attribute>
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string"
>Now that OpenERP is installed, we have selected applications commonly useful to users which you can install directly, as well as sets of applications for more specific types or groups of businesses (the vertical modules).
>Now that OpenERP is installed, We have selected applications commonly useful to users which you can install directly, as well as sets of applications for more specific types or groups of businesses (the vertical modules).
If you don't think you need any of these right now, you can easily install them later on.</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>
<attribute name='rowspan'>15</attribute>
</xpath>
<separator string="title" position="attributes">
<attribute name="string">Install Generic Modules</attribute>
</separator>
<group colspan="8">
<separator string="Generic Modules" colspan="4"/>
<field name="crm"/> <field name="sale"/>
<field name="project"/> <field name="knowledge"/>
<field name="stock"/> <field name="mrp"/>
<field name="account"/> <field name="purchase"/>
<field name="hr"/> <field name="point_of_sale"/>
<field name="marketing"/> <field name="misc_tools"/>
<field name="report_designer"/> <field name="thunderbird"/>
<separator string="Vertical Modules" colspan="4"/>
<field name="profile_association"/>
<field name="profile_auction"/>
<field name="profile_bookstore"/>
<field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<field name="account" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="purchase" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)" groups="base.group_extended"/>
<field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)" groups="base.group_extended"/> <field name="misc_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<separator string="Install Specific Business Modules" colspan="4"/>
<field name="profile_association" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<field name="profile_auction" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
<field name="profile_bookstore" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,profile_association,profile_auction,profile_bookstore)"/>
</group>
</data>
</field>
@ -52,5 +55,16 @@ If you don't think you need any of these right now, you can easily install them
<field name="action_id" ref="action_base_setup_installer"/>
<field name="sequence">2</field>
</record>
<record id="base_setup_ir_actions_todo_tree" model="ir.ui.view">
<field name="model">ir.actions.todo</field>
<field name="name">base_setup_installer_action_replace</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base.ir_actions_todo_tree"/>
<field name="arch" type="xml">
<xpath expr="//button[@string='Launch']" position="replace">
<button name="%(action_base_setup_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -10,33 +10,45 @@
<form position="attributes">
<attribute name="string">Main Company Setup</attribute>
</form>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Information of your company will be used to custiomise your documents like Invoices, Sale Orders,...</attribute>
</xpath>
<xpath expr='//separator[@string="title"]' position='attributes'>
<attribute name='string'>Configure Your Company</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>25</attribute>
<attribute name='string'></attribute>
</xpath>
<group string="res_config_contents" position="replace">
<field name="company_id" invisible="1"/>
<group colspan="5">
<group colspan="2">
<field name="company_id" invisible="1"/>
<field name="name" required="True"/><field name="account_no"/>
<field name="currency" widget="selection"/><field name="street"/>
<field name="zip"/>
<field name="street2"/>
<field name="city"/>
<field name="country_id"/>
<field name="state_id"/>
<field name="email"/>
<field name="phone"/>
<field name="website"/>
</group>
<newline/>
<group colspan="2" groups="base.group_extended">
<separator string="Report Information" colspan="4"/>
<field name="rml_header1" colspan="5"/>
<field name="rml_footer1" colspan="5"/>
<field name="rml_footer2" colspan="5"/>
<separator string="Configure Your Company" colspan="4"/>
<field name="name" colspan="4" required="True"/>
<newline/>
<field name="street"/>
<field name="street2"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="state_id"/>
<field name="email"/>
<field name="phone"/>
<field name="currency"/>
<separator string="Report Information" colspan="4"/>
<field name="rml_header1" colspan="4"/>
<field name="rml_footer1" colspan="4"/>
<field name="rml_footer2" colspan="4"/>
<separator colspan="4"
string="Your Logo - Use a size of about 450x150 pixels."/>
<field colspan="4" name="logo" widget="image"
nolabel="1"/>
</group>
<separator colspan="4"
string="Your Logo - Use a size of about 450x150 pixels."/>
<field colspan="5" name="logo" widget="image"
nolabel="1"/>
</group>
</group>
</group>
<xpath expr='//button[@name="action_skip"]' position='replace'/>
</data>

View File

@ -0,0 +1,100 @@
# -*- 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 operator import itemgetter
from osv import osv, fields
import netsvc
import tools
from tools import misc
class base_gtkcontactform(osv.osv_memory):
"""
"""
_name = 'base.gtkcontactform'
_inherit = 'res.config'
logger = netsvc.Logger()
def default_get(self, cr, uid, fields_list=None, context=None):
''' set email and phone number selected in the previous company information
form '''
defaults = super(base_gtkcontactform, self)\
.default_get(cr, uid, fields_list=fields_list, context=context)
company_id = self.pool.get('base.setup.company').search(cr, uid, [])
company = self.pool.get('base.setup.company').read(cr, uid, company_id)
company = company and company[0] or False
if company:
defaults.update({'email':company.get('email',''),
'phone': company.get('phone','')})
return defaults
_columns = {
'name':fields.char('Your Name', size=64),
'job':fields.char('Job Title', size=64,),
'email':fields.char('E-mail', size=64),
'phone':fields.char('Phone', size=64),
'total_employees':fields.selection([('1-5','1-5'),('5-20','5-20'),('20-100','20-100'),('100-500','100-500'),('500','500+')], 'No Of Employees', size=32),
'industry':fields.selection([('apparel','Apparel'),('banking','Banking'),('biotechnology','Biotechnology'),('chemicals','Chemicals'),('communications','Communications'),
('construction','Construction'),('consulting','Consulting'),('education','Education'),('electronics','Electronics'),('energy','Energy'),('engineering','Engineering'),
('entertainment','Entertainment'),('environmental','Environmental'),('finance','Finance'),('government','Government'),('healthcare','Healthcare'),('hospitality','Hospitality'),
('insurance','Insurance'),('machinery','Machinery'),('manufacturing','Manufacturing'),('media','Media'),('notforprofit','Not For Profit'),
('recreation','Recreation'),('retail','Retail'),('shipping','Shipping'),('technology','Technology'),('telecommunications','Telecommunications'),
('transportation','Transportation'),('utilities','Utilities'),('other','Other'),
], 'Industry', size=32),
'use_openerp':fields.boolean('We plan to use OpenERP'),
'already_using_openerp':fields.boolean('Already using OpenERP'),
'sell_openerp':fields.boolean('Plan to sell OpenERP'),
'already_selling__openerp':fields.boolean('Already selling OpenERP'),
'features':fields.boolean('The features of OpenERP'),
'saas':fields.boolean('OpenERP Online Solutions (SaaS)'),
'partners_program':fields.boolean('OpenERP Partners Program (for integrators)'),
'support':fields.boolean('Support and Maintenance Solutions'),
'training':fields.boolean('OpenERP Training Program'),
'other':fields.boolean('Other'),
'ebook':fields.boolean('ebook'),
'updates':fields.boolean('Updates'),
'contact_me':fields.boolean('Contact Me'),
}
def execute(self, cr, uid, ids, context=None):
company_id = self.pool.get('base.setup.company').search(cr, uid, [])
company_data = self.pool.get('base.setup.company').read(cr, uid, company_id)
company_data = company_data and company_data[0] or False
country1 = ''
if company_data and company_data.get('country_id', False):
country = self.pool.get('res.country').read(cr, uid, company_data['country_id'],['name'])['name']
for res in self.read(cr, uid, ids):
email = res.get('email','')
result = "\ncompany: "+ str(company_data.get('name',''))
result += "\nname: " + str(res.get('name',''))
result += "\nphone: " + str(res.get('phone',''))
result += "\ncity: " + str(company_data.get('city',''))
result += "\ncountry: " + str(country)
result += "\nindustry: " + str(res.get('industry', ''))
result += "\ntotal_employees: " + str(res.get('total_employees', ''))
result += "\nplan_use: " + str(res.get('use_openerp', False))
result += "\nsell_openerp: " + str(res.get('sell_openerp', False))
result += "\nebook: " + str(res.get('ebook',False))
result += "\ngtk: " + str(True)
misc.upload_data(email, result, type='SURVEY')
base_gtkcontactform()

View File

@ -0,0 +1,79 @@
<openerp>
<data>
<record id="view_base_setup_contact" model="ir.ui.view">
<field name="name">Contact information</field>
<field name="model">base.gtkcontactform</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Contact Information</attribute>
</form>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Information about you and the company you are related too. The Basic information related to the company has already been collected and some more information required by you to fill.</attribute>
</xpath>
<xpath expr='//separator[@string="title"]' position='attributes'>
<attribute name='string'>Would you like more information or documentation ?</attribute>
<attribute name='colspan'>4</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>22</attribute>
<attribute name='string'></attribute>
</xpath>
<group string="res_config_contents" position="replace">
<group colspan="4" height="450" width="600">
<group colspan="4">
<field name="contact_me" nolabel="1"/>
<label align="0.0" string="I accept to be contacted by OpenERP." colspan="3"/>
<field name="ebook" nolabel="1"/>
<label align="0.0" string="I want to receive the Open ERP ebook (PDF) by email." colspan="3"/>
<field name="updates" nolabel="1"/>
<label align="0.0" string="Yes, I would like to receive information updates from OpenERP." colspan="3"/>
</group>
<group colspan="4" attrs="{'invisible':[('ebook','=',False),('updates','=',False)]}">
<separator colspan="4" string="About You"/>
<field name="name" colspan="2" attrs="{'required':[('ebook','=',True),('updates','=',True)]}"/>
<field name="job" colspan="2"/>
<field name="email" colspan="2" attrs="{'required':[('ebook','=',True),('updates','=',True)]}"/>
<field name="phone" colspan="2" attrs="{'required':[('ebook','=',True),('updates','=',True)]}"/>
<field name="total_employees" colspan="2"/>
<field name="industry" colspan="2"/>
</group>
<group colspan="4" attrs="{'invisible':[('ebook','=',False),('updates','=',False)]}">
<separator string="Your projects with OpenERP" colspan="4"/>
<field name="use_openerp" align="0.0" colspan="1"/>
<field name="already_using_openerp" align="0.0" colspan="1"/>
<field name="sell_openerp" align="0.0" colspan="1"/>
<field name="already_selling__openerp" align="0.0" colspan="1"/>
<separator colspan="4" string="You would like to know more about"/>
<field name="features" align="0.0" colspan="1"/>
<field name="training" align="0.0" colspan="1"/>
<field name="saas" align="0.0" colspan="1"/>
<field name="support" align="0.0" colspan="1"/>
<field name="partners_program" align="0.0" colspan="1"/>
<field name="other" align="0.0" colspan="1"/>
</group>
</group>
</group>
</data>
</field>
</record>
<record id="action_base_contact" model="ir.actions.act_window">
<field name="name">Setup contact information</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.gtkcontactform</field>
<field name="view_id" ref="view_base_setup_contact"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="base_setup_contact_todo" model="ir.actions.todo">
<field name="action_id" ref="action_base_contact"/>
<field name="sequence">1</field>
<field name="restart">never</field>
</record>
</data>
</openerp>

View File

@ -69,7 +69,7 @@ class base_setup_installer(osv.osv_memory):
help="Helps you manage your marketing campaigns step by step."),
'misc_tools':fields.boolean('Miscellaneous Tools',
help="Lets you install various interesting but non-essential "
"tools."),
"tools like Survey, Lunch,..."),
'report_designer':fields.boolean('Advanced Reporting',
help="Lets you install various tools to simplify and enhance "
"OpenERP's report creation."),
@ -91,5 +91,25 @@ class base_setup_installer(osv.osv_memory):
_defaults = {
'crm': True,
}
def onchange_moduleselection(self, cr, uid, ids, *args):
progress = self._progress(cr, uid) - round((len(filter(lambda x: x==1, args)))*80/len(args))
if progress <= 10.0:
progress = 10.0
return {'value':{'progress':progress}}
def modules_to_install(self, cr, uid, ids, context=None):
modules = super(base_setup_installer, self).modules_to_install(cr, uid, ids, context=context)
interface_id = self.pool.get('res.config.view').search(cr, uid, [])
interface = self.pool.get('res.config.view').read(cr, uid, interface_id)[0]
modules_selected = self.read(cr, uid, ids)[0]
added_modules = []
if interface.get('view', '') == 'simple' :
if modules_selected.get('mrp', False):
added_modules.append('mrp_jit')
if modules_selected.get('knowledge', False):
added_modules.append('document_ftp')
return modules | set(added_modules)
base_setup_installer()

View File

@ -48,23 +48,23 @@ class base_setup_company(osv.osv_memory):
cr, uid, 'res.country.state', context=context)
def _get_all_countries(self, cr, uid, context=None):
return self._get_all(cr, uid, 'res.country', context=context)
def _get_all_currencies(self, cr, uid, context=None):
return self._get_all(cr, uid, 'res.currency', context=context)
def default_get(self, cr, uid, fields_list=None, context=None):
""" get default company if any, and the various other fields
from the company's fields
"""
base_mod = self.pool.get('ir.module.module').search(cr, uid, [('name','ilike','base')])
base_mod_rec = self.pool.get('ir.module.module').browse(cr, uid, base_mod)[0]
defaults = super(base_setup_company, self)\
.default_get(cr, uid, fields_list=fields_list, context=context)
companies = self.pool.get('res.company')
company_id = companies.search(cr, uid, [], limit=1, order="id")
if not company_id or 'company_id' not in fields_list:
return defaults
company = companies.browse(cr, uid, company_id[0])
defaults['company_id'] = company.id
if not base_mod_rec.demo:
return defaults
defaults['currency'] = company.currency_id.id
for field in ['name','logo','rml_header1','rml_footer1','rml_footer2']:
defaults[field] = company[field]
@ -86,11 +86,11 @@ class base_setup_company(osv.osv_memory):
'street2':fields.char('Street 2', size=128),
'zip':fields.char('Zip Code', size=24),
'city':fields.char('City', size=128),
'state_id':fields.selection(_get_all_states, 'States'),
'country_id':fields.selection(_get_all_countries, 'Countries'),
'state_id':fields.selection(_get_all_states, 'State'),
'country_id':fields.selection(_get_all_countries, 'Country'),
'email':fields.char('E-mail', size=64),
'phone':fields.char('Phone', size=64),
'currency':fields.selection(_get_all_currencies, 'Currency', required=True),
'currency':fields.many2one('res.currency', 'Currency', required=True),
'rml_header1':fields.char('Report Header', size=200,
help='''This sentence will appear at the top right corner of your reports.
We suggest you to put a slogan here:
@ -104,6 +104,8 @@ Web: http://openerp.com - Fax: +32.81.73.35.01 - Fortis Bank: 126-2013269-07''')
We suggest you to put bank information here:
IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701'''),
'logo':fields.binary('Logo'),
'account_no':fields.char('Account No', size=64),
'website': fields.char('Web', size=64),
}
def execute(self, cr, uid, ids, context=None):
@ -112,7 +114,6 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701'''),
if not getattr(payload, 'company_id', None):
raise ValueError('Case where no default main company is setup '
'not handled yet')
company = payload.company_id
company.write({
'name':payload.name,
@ -120,10 +121,13 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701'''),
'rml_footer1':payload.rml_footer1,
'rml_footer2':payload.rml_footer2,
'logo':payload.logo,
'currency_id':payload.currency.id,
'account_no':payload.account_no,
})
company.partner_id.write({
'name':payload.name,
'website':payload.website,
})
address_data = {

View File

@ -18,10 +18,10 @@
<record model="ir.ui.view" id="view_crm_opportunity_categ_graph">
<field name="name">report.crm.opportunity.categ.graph</field>
<field name="model">crm.opportunity.report</field>
<field name="model">crm.lead.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Sections and Categories" type="bar" orientation="horizontal">
<graph string="Opportunity by Sales Team and Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="nbr" operator="+"/>
</graph>
@ -30,7 +30,7 @@
<act_window name="Opportunities By Categories"
domain="[('state','!=','done'),('state','!=','cancel')]"
res_model="crm.opportunity.report"
res_model="crm.lead.report"
view_type="form"
view_mode="graph,tree,form"
view_id="view_crm_opportunity_categ_graph"

View File

@ -6,7 +6,7 @@
</record>
<record model="ir.ui.view" id="view_crm_opportunity_user_graph1">
<field name="name">crm.opportunity.user.graph1</field>
<field name="model">crm.opportunity.report</field>
<field name="model">crm.lead.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunities by User and Section" type="pie">
@ -29,12 +29,7 @@
<field name="view_id" ref="crm.crm_case_tree_view_meet"/>
<field name="domain">[('user_id','=',uid),('state','!=','pending'),('state','!=','cancel')]</field>
</record>
<act_window name="My Cases"
domain="[('user_id','=',uid),('state','!=','pending'),('state','!=','cancel')]"
res_model="crm.case"
view_type="form"
view_mode="tree,form"
id="act_my_cases"/>
<record model="ir.actions.act_window" id="act_my_leads_stage">
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
@ -44,11 +39,11 @@
</record>
<record model="ir.actions.act_window" id="act_sales_pipeline">
<field name="res_model">crm.opportunity.report</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree,form</field>
<field name="view_id" ref="view_crm_opportunity_user_graph1"/>
<field name="domain">[('user_id','=',uid),('state','!=','pending'),('state','!=','cancel')]</field>
<field name="domain">[('user_id','=',uid),('state','!=','pending'),('state','!=','cancel'),('type', '=', 'opportunity')]</field>
</record>
<record model="ir.ui.view" id="board_crm_form">
@ -73,12 +68,6 @@
height="150"
colspan="4"/>
<action
string="My Cases"
name="%(act_my_cases)d"
colspan="4"
height="200"/>
</child1>
<child2>

View File

@ -24,10 +24,12 @@ import crm_mailgate
import crm_action_rule
import crm_segmentation
import crm_meeting
import crm_opportunity
import crm_lead
import crm_opportunity
import crm_phonecall
import crm_installer
import report
import wizard

View File

@ -74,7 +74,6 @@ between mails and Open ERP.""",
'wizard/crm_forward_to_partner_view.xml',
'wizard/crm_send_email_view.xml',
'wizard/crm_email_add_cc_view.xml',
'crm_view.xml',
'crm_action_rule_view.xml',
@ -93,12 +92,11 @@ between mails and Open ERP.""",
'security/crm_security.xml',
'security/ir.model.access.csv',
'report/crm_report_view.xml',
'report/crm_lead_report_view.xml',
'report/crm_opportunity_report_view.xml' ,
'report/crm_phonecall_report_view.xml',
'process/crm_configuration_process.xml',
'crm_installer_view.xml'
],
'demo_xml': [
'crm_demo.xml',
@ -107,11 +105,12 @@ between mails and Open ERP.""",
'crm_opportunity_demo.xml',
'crm_phonecall_demo.xml'
],
# 'test': ['test/test_crm_lead.yml',
# 'test/test_crm_meeting.yml',
# 'test/test_crm_opportunity.yml',
# 'test/test_crm_phonecall.yml',
# ],
'test': [
'test/test_crm_lead.yml',
'test/test_crm_meeting.yml',
'test/test_crm_opportunity.yml',
'test/test_crm_phonecall.yml',
],
'installable': True,
'active': False,
'certificate': '0079056041421',

View File

@ -45,6 +45,273 @@ AVAILABLE_PRIORITIES = [
('5', 'Lowest'),
]
class crm_case(object):
"""A simple python class to be used for common functions """
def _get_default_partner_address(self, cr, uid, context):
"""Gives id of default address for current user
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context.get('portal', False):
return False
return self.pool.get('res.users').browse(cr, uid, uid, context).address_id.id
def _get_default_partner(self, cr, uid, context):
"""Gives id of partner for current user
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context.get('portal', False):
return False
user = self.pool.get('res.users').browse(cr, uid, uid, context)
if not user.address_id:
return False
return user.address_id.partner_id.id
def _get_default_email(self, cr, uid, context):
"""Gives default email address for current user
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context.get('portal', False):
return False
user = self.pool.get('res.users').browse(cr, uid, uid, context)
if not user.address_id:
return False
return user.address_id.email
def _get_default_user(self, cr, uid, context):
"""Gives current user id
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if context.get('portal', False):
return False
return uid
def _get_section(self, cr, uid, context):
"""Gives section id for current User
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.context_section_id.id or False
def stage_next(self, cr, uid, ids, context=None):
"""This function computes next stage for case from its current stage
using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
s = self.get_stage_dict(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
if section in s:
st = case.stage_id.id or False
if st in s[section]:
self.write(cr, uid, [case.id], {'stage_id': s[section][st]})
return True
def get_stage_dict(self, cr, uid, ids, context=None):
"""This function gives dictionary for stage according to stage levels
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
sid = self.pool.get('crm.case.stage').search(cr, uid, \
[('object_id.model', '=', self._name)], context=context)
s = {}
previous = {}
for stage in self.pool.get('crm.case.stage').browse(cr, uid, sid, context=context):
section = stage.section_id.id or False
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
return s
def stage_previous(self, cr, uid, ids, context=None):
"""This function computes previous stage for case from its current stage
using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
s = self.get_stage_dict(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
if section in s:
st = case.stage_id.id or False
s[section] = dict([(v, k) for (k, v) in s[section].iteritems()])
if st in s[section]:
self.write(cr, uid, [case.id], {'stage_id': s[section][st]})
return True
def onchange_partner_id(self, cr, uid, ids, part, email=False):
"""This function returns value of partner address based on partner
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param part: Partner's id
@email: Partner's email ID
"""
if not part:
return {'value': {'partner_address_id': False,
'email_from': False,
}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['contact'])
data = {'partner_address_id': addr['contact']}
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
return {'value': data}
def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
"""This function returns value of partner email based on Partner Address
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param add: Id of Partner's address
@email: Partner's email ID
"""
if not add:
return {'value': {'email_from': False}}
address = self.pool.get('res.partner.address').browse(cr, uid, add)
return {'value': {'email_from': address.email}}
def case_open(self, cr, uid, ids, *args):
"""Opens Case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
self._history(cr, uid, cases, _('Open'))
for case in cases:
data = {'state': 'open', 'active': True}
if not case.user_id:
data['user_id'] = uid
self.write(cr, uid, case.id, data)
self._action(cr, uid, cases, 'open')
return True
def case_close(self, cr, uid, ids, *args):
"""Closes Case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self._history(cr, uid, cases, _('Close'))
self.write(cr, uid, ids, {'state': 'done',
'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'),
})
#
# We use the cache of cases to keep the old case state
#
self._action(cr, uid, cases, 'done')
return True
def case_escalate(self, cr, uid, ids, *args):
"""Escalates case to top level
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
for case in cases:
data = {'active': True, 'user_id': False}
if case.section_id.parent_id:
data['section_id'] = case.section_id.parent_id.id
if case.section_id.parent_id.user_id:
data['user_id'] = case.section_id.parent_id.user_id.id
else:
raise osv.except_osv(_('Error !'), _('You can not escalate this case.\nYou are already at the top level.'))
self.write(cr, uid, [case.id], data)
cases = self.browse(cr, uid, ids)
self._history(cr, uid, cases, _('Escalate'))
self._action(cr, uid, cases, 'escalate')
return True
def case_cancel(self, cr, uid, ids, *args):
"""Cancels Case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self._history(cr, uid, cases, _('Cancel'))
self.write(cr, uid, ids, {'state': 'cancel',
'active': True})
self._action(cr, uid, cases, 'cancel')
return True
def case_pending(self, cr, uid, ids, *args):
"""Marks case as pending
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self._history(cr, uid, cases, _('Pending'))
self.write(cr, uid, ids, {'state': 'pending', 'active': True})
self._action(cr, uid, cases, 'pending')
return True
def case_reset(self, cr, uid, ids, *args):
"""Resets case as draft
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self._history(cr, uid, cases, _('Draft'))
self.write(cr, uid, ids, {'state': 'draft', 'active': True})
self._action(cr, uid, cases, 'draft')
return True
class crm_case_section(osv.osv):
"""Sales Team"""
@ -241,502 +508,6 @@ def _links_get(self, cr, uid, context=None):
res = obj.read(cr, uid, ids, ['object', 'name'], context)
return [(r['object'], r['name']) for r in res]
class crm_case(osv.osv):
""" CRM Case """
_name = "crm.case"
_description = "Case"
def _email_last(self, cursor, user, ids, name, arg, context=None):
"""Return last email from History
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of cases IDs
@param context: A standard dictionary for contextual values
"""
res = {}
for case in self.browse(cursor, user, ids):
if case.history_line:
res[case.id] = case.history_line[0].description
else:
res[case.id] = False
return res
def copy(self, cr, uid, id, default=None, context=None):
"""Overrides orm copy method
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of cases IDs
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
if not default:
default = {}
default.update({'state': 'draft', 'id': False})
return super(crm_case, self).copy(cr, uid, id, default, context)
def _get_log_ids(self, cr, uid, ids, field_names, arg, context=None):
"""Gets id for case log from history of particular case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Case IDs
@param context: A standard dictionary for contextual values
@return:Dictionary of History Ids
"""
if not context:
context = {}
result = {}
history_obj = False
model_obj = self.pool.get('ir.model')
if 'history_line' in field_names:
history_obj = self.pool.get('crm.case.history')
name = 'history_line'
if 'log_ids' in field_names:
history_obj = self.pool.get('crm.case.log')
name = 'log_ids'
if not history_obj:
return result
for case in self.browse(cr, uid, ids, context):
model_ids = model_obj.search(cr, uid, [('model', '=', case._name)])
history_ids = history_obj.search(cr, uid, [('model_id', '=', model_ids[0]), \
('res_id', '=', case.id)])
if history_ids:
result[case.id] = {name: history_ids}
else:
result[case.id] = {name: []}
return result
_columns = {
'id': fields.integer('ID', readonly=True),
'name': fields.char('Description', size=1024, required=True),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
'description': fields.text('Description'),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'email_cc': fields.text('Watchers Emails', size=252 , help="These people\
will receive a copy of the future" \
" communication between partner and users by email"),
'probability': fields.float('Probability'),
'email_last': fields.function(_email_last, method=True,
string='Latest E-Mail', type='text'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
domain="[('partner_id','=',partner_id)]"),
'create_date': fields.datetime('Creation Date' , readonly=True),
'write_date': fields.datetime('Update Date' , readonly=True),
'date_deadline': fields.date('Deadline'),
'user_id': fields.many2one('res.users', 'Responsible'),
'history_line': fields.function(_get_log_ids, method=True, type='one2many', \
multi="history_line", relation="crm.case.history", string="Communication"),
'log_ids': fields.function(_get_log_ids, method=True, type='one2many', \
multi="log_ids", relation="crm.case.log", string="Logs History"),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.opportunity')]"),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'company_id': fields.many2one('res.company', 'Company'),
}
def _get_default_partner_address(self, cr, uid, context):
"""Gives id of default address for current user
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context.get('portal', False):
return False
return self.pool.get('res.users').browse(cr, uid, uid, context).address_id.id
def _get_default_partner(self, cr, uid, context):
"""Gives id of partner for current user
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context.get('portal', False):
return False
user = self.pool.get('res.users').browse(cr, uid, uid, context)
if not user.address_id:
return False
return user.address_id.partner_id.id
def _get_default_email(self, cr, uid, context):
"""Gives default email address for current user
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context.get('portal', False):
return False
user = self.pool.get('res.users').browse(cr, uid, uid, context)
if not user.address_id:
return False
return user.address_id.email
def _get_default_user(self, cr, uid, context):
"""Gives current user id
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if context.get('portal', False):
return False
return uid
def _get_section(self, cr, uid, context):
"""Gives section id for current User
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.context_section_id.id or False
_defaults = {
'active': lambda *a: 1,
'user_id': _get_default_user,
'partner_id': _get_default_partner,
'partner_address_id': _get_default_partner_address,
'email_from': _get_default_email,
'state': lambda *a: 'draft',
'section_id': _get_section,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.case', context=c),
}
_order = 'date_deadline desc, create_date desc,id desc'
def unlink(self, cr, uid, ids, context=None):
"""Overrides orm unlink method
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
hist_obj = self.pool.get('crm.case.history')
log_obj = self.pool.get('crm.case.log')
for case in self.browse(cr, uid, ids, context):
if (not case.section_id.allow_unlink) and (case.state <> 'draft'):
raise osv.except_osv(_('Warning !'),
_('You can not delete this case. You should better cancel it.'))
# Also removing history and logs
history_ids = map(lambda x: x.id, case.history_line)
log_ids = map(lambda x: x.id, case.log_ids)
hist_obj.unlink(cr, uid, history_ids, context=context)
log_obj.unlink(cr, uid, log_ids, context=context)
return super(crm_case, self).unlink(cr, uid, ids, context)
def stage_next(self, cr, uid, ids, context=None):
"""This function computes next stage for case from its current stage
using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
s = self.get_stage_dict(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
if section in s:
st = case.stage_id.id or False
if st in s[section]:
self.write(cr, uid, [case.id], {'stage_id': s[section][st]})
return True
def get_stage_dict(self, cr, uid, ids, context=None):
"""This function gives dictionary for stage according to stage levels
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
sid = self.pool.get('crm.case.stage').search(cr, uid, \
[('object_id.model', '=', self._name)], context=context)
s = {}
previous = {}
for stage in self.pool.get('crm.case.stage').browse(cr, uid, sid, context=context):
section = stage.section_id.id or False
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
return s
def stage_previous(self, cr, uid, ids, context=None):
"""This function computes previous stage for case from its current stage
using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
s = self.get_stage_dict(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
if section in s:
st = case.stage_id.id or False
s[section] = dict([(v, k) for (k, v) in s[section].iteritems()])
if st in s[section]:
self.write(cr, uid, [case.id], {'stage_id': s[section][st]})
return True
def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, email_from=False, message_id=False, context={}):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param cases: a browse record list
@param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used
@param history: Value True/False, If True it makes entry in case History otherwise in Case Log
@param email: Email address if any
@param details: Details of case history if any
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
# The mailgate sends the ids of the cases and not the object list
if all(isinstance(case_id, (int, long)) for case_id in cases) and context.get('model'):
cases = self.pool.get(context['model']).browse(cr, uid, cases, context=context)
model_obj = self.pool.get('ir.model')
obj = self.pool.get('crm.case.log')
for case in cases:
model_ids = model_obj.search(cr, uid, [('model', '=', case._name)])
data = {
'name': keyword,
'user_id': uid,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'model_id' : model_ids and model_ids[0] or False,
'res_id': case.id,
'section_id': case.section_id.id,
'message_id':message_id
}
if history:
obj = self.pool.get('crm.case.history')
data['description'] = details or case.description
data['email_to'] = email or \
(case.section_id and case.section_id.reply_to) or \
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False)
data['email_from'] = email_from or \
(case.section_id and case.section_id.reply_to) or \
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False)
res = obj.create(cr, uid, data, context)
return True
_history = __history
history = __history
def create(self, cr, uid, *args, **argv):
"""Overrides orm create method
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param *args: Tuple Value for additional Params
@param **argv: Dictionay of Keyword Params
"""
res = super(crm_case, self).create(cr, uid, *args, **argv)
cases = self.browse(cr, uid, [res])
cases[0].state # to fill the browse record cache
self._action(cr, uid, cases, 'draft')
return res
def add_reply(self, cursor, user, ids, context=None):
"""This function finds last email and gives its description value for reply mail
@param self: The object pointer
@param cursor: the current row, from the database cursor,
@param user: the current users ID for security checks
@param ids: List of case IDs
@param context: A standard dictionary for contextual values
"""
for case in self.browse(cursor, user, ids, context=context):
if case.email_last:
description = case.email_last
self.write(cursor, user, case.id, {
'description': '> ' + description.replace('\n', '\n> '),
}, context=context)
return True
def onchange_partner_id(self, cr, uid, ids, part, email=False):
"""This function returns value of partner address based on partner
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param part: Partner's id
@email: Partner's email ID
"""
if not part:
return {'value': {'partner_address_id': False,
'email_from': False,
}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['contact'])
data = {'partner_address_id': addr['contact']}
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
return {'value': data}
def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
"""This function returns value of partner email based on Partner Address
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param add: Id of Partner's address
@email: Partner's email ID
"""
if not add:
return {'value': {'email_from': False}}
address = self.pool.get('res.partner.address').browse(cr, uid, add)
return {'value': {'email_from': address.email}}
def case_close(self, cr, uid, ids, *args):
"""Closes Case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self.__history(cr, uid, cases, _('Close'))
self.write(cr, uid, ids, {'state': 'done',
'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'),
'probability' : 100.0})
#
# We use the cache of cases to keep the old case state
#
self._action(cr, uid, cases, 'done')
return True
def case_escalate(self, cr, uid, ids, *args):
"""Escalates case to top level
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
for case in cases:
data = {'active': True, 'user_id': False}
if case.section_id.parent_id:
data['section_id'] = case.section_id.parent_id.id
if case.section_id.parent_id.user_id:
data['user_id'] = case.section_id.parent_id.user_id.id
else:
raise osv.except_osv(_('Error !'), _('You can not escalate this case.\nYou are already at the top level.'))
self.write(cr, uid, [case.id], data)
cases = self.browse(cr, uid, ids)
self.__history(cr, uid, cases, _('Escalate'))
self._action(cr, uid, cases, 'escalate')
return True
def case_open(self, cr, uid, ids, *args):
"""Opens Case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
self.__history(cr, uid, cases, _('Open'))
for case in cases:
data = {'state': 'open', 'active': True}
if not case.user_id:
data['user_id'] = uid
self.write(cr, uid, case.id, data)
self._action(cr, uid, cases, 'open')
return True
def case_cancel(self, cr, uid, ids, *args):
"""Cancels Case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self.__history(cr, uid, cases, _('Cancel'))
self.write(cr, uid, ids, {'state': 'cancel',
'active': True,
'probability' : 0.0})
self._action(cr, uid, cases, 'cancel')
return True
def case_pending(self, cr, uid, ids, *args):
"""Marks case as pending
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self.__history(cr, uid, cases, _('Pending'))
self.write(cr, uid, ids, {'state': 'pending', 'active': True})
self._action(cr, uid, cases, 'pending')
return True
def case_reset(self, cr, uid, ids, *args):
"""Resets case as draft
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self.__history(cr, uid, cases, _('Draft'))
self.write(cr, uid, ids, {'state': 'draft', 'active': True})
self._action(cr, uid, cases, 'draft')
return True
crm_case()
class crm_case_log(osv.osv):
""" Case Communication History """
@ -747,7 +518,7 @@ class crm_case_log(osv.osv):
_columns = {
'name': fields.char('Status', size=64),
'date': fields.datetime('Date'),
'section_id': fields.many2one('crm.case.section', 'Section'),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
'model_id': fields.many2one('ir.model', "Model"),
'res_id': fields.integer('Resource ID'),

View File

@ -37,7 +37,7 @@ import crm
class case(osv.osv):
""" Case """
_inherit = 'crm.case'
_inherit = 'mailgate.thread'
_description = 'case'
_columns = {
@ -89,7 +89,7 @@ class case(osv.osv):
attach_to_send = None
if attach:
attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', 'crm.case'), ('res_id', '=', case.id)])
attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', 'mailgate.thread'), ('res_id', '=', case.id)])
attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname','datas'])
attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send)
@ -160,8 +160,8 @@ class base_action_rule(osv.osv):
'regex_history' : fields.char('Regular Expression on Case History', size=128),
'act_section_id': fields.many2one('crm.case.section', 'Set Team to'),
'act_categ_id': fields.many2one('crm.case.categ', 'Set Category to'),
'act_mail_to_partner': fields.boolean('Mail to partner',help="Check this \
if you want the rule to send an email to the partner."),
'act_mail_to_partner': fields.boolean('Mail to partner',help="Check \
this if you want the rule to send an email to the partner."),
}
@ -195,16 +195,18 @@ class base_action_rule(osv.osv):
ok = ok and (not action.trg_section_id or action.trg_section_id.id==obj.section_id.id)
if hasattr(obj, 'categ_id'):
ok = ok and (not action.trg_categ_id or action.trg_categ_id.id==obj.categ_id.id)
if hasattr(obj, 'history_line'):
ok = ok and (not action.trg_max_history or action.trg_max_history<=(len(obj.history_line)+1))
reg_history = action.regex_history
result_history = True
if reg_history:
ptrn = re.compile(str(reg_history))
if obj.history_line:
_result = ptrn.search(str(obj.history_line[0].description))
if not _result:
result_history = False
# TODO: history_line is removed
# if hasattr(obj, 'history_line'):
# ok = ok and (not action.trg_max_history or action.trg_max_history<=(len(obj.history_line)+1))
# reg_history = action.regex_history
# result_history = True
# if reg_history:
# ptrn = re.compile(str(reg_history))
# if obj.history_line:
# _result = ptrn.search(str(obj.history_line[0].description))
# if not _result:
# result_history = False
regex_h = not reg_history or result_history
ok = ok and regex_h
return ok

View File

@ -43,9 +43,21 @@
<field name="act_user_id" position="after">
<field name="act_section_id"/>
<field name="act_categ_id"/>
</field>
</field>
</record>
<record id="view_base_action_rule_line_form4" model="ir.ui.view">
<field name="name">base.action.rule.form4.inherit</field>
<field name="model">base.action.rule</field>
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="act_mail_to_watchers" position="before">
<field name="act_mail_to_partner"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -2,11 +2,6 @@
<openerp>
<data>
<record id="req_link_case" model="res.request.link">
<field name="name">Case</field>
<field name="object">crm.case</field>
</record>
<record id="event_type_case_create" model="res.partner.event.type">
<field name="name">CRM: Create Case</field>
<field name="key">crm_case_draft</field>

View File

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from lxml import etree
from operator import itemgetter
from osv import fields, osv
import netsvc
import os
import pooler
import tools
class crm_installer(osv.osv_memory):
_name = 'crm.installer'
_inherit = 'res.config.installer'
_columns = {
'name': fields.char('Name', size=64),
'crm_helpdesk': fields.boolean('Helpdesk', help="Manages an Helpdesk service."),
'crm_fundraising': fields.boolean('Fundraising', help="This may help associations in their fund raising process and tracking."),
'crm_claim': fields.boolean('Claims', help="Manages the supplier and customers claims, including your corrective or preventive actions."),
'crm_caldav': fields.boolean('Calendar Synchronizing', help="Help you to synchronize the meetings with other calender clients(e.g.: Sunbird)."),
'sale_crm': fields.boolean('Create Quotation from Opportunity', help="This module relates sale to opportunity cases in the CRM."),
'fetchmail': fields.boolean('Fetch Emails', help="Fetchmail Server."),
'thunderbird': fields.boolean('Thunderbird', help="Thunderbird Interface."),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(crm_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
#Checking sale module is installed or not
cr.execute("SELECT * from ir_module_module where state='installed' and name = 'sale'")
count = cr.fetchall()
if count:
doc = etree.XML(res['arch'])
nodes = doc.xpath("//field[@name='sale_crm']")
for node in nodes:
node.set('invisible', '0')
res['arch'] = etree.tostring(doc)
return res
crm_installer()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,60 @@
<openerp>
<data>
<record id="view_crm_installer" model="ir.ui.view">
<field name="name">crm.installer.view</field>
<field name="model">crm.installer</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_installer"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">CRM Modules Installation</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Configure Your CRM System</attribute>
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">You can enhance OpenERP's basic CRM support with a few additional OpenERP applications</attribute>
</xpath>
<group colspan="8">
<group colspan="2" col="2">
<separator string="Synchronization" colspan="4" />
<field name="crm_caldav" />
<field name="fetchmail" />
</group>
<group colspan="2" col="2">
<separator string="Plugins" colspan="4" />
<field name="thunderbird" />
<label string="*Outlook*" />
<!-- TODO <field name="outlook" />-->
</group>
<group colspan="4" col="4" groups="base.group_extended" name="other">
<separator string="Additional features" colspan="4" />
<field name="crm_claim" />
<field name="crm_helpdesk" />
<field name="crm_fundraising" />
<field name="sale_crm" invisible="1"/>
</group>
</group>
</data>
</field>
</record>
<record id="action_crm_installer" model="ir.actions.act_window">
<field name="name">CRM Modules Installation</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.installer</field>
<field name="view_id" ref="view_crm_installer"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="crm_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="action_crm_installer"/>
<field name="sequence">3</field>
</record>
</data>
</openerp>

View File

@ -26,27 +26,15 @@ import math
import time
import mx.DateTime
from tools.translate import _
from crm import crm_case
class crm_lead(osv.osv):
class crm_lead(osv.osv, crm_case):
""" CRM Lead Case """
_name = "crm.lead"
_description = "Leads Cases"
_order = "priority, id desc"
_inherit = ['res.partner.address', 'crm.case']
def case_open(self, cr, uid, ids, *args):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case's Ids
@param *args: Give Tuple Value
"""
res = super(crm_lead, self).case_open(cr, uid, ids, *args)
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
_inherit = ['res.partner.address', 'mailgate.thread']
def _compute_day(self, cr, uid, ids, fields, args, context={}):
"""
@ -106,22 +94,36 @@ class crm_lead(osv.osv):
return res
_columns = {
# From crm.case
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),
'create_date': fields.datetime('Creation Date' , readonly=True),
'email_cc': fields.text('Watchers Emails', size=252 , help="These \
people will receive a copy of the future communication between partner \
and users by email"),
'description': fields.text('Description'),
'write_date': fields.datetime('Update Date' , readonly=True),
# Lead fields
'categ_id': fields.many2one('crm.case.categ', 'Lead Source', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.opportunity')]"),
('object_id.model', '=', 'crm.lead')]"),
'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]"),
'partner_name': fields.char("Company Name", size=64),
'partner_name': fields.char("Partner Name", size=64),
'type':fields.selection([
('lead','Lead'),
('opportunity','Opportunity'),
],'Type', help="Type is used to separate Leads and Opportunities"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'date_closed': fields.datetime('Closed', readonly=True),
'stage_id': fields.many2one('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]"),
'opportunity_id': fields.many2one('crm.opportunity', 'Opportunity'),
'user_id': fields.many2one('res.users', 'Salesman'),
'referred': fields.char('Referred By', size=64),
'date_open': fields.datetime('Opened', readonly=True),
@ -129,14 +131,47 @@ class crm_lead(osv.osv):
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="float", store=True),
'function_name': fields.char('Function', size=64),
'function_name': fields.char('Function', size=64),
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
}
_defaults = {
'active': lambda *a: 1,
'user_id': crm_case._get_default_user,
'email_from': crm_case._get_default_email,
'state': lambda *a: 'draft',
'section_id': crm_case._get_section,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
}
def case_open(self, cr, uid, ids, *args):
"""Overrides cancel for crm_case for setting Open Date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case's Ids
@param *args: Give Tuple Value
"""
res = super(crm_lead, self).case_open(cr, uid, ids, *args)
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
def case_close(self, cr, uid, ids, *args):
"""Overrides close for crm_case for setting close date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
res = super(crm_lead, self).case_close(cr, uid, ids, args)
self.write(cr, uid, ids, {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
def convert_opportunity(self, cr, uid, ids, context=None):
""" Precomputation for converting lead to opportunity
@ -158,7 +193,6 @@ class crm_lead(osv.osv):
if data_id:
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
for case in self.browse(cr, uid, ids):
context.update({'opportunity_id': case.id})
context.update({'active_id': case.id})
if not case.partner_id:
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_partner')

View File

@ -9,72 +9,77 @@
<record id="crm_case_itisatelesalescampaign0" model="crm.lead">
<field name="type_id" ref="crm.type_lead1"/>
<field eval="'3'" name="priority"/>
<field name="type">lead</field>
<field name="user_id" ref="base.user_root"/>
<field eval="'Luc Latour'" name="name"/>
<field eval="'Luc Latour'" name="partner_name"/>
<field eval="'open'" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="'(726) 782-0636'" name="mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_oppor6"/>
<field name="stage_id" ref="crm.stage_lead1"/>
<field eval="'The Oil Company'" name="partner_name"/>
<field eval="'The Oil Company'" name="name"/>
<field eval="'(769) 703-274'" name="phone"/>
</record>
<record id="crm_case_electonicgoodsdealer0" model="crm.lead">
<field name="type_id" ref="crm.type_lead7"/>
<field eval="'4'" name="priority"/>
<field name="type">lead</field>
<field name="user_id" ref="base.user_root"/>
<field eval="'Marc Dufour'" name="name"/>
<field eval="'Marc Dufour'" name="partner_name"/>
<field eval="'open'" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="'(392) 895-7917'" name="mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_oppor2"/>
<field name="stage_id" ref="crm.stage_lead2"/>
<field eval="'Le Club SARL'" name="partner_name"/>
<field eval="'Le Club SARL'" name="name"/>
<field eval="'(956) 293-2595'" name="phone"/>
</record>
<record id="crm_case_developingwebapplications0" model="crm.lead">
<field name="type_id" ref="crm.type_lead5"/>
<field eval="'2'" name="priority"/>
<field name="type">lead</field>
<field name="user_id" ref="base.user_demo"/>
<field eval="'Fabien Pinckaers'" name="name"/>
<field eval="'Fabien Pinckaers'" name="partner_name"/>
<field eval="'done'" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="'(820) 167-3208'" name="mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_oppor4"/>
<field name="stage_id" ref="crm.stage_lead4"/>
<field eval="'TheKompany'" name="partner_name"/>
<field eval="'TheKompany'" name="name"/>
<field eval="'(079) 681-2139'" name="phone"/>
<field eval="'contact@tecsas.fr'" name="email_from"/>
</record>
<record id="crm_case_qrecorp0" model="crm.lead">
<field name="type_id" ref="crm.type_lead8"/>
<field eval="'3'" name="priority"/>
<field name="type">lead</field>
<field name="user_id" ref="base.user_root"/>
<field eval="'Henry Mc Coy'" name="name"/>
<field eval="'Henry Mc Coy'" name="partner_name"/>
<field eval="'draft'" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="'(077) 582-4035'" name="mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_oppor1"/>
<field name="stage_id" ref="crm.stage_lead1"/>
<field eval="'The Gas Company'" name="partner_name"/>
<field eval="'The Gas Company'" name="name"/>
<field eval="'(514) 698-4118'" name="phone"/>
</record>
<record id="crm_case_itdeveloper0" model="crm.lead">
<field name="type_id" ref="crm.type_lead4"/>
<field eval="'3'" name="priority"/>
<field name="type">lead</field>
<field name="user_id" ref="base.user_root"/>
<field eval="'Carrie Helle'" name="name"/>
<field eval="'Carrie Helle'" name="partner_name"/>
<field eval="'pending'" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="'(333) 715-1450'" name="mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_oppor6"/>
<field name="stage_id" ref="crm.stage_lead3"/>
<field eval="'Stonage IT'" name="partner_name"/>
<field eval="'Stonage IT'" name="name"/>
<field eval="'(855) 924-4364'" name="phone"/>
</record>
<record id="crm_case_mgroperations0" model="crm.lead">
@ -83,14 +88,15 @@
<field name="type_id" ref="crm.type_lead3"/>
<field name="partner_id" ref="base.res_partner_9"/>
<field eval="'3'" name="priority"/>
<field name="type">lead</field>
<field name="user_id" ref="base.user_root"/>
<field eval="'Tina Pinero'" name="name"/>
<field eval="'Tina Pinero'" name="partner_name"/>
<field eval="'cancel'" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="'(468) 017-2684'" name="mobile"/>
<field name="categ_id" ref="crm.categ_oppor8"/>
<field name="stage_id" ref="crm.stage_lead6"/>
<field eval="'Opensides SPRL'" name="partner_name"/>
<field eval="'Opensides SPRL'" name="name"/>
<field eval="'(373) 907-1009'" name="phone"/>
<field eval="'info@opensides.be'" name="email_from"/>
</record>
@ -98,14 +104,15 @@
<field eval="1" name="active"/>
<field name="type_id" ref="crm.type_lead8"/>
<field eval="'3'" name="priority"/>
<field name="type">lead</field>
<field name="user_id" ref="base.user_root"/>
<field eval="'Wendi Baltz'" name="name"/>
<field eval="'Wendi Baltz'" name="partner_name"/>
<field eval="'done'" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="'(463) 014-1208'" name="mobile"/>
<field name="categ_id" ref="crm.categ_oppor4"/>
<field name="stage_id" ref="crm.stage_lead4"/>
<field eval="'Gardner Group'" name="partner_name"/>
<field eval="'Gardner Group'" name="name"/>
<field eval="'(282) 603-7489'" name="phone"/>
</record>
</data>

View File

@ -6,15 +6,19 @@
<field name="name">Leads</field>
<field name="res_model">crm.lead</field>
<field name="view_mode">tree,form</field>
<field name="domain">['|', ('type','=','lead'), ('type','=',False)]</field>
<field name="view_id" ref="crm_case_tree_view_leads"/>
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
<field name="context">{'search_default_current':1}</field>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_leads_all">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_leads"/>
<field name="act_window_id" ref="crm_case_category_act_leads_all"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_leads_all">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
@ -24,6 +28,8 @@
<menuitem id="base.menu_sales" name="Sales"
parent="base.menu_base_partner" sequence="1" />
<menuitem parent="base.menu_sales" name="Leads"
groups="base.group_extended"
id="menu_crm_case_categ0_act_leads"

View File

@ -40,7 +40,7 @@
<field name="arch" type="xml">
<form string="Leads Form">
<group colspan="4" col="7">
<field name="name" required="1"/>
<field name="name" required="1" string="Name"/>
<field name="priority"/>
<field name="date_deadline"/>
<button
@ -48,8 +48,7 @@
string="Convert"
help="Convert to Opportunity"
icon="gtk-index"
type="object"
attrs="{'invisible':[('opportunity_id','!=',False)]}"/>
type="object"/>
<newline />
<field name="section_id" colspan="1"
widget="selection" />
@ -69,7 +68,7 @@
<page string="Lead">
<group colspan="2" col="4">
<separator string="Contact" colspan="4" col="4"/>
<field name="partner_name" colspan="4"/>
<field name="partner_name" string="Partner Name" colspan="4"/>
<newline/>
<field domain="[('domain', '=', 'contact')]" name="title"/>
<field name="function_name" />
@ -97,7 +96,6 @@
icon="gtk-index" type="action"
string="Create"
attrs="{'invisible':[('partner_id','!=',False)]}"/>
<field name="opportunity_id"/>
</group>
<separator colspan="4" string="Notes"/>
<field name="description" nolabel="1" colspan="4"/>
@ -133,7 +131,7 @@
widget="selection" colspan="2" />
<field name="categ_id"
widget="selection"
domain="[('object_id.model', '=', 'crm.opportunity')]" />
domain="[('object_id.model', '=', 'crm.lead')]" />
<field name="type_id" string="Campaign" select="1"/>
<field name="referred"/>
</group>
@ -154,16 +152,13 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="history_line" colspan="4" nolabel="1" mode="form,tree">
<!-- TODO-->
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
@ -180,7 +175,7 @@
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
</field>
<button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
@ -271,7 +266,7 @@
<search string="Search Leads">
<filter icon="terp-project"
string="Current"
default="1"
default="1" name="current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-project"
string="Open"
@ -314,7 +309,7 @@
help="Show Sales Team"/>
</field>
<newline/>
<group expand="1" string="Group By..." colspan="14">
<group expand="0" string="Group By..." colspan="14">
<filter string="Stage" icon="terp-crm" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="State" icon="terp-crm" domain="[]" context="{'group_by':'state'}"/>
<filter string="Source" icon="terp-crm" domain="[]" context="{'group_by':'categ_id'}"/>

View File

@ -38,8 +38,8 @@ from tools import command_re
class crm_cases(osv.osv):
""" crm cases """
_name = "crm.case"
_inherit = "crm.case"
_name = "mailgate.thread"
_inherit = "mailgate.thread"
def message_new(self, cr, uid, msg, context):
"""

View File

@ -19,38 +19,50 @@
#
##############################################################################
from osv import fields, osv
import crm
from datetime import datetime, timedelta
from datetime import datetime, timedelta
from tools.translate import _
from base_calendar import base_calendar
from crm import crm_case
from datetime import datetime, timedelta
from osv import fields, osv
from tools.translate import _
import time
class crm_opportunity(osv.osv):
_name = 'crm.opportunity'
crm_opportunity()
class crm_lead(osv.osv, crm_case):
""" CRM Leads """
_name = 'crm.lead'
crm_lead()
class crm_phonecall(osv.osv):
class crm_phonecall(osv.osv, crm_case):
""" CRM Phonecall """
_name = 'crm.phonecall'
crm_phonecall()
class crm_meeting(osv.osv):
class crm_meeting(osv.osv, crm_case):
""" CRM Meeting Cases """
_name = 'crm.meeting'
_description = "Meeting Cases"
_order = "id desc"
_inherit = ["crm.case", "calendar.event"]
_inherit = ["mailgate.thread", "calendar.event"]
_columns = {
# From crm.case
'name': fields.char('Summary', size=124, required=True),
'partner_id': fields.many2one('res.partner', 'Partner'),
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
domain="[('partner_id','=',partner_id)]"),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'id': fields.integer('ID'),
# Meeting fields
'categ_id': fields.many2one('crm.case.categ', 'Meeting Type', \
domain="[('object_id.model', '=', 'crm.meeting')]", \
),
'phonecall_id': fields.many2one ('crm.phonecall', 'Phonecall'),
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
'opportunity_id': fields.many2one ('crm.lead', 'Opportunity', domain="[('type', '=', 'opportunity')]"),
'attendee_ids': fields.many2many('calendar.attendee', 'meeting_attendee_rel',\
'event_id', 'attendee_id', 'Attendees'),
'date_closed': fields.datetime('Closed', readonly=True),
@ -63,7 +75,8 @@ class crm_meeting(osv.osv):
}
_defaults = {
'state': lambda *a: 'draft',
'state': lambda *a: 'draft',
'active': lambda *a: 1,
}
def open_meeting(self, cr, uid, ids, context=None):
@ -106,7 +119,7 @@ class crm_meeting(osv.osv):
}
return value
crm_meeting()
class calendar_attendee(osv.osv):

View File

@ -12,7 +12,6 @@
domain="[('partner_id', '=', active_id)]"
/>
<record model="ir.actions.act_window" id="crm_case_categ_meet_create_partner">
<field name="context" eval="{'default_state':'draft'}"/>
</record>
@ -24,18 +23,21 @@
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_create_partner"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_meet_partner">
<field name="sequence" eval="2"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_create_partner"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_form_meet_partner">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_form_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_create_partner"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_meet_partner">
<field name="sequence" eval="3"/>
<field name="view_mode">gantt</field>
@ -43,68 +45,36 @@
<field name="act_window_id" ref="crm_case_categ_meet_create_partner"/>
</record>
<act_window
id="crm_case_categ_meet_case"
name="Schedule a Meeting"
res_model="crm.meeting"
src_model="crm.case"
view_mode="calendar,tree,form,gantt"
context="{'default_case_id': active_id, 'default_duration': 4.0}"
/>
<record model="ir.actions.act_window" id="crm_case_categ_meet_case">
<field name="context" eval="{'default_state':'draft'}"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_calendar_meet_case">
<field name="sequence" eval="1"/>
<field name="view_mode">calendar</field>
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_case"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_meet_case">
<field name="sequence" eval="2"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_case"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_form_meet_case">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_form_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_case"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_meet_case">
<field name="sequence" eval="3"/>
<field name="view_mode">gantt</field>
<field name="view_id" ref="crm_case_gantt_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_case"/>
</record>
<record model="ir.actions.act_window" id="crm_case_categ_meet">
<field name="name">Meetings</field>
<field name="res_model">crm.meeting</field>
<field name="view_mode">calendar,tree,form,gantt</field>
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="context">{'search_default_current':1}</field>
<field name="search_view_id" ref="view_crm_case_meetings_filter"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_calendar_meet">
<field name="sequence" eval="1"/>
<field name="view_mode">calendar</field>
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_meet">
<field name="sequence" eval="2"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_form__meet">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_form_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_meet">
<field name="sequence" eval="1"/>
<field name="view_mode">gantt</field>
@ -121,6 +91,12 @@
action="crm_case_categ_meet" parent="menu_meeting_sale"
sequence="1" />
<record id="ir_ui_view_sc_calendar0" model="ir.ui.view_sc">
<field name="name">Calendar</field>
<field name="resource">ir.ui.menu</field>
<field name="user_id" ref="base.user_root"/>
<field name="res_id" ref="crm.menu_crm_case_categ_meet"/>
</record>
<record id="action_view_attendee_form" model="ir.actions.act_window">
<field name="name">Meeting Invitations</field>
<field name="type">ir.actions.act_window</field>
@ -136,57 +112,5 @@
name="Meeting Invitations" parent="crm.menu_meeting_sale"
sequence="10" action="action_view_attendee_form" />
<record model="ir.actions.act_window" id="crm_case_category_act_meetall3">
<field name="name">Next Meetings</field>
<field name="res_model">crm.meeting</field>
<field name="view_type">form</field>
<field name="view_mode">tree,calendar,form,gantt</field>
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="domain"
eval="[('state','in',('pending','draft','open')),('date','>=',time.strftime('%Y-%m-%d'))]" />
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_calendar_view_meetall3">
<field name="sequence" eval="2"/>
<field name="view_mode">calendar</field>
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="act_window_id" ref="crm_case_category_act_meetall3"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_meetall3">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_meet"/>
<field name="act_window_id" ref="crm_case_category_act_meetall3"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_meetall3">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_form_view_meet"/>
<field name="act_window_id" ref="crm_case_category_act_meetall3"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_view_meetall3">
<field name="sequence" eval="2"/>
<field name="view_mode">gantt</field>
<field name="view_id" ref="crm_case_gantt_view_meet"/>
<field name="act_window_id" ref="crm_case_category_act_meetall3"/>
</record>
<record id="ir_ui_view_sc_calendar0" model="ir.ui.view_sc">
<field name="name">Calendar</field>
<field name="resource">ir.ui.menu</field>
<field name="user_id" ref="base.user_root"/>
<field name="res_id" ref="crm.menu_crm_case_categ_meet"/>
</record>
<record id="ir_ui_view_sc_calendar1" model="ir.ui.view_sc">
<field name="name">Calendar</field>
<field name="resource">ir.ui.menu</field>
<field name="user_id" ref="base.user_demo"/>
<field name="res_id" ref="crm.menu_crm_case_categ_meet"/>
</record>
</data>
</openerp>

View File

@ -24,18 +24,15 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Meetings">
<group col="6" colspan="4">
<group col="6" colspan="6">
<field name="name" select="1" string="Summary"
colspan="2" />
<field name="categ_id" widget="selection"
string="Meeting Type"
groups="base.group_extended"
domain="[('object_id.model', '=', 'crm.meeting')]" />
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
</group>
<newline/>
<field name="date" string="Start Date" required="1"
<group col="6" colspan="4">
<field name="name" select="1" string="Summary"
colspan="2" />
<field name="categ_id" widget="selection"
string="Meeting Type"
groups="base.group_extended"
domain="[('object_id.model', '=', 'crm.meeting')]" />
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
<field name="date" string="Start Date" required="1"
on_change="onchange_dates(date,duration,False)" />
<field name="duration" widget="float_time"
on_change="onchange_dates(date,duration,False)" />
@ -60,7 +57,7 @@
</group>
</group>
<group col="4" colspan="4" name="rrule" attrs="{'invisible': [('rrule_type','!=','custom')]}">
<separator string="Select data for Custom Rule" colspan="8"/>
<separator string="Data for Custom Rule" colspan="8"/>
<group col="8" colspan="4">
<field name="freq" />
<field name="interval" />
@ -123,8 +120,7 @@
<separator colspan="2" string="Visibility"/>
<field name="class" string="Privacy"/>
<field name="show_as" string="Show time as" groups="base.group_extended"/>
<field name="rrule" groups="base.group_extended" />
<field name="exrule" groups="base.group_extended" />
<field name="rrule" invisible="1" />
<field name="recurrent_id" invisible="1"/>
<field name="recurrent_uid" invisible="1"/>
</group>
@ -137,6 +133,9 @@
<button name="case_close" string="Done"
states="open" type="object"
icon="gtk-jump-to" />
<button name="case_reset" string="Reset to Unconfirmed"
states="open,done,cancel" type="object"
icon="gtk-convert" />
<button name="case_open" string="Confirm"
states="draft" type="object"
icon="gtk-go-forward" />
@ -219,7 +218,7 @@
<field name="date" string="Meeting Date" />
<field name="duration" />
<field name="user_id" />
<field name="state" invisible="1"/>
<field name="state"/>
</tree>
</field>
</record>
@ -265,12 +264,12 @@
<field name="arch" type="xml">
<search string="Search Meetings">
<group col="12" colspan="4">
<filter icon="terp-crm" string="My Meetings"
<filter icon="terp-project" name="current" string="Current"
domain="[('state','in',('draft', 'open'))]"
help="Current Meetings"/>
<filter icon="terp-partner" string="My Meetings"
domain="[('user_id','=',uid)]"
help="My Meetings" />
<filter icon="terp-crm" name="current" string="Current"
domain="[('state','in',('draft', 'open'))]"
help="Current Meetings"/>
<separator orientation="vertical"/>
<field name="name" select="1" string="Subject"/>
<field name="partner_id" select="1" />
@ -282,6 +281,22 @@
</field>
<field name="user_id" select="1" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="16">
<filter string="Date" icon="terp-project"
domain="[]" context="{'group_by':'date'}" />
<filter string="Privacy" icon="terp-crm"
domain="[]" context="{'group_by':'class'}" />
<separator orientation="vertical" />
<filter string="Responsible" icon="terp-crm" domain="[]"
context="{'group_by':'user_id'}" />
<filter string="Partner" icon="terp-partner" domain="[]"
context="{'group_by':'partner_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-crm" domain="[]"
context="{'group_by':'state'}" />
<separator orientation="vertical" />
</group>
</search>
</field>
</record>

View File

@ -37,10 +37,9 @@ AVAILABLE_STATES = [
class crm_opportunity(osv.osv):
""" Opportunity Cases """
_name = "crm.opportunity"
_name = "crm.lead"
_description = "Opportunity Cases"
_order = "priority,date_action,id desc"
_inherit = 'crm.case'
def case_open(self, cr, uid, ids, *args):
"""
@ -113,36 +112,56 @@ class crm_opportunity(osv.osv):
return res
_columns = {
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.opportunity')]"),
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id), \
('object_id.model', '=', 'crm.opportunity')]"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'referred': fields.char('Referred By', size=64),
# From crm.case
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
domain="[('partner_id','=',partner_id)]"),
# Opportunity fields
'probability': fields.float('Probability (%)'),
'planned_revenue': fields.float('Expected Revenue'),
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
'date_closed': fields.datetime('Closed', readonly=True),
'user_id': fields.many2one('res.users', 'Salesman', help='By Default set the user is Administrator'),
'phone': fields.char("Phone", size=64),
'date_deadline': fields.date('Expected Closing'),
'date_action': fields.date('Next Action'),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'date_open': fields.datetime('Opened', readonly=True),
'day_open': fields.function(_compute_day, string='Days to Open', \
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="float", store=True),
}
def case_close(self, cr, uid, ids, *args):
"""Overrides close for crm_case for setting probability and close date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
res = super(crm_opportunity, self).case_close(cr, uid, ids, args)
self.write(cr, uid, ids, {'probability' : 100.0, 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
def case_cancel(self, cr, uid, ids, *args):
"""Overrides cancel for crm_case for setting probability
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
res = super(crm_opportunity, self).case_cancel(cr, uid, ids, args)
self.write(cr, uid, ids, {'probability' : 0.0})
return res
def case_open(self, cr, uid, ids, *args):
"""Overrides cancel for crm_case for setting Open Date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case's Ids
@param *args: Give Tuple Value
"""
res = super(crm_opportunity, self).case_open(cr, uid, ids, *args)
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
""" @param self: The object pointer
@ -157,40 +176,11 @@ class crm_opportunity(osv.osv):
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
if not stage.on_change:
return {'value':{}}
return {'value':{'probability':stage.probability}}
def stage_next(self, cr, uid, ids, context={}):
""" @param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of stage nexts IDs
@param context: A standard dictionary for contextual values """
res = super(crm_opportunity, self).stage_next(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
if case.stage_id and case.stage_id.on_change:
self.write(cr, uid, [case.id], {'probability': case.stage_id.probability})
return res
def stage_previous(self, cr, uid, ids, context={}):
""" @param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of stage previouss IDs
@param context: A standard dictionary for contextual values """
res = super(crm_opportunity, self).stage_previous(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
if case.stage_id and case.stage_id.on_change:
self.write(cr, uid, [case.id], {'probability': case.stage_id.probability})
return res
return {'value':{'probability': stage.probability}}
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.opportunity', context=c),
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
'state' : 'draft',
}
def action_makeMeeting(self, cr, uid, ids, context=None):
@ -231,7 +221,6 @@ class crm_opportunity(osv.osv):
}
value = {
'name': _('Meetings'),
'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id),
'context': context,
'view_type': 'form',
'view_mode': 'calendar,form,tree',
@ -246,3 +235,4 @@ class crm_opportunity(osv.osv):
crm_opportunity()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -4,91 +4,91 @@
<record model="crm.case.categ" id="categ_oppor1">
<field name="name">Existing Customer</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor2">
<field name="name">Self Generated</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor3">
<field name="name">Employee</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor4">
<field name="name">Partner</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor5">
<field name="name">Campaign</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor6">
<field name="name">Website</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor7">
<field name="name">Word of mouth</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor8">
<field name="name">Other</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<!-- CASE STATUS(stage_id) -->
<record model="crm.case.stage" id="stage_oppor1">
<field name="name">Prospecting</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_oppor2">
<field name="name">Needs Analysis</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_oppor3">
<field name="name">Value Proposition</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_oppor4">
<field name="name">Proposal/Price Quote</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_oppor5">
<field name="name">Negotiation/Review</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_oppor6">
<field name="name">Closed Won</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_oppor7">
<field name="name">Closed Lost</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<!-- Case Resource(type_id) -->
<record model="crm.case.resource.type" id="type_oppor1">
<field name="name">Existing Business</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_oppor2">
<field name="name">New Business</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
</data>

View File

@ -7,10 +7,11 @@
<!--For Opportunity-->
<record id="crm_case_construstazunits0" model="crm.opportunity">
<record id="crm_case_construstazunits0" model="crm.lead">
<field eval="60" name="probability"/>
<field name="partner_address_id" ref="base.res_partner_address_zen"/>
<field eval="1" name="active"/>
<field name="type">opportunity</field>
<field name="type_id" ref="crm.type_oppor1"/>
<field name="partner_id" ref="base.res_partner_3"/>
<field eval="&quot;3&quot;" name="priority"/>
@ -22,9 +23,10 @@
<field name="stage_id" ref="crm.stage_oppor3"/>
<field eval="&quot;CONS TRUST (AZ) 529701 - 1000 units&quot;" name="name"/>
</record>
<record id="crm_case_rdroundfundingunits0" model="crm.opportunity">
<record id="crm_case_rdroundfundingunits0" model="crm.lead">
<field name="partner_address_id" ref="base.res_partner_address_15"/>
<field eval="1" name="active"/>
<field name="type">opportunity</field>
<field name="type_id" ref="crm.type_oppor2"/>
<field name="partner_id" ref="base.res_partner_11"/>
<field eval="&quot;3&quot;" name="priority"/>
@ -37,10 +39,11 @@
<field name="stage_id" ref="crm.stage_oppor1"/>
<field eval="&quot;3rd Round Funding - 1000 units &quot;" name="name"/>
</record>
<record id="crm_case_mediapoleunits0" model="crm.opportunity">
<record id="crm_case_mediapoleunits0" model="crm.lead">
<field eval="10" name="probability"/>
<field name="partner_address_id" ref="base.res_partner_address_3"/>
<field eval="1" name="active"/>
<field name="type">opportunity</field>
<field name="type_id" ref="crm.type_oppor1"/>
<field name="partner_id" ref="base.res_partner_8"/>
<field eval="&quot;3&quot;" name="priority"/>
@ -54,10 +57,11 @@
<field eval="&quot;Mediapole - 5000 units&quot;" name="name"/>
<field eval="&quot;info@mediapole.net&quot;" name="email_from"/>
</record>
<record id="crm_case_abcfuelcounits0" model="crm.opportunity">
<record id="crm_case_abcfuelcounits0" model="crm.lead">
<field eval="40" name="probability"/>
<field name="partner_address_id" ref="base.res_partner_address_1"/>
<field eval="1" name="active"/>
<field name="type">opportunity</field>
<field name="type_id" ref="crm.type_oppor1"/>
<field name="partner_id" ref="base.res_partner_9"/>
<field eval="&quot;3&quot;" name="priority"/>
@ -70,10 +74,11 @@
<field eval="&quot;ABC FUEL CO 829264 - 1000 units &quot;" name="name"/>
<field eval="&quot;info@opensides.be&quot;" name="email_from"/>
</record>
<record id="crm_case_dirtminingltdunits0" model="crm.opportunity">
<record id="crm_case_dirtminingltdunits0" model="crm.lead">
<field eval="80" name="probability"/>
<field name="partner_address_id" ref="base.res_partner_address_wong"/>
<field eval="1" name="active"/>
<field name="type">opportunity</field>
<field name="partner_id" ref="base.res_partner_maxtor"/>
<field eval="&quot;3&quot;" name="priority"/>
<field name="user_id" ref="base.user_root"/>

View File

@ -6,7 +6,7 @@
id="act_crm_opportunity_crm_meeting_new"
name="Meetings"
res_model="crm.meeting"
src_model="crm.opportunity"
src_model="crm.lead"
view_mode="tree,form,calendar,"
context="{'default_duration': 4.0, 'default_opportunity_id': active_id}"
domain="[('user_id','=',uid), ('opportunity_id', '=', active_id)]"
@ -16,7 +16,7 @@
id="act_crm_opportunity_crm_phonecall_new"
name="Phone calls"
res_model="crm.phonecall"
src_model="crm.opportunity"
src_model="crm.lead"
view_mode="calendar,tree,form"
context="{'default_duration': 1.0 ,'default_opportunity_id': active_id}"
domain="[('user_id','=',uid),('opportunity_id', '=', active_id)]"
@ -24,31 +24,38 @@
<record model="ir.actions.act_window" id="crm_case_category_act_oppor11">
<field name="name">Opportunities</field>
<field name="res_model">crm.opportunity</field>
<field name="res_model">crm.lead</field>
<field name="view_mode">tree,form,graph</field>
<field name="domain">[('type','=','opportunity')]</field>
<field name="context">{'search_default_current':1}</field>
<field name="view_id" ref="crm_case_tree_view_oppor"/>
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_oppor11">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_oppor"/>
<field name="act_window_id" ref="crm_case_category_act_oppor11"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_oppor11">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_form_view_oppor"/>
<field name="act_window_id" ref="crm_case_category_act_oppor11"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_oppor11">
<field name="sequence" eval="4"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="crm_case_graph_view_opportunity"/>
<field name="act_window_id" ref="crm_case_category_act_oppor11"/>
</record>
<menuitem id="base.menu_sales" name="Sales"
parent="base.menu_base_partner" sequence="1" />
<menuitem name="Opportunities" id="menu_crm_case_opp"
parent="base.menu_sales" action="crm_case_category_act_oppor11"
sequence="2" />

View File

@ -9,8 +9,8 @@
<field name="res_model">crm.case.categ</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'crm.opportunity')]</field>
<field name="context">{'object_id':'crm.opportunity'}</field>
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
<field name="context">{'object_id':'crm.lead'}</field>
</record>
<menuitem action="crm_opportunity_categ_action"
@ -24,8 +24,8 @@
<field name="res_model">crm.case.stage</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_stage_tree"/>
<field name="domain">[('object_id.model', '=', 'crm.opportunity')]</field>
<field name="context">{'object_id':'crm.opportunity'}</field>
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
<field name="context">{'object_id':'crm.lead'}</field>
</record>
<menuitem action="crm_opportunity_stage_act"
@ -39,8 +39,8 @@
<field name="res_model">crm.case.resource.type</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_resource_type_tree"/>
<field name="domain">[('object_id.model', '=', 'crm.opportunity')]</field>
<field name="context">{'object_id':'crm.opportunity'}</field>
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
<field name="context">{'object_id':'crm.lead'}</field>
</record>
<menuitem action="crm_opportunity_resource_act"
@ -51,7 +51,7 @@
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Opportunities</field>
<field name="model">crm.opportunity</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Opportunities">
@ -62,7 +62,7 @@
<field name="stage_id" nolabel="1"
on_change="onchange_stage_id(stage_id)"
widget="selection"
domain="[('object_id.model', '=', 'crm.opportunity')]" />
domain="[('object_id.model', '=', 'crm.lead')]" />
<button name="stage_previous"
states="open,pending" type="object"
icon="gtk-go-back" string="" />
@ -86,7 +86,7 @@
</group>
<notebook colspan="4">
<page string="Opportunity">
<group col="3" colspan="2">
<group col="4" colspan="2">
<separator colspan="4" string="Contacts"/>
<field name="partner_id" select="1"
on_change="onchange_partner_id(partner_id, email_from)"
@ -103,7 +103,7 @@
<field name="section_id" colspan="1" widget="selection"/>
<field name="categ_id" select="1" groups="base.group_extended"
string="Category" widget="selection"
domain="[('object_id.model', '=', 'crm.opportunity')]" />
domain="[('object_id.model', '=', 'crm.lead')]" />
</group>
<separator colspan="4" string="Details"/>
@ -124,7 +124,7 @@
icon="gtk-media-pause" />
<button name="case_close" string="Mark Won"
states="open,draft,pending" type="object"
icon="gtk-close" />
icon="gtk-apply" />
<button name="case_cancel" string="Mark Lost"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
@ -153,7 +153,12 @@
<field name="ref"/>
<field name="ref2"/>
<field name="log_ids" nolabel="1" colspan="4">
<form string="Actions">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
@ -165,23 +170,19 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="history_line" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.opportunity'}"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
@ -192,10 +193,10 @@
</field>
<button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.opportunity'}"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"
name="%(crm_opportunity_forward_to_partner_act)d"
name="%(crm_lead_forward_to_partner_act)d"
icon="gtk-go-forward" type="action" />
</page>
</notebook>
@ -207,7 +208,7 @@
<record model="ir.ui.view" id="crm_case_tree_view_oppor">
<field name="name">Opportunities Tree</field>
<field name="model">crm.opportunity</field>
<field name="model">crm.lead</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel','done')">
@ -248,7 +249,7 @@
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
<field name="name">CRM - Opportunity Graph</field>
<field name="model">crm.opportunity</field>
<field name="model">crm.lead</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
@ -263,13 +264,13 @@
<record id="view_crm_case_opportunities_filter" model="ir.ui.view">
<field name="name">CRM - Opportunities Search</field>
<field name="model">crm.opportunity</field>
<field name="model">crm.lead</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Opportunities">
<filter icon="terp-project"
string="Current"
default="1"
name="current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-project"
string="Open"
@ -305,7 +306,7 @@
help="My section" />
</field>
<newline/>
<group expand="1" string="Group By..." colspan="16">
<group expand="0" string="Group By..." colspan="16">
<filter string="Stage" icon="terp-crm" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Priority" icon="terp-crm" domain="[]"

View File

@ -19,43 +19,108 @@
#
##############################################################################
from crm import crm_case
from osv import fields, osv
from tools.translate import _
import crm
import time
class crm_phonecall(osv.osv):
class crm_phonecall(osv.osv, crm_case):
""" Phonecall Cases """
_name = "crm.phonecall"
_description = "Phonecall Cases"
_order = "id desc"
_inherit = 'crm.case'
_inherit = 'mailgate.thread'
_columns = {
'duration': fields.float('Duration'),
# From crm.case
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),
'user_id': fields.many2one('res.users', 'Responsible'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
domain="[('partner_id','=',partner_id)]"),
'company_id': fields.many2one('res.company', 'Company'),
'description': fields.text('Description'),
'state': fields.selection([
('draft', 'Draft'),
('open', 'Todo'),
('cancel', 'Cancelled'),
('done', 'Closed'),
('pending', 'Pending'),
], 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'stage_id': fields.many2one('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.phonecall')]"),
'date_open': fields.datetime('Opened', readonly=True),
# phonecall fields
'duration': fields.float('Duration'),
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.phonecall')]"),
'partner_phone': fields.char('Phone', size=32),
'partner_contact': fields.related('partner_address_id', 'name',\
type="char", string="Contact", size=128),
'partner_mobile': fields.char('Mobile', size=32),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'canal_id': fields.many2one('res.partner.canal', 'Channel',\
('object_id.model', '=', 'crm.phonecall')]"),
'partner_phone': fields.char('Phone', size=32),
'partner_contact': fields.related('partner_address_id', 'name', \
type="char", string="Contact", size=128),
'partner_mobile': fields.char('Mobile', size=32),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'canal_id': fields.many2one('res.partner.canal', 'Channel', \
help="The channels represent the different communication\
modes available with the customer." \
" With each commercial opportunity, you can indicate\
the canall which is this opportunity source."),
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
the canall which is this opportunity source."),
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'opportunity_id': fields.many2one ('crm.lead', 'Opportunity'),
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
'state': lambda *a: 'draft',
'active': lambda *a: 1,
}
# From crm.case
def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
res = super(crm_phonecall, self).onchange_partner_address_id(cr, uid, ids, add, email)
res.setdefault('value', {})
if add:
address = self.pool.get('res.partner.address').browse(cr, uid, add)
res['value']['partner_phone'] = address.phone
res['value']['partner_mobile'] = address.mobile
return res
def case_close(self, cr, uid, ids, *args):
"""Overrides close for crm_case for setting close date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
res = super(crm_phonecall, self).case_close(cr, uid, ids, args)
self.write(cr, uid, ids, {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
def case_open(self, cr, uid, ids, *args):
"""Overrides cancel for crm_case for setting Open Date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case's Ids
@param *args: Give Tuple Value
"""
res = super(crm_phonecall, self).case_open(cr, uid, ids, *args)
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
def action_make_meeting(self, cr, uid, ids, context=None):
"""
@ -86,36 +151,28 @@ class crm_phonecall(osv.osv):
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
context = {
'default_phonecall_id': phonecall.id,
'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False,
'default_email': phonecall.email_from ,
'default_phonecall_id': phonecall.id,
'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False,
'default_email': phonecall.email_from ,
'default_name': phonecall.name
}
value = {
'name': _('Meetings'),
'domain' : "[('user_id','=',%s)]" % (uid),
'context': context,
'view_type': 'form',
'view_mode': 'calendar,form,tree',
'res_model': 'crm.meeting',
'view_id': False,
'views': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')],
'type': 'ir.actions.act_window',
'search_view_id': res['res_id'],
'name': _('Meetings'),
'domain' : "[('user_id','=',%s)]" % (uid),
'context': context,
'view_type': 'form',
'view_mode': 'calendar,form,tree',
'res_model': 'crm.meeting',
'view_id': False,
'views': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')],
'type': 'ir.actions.act_window',
'search_view_id': res['res_id'],
'nodestroy': True
}
return value
def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
res = super(crm_phonecall, self).onchange_partner_address_id(cr, uid, ids, add, email)
res.setdefault('value', {})
if add:
address = self.pool.get('res.partner.address').browse(cr, uid, add)
res['value']['partner_phone'] = address.mobile
res['value']['partner_mobile'] = address.phone
return res
crm_phonecall()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -62,7 +62,7 @@
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_incoming0">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_phone_tree_view"/>
<field name="view_id" ref="crm_case_inbound_phone_tree_view"/>
<field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
</record>
@ -76,7 +76,7 @@
<record model="ir.actions.act_window.view" id="action_crm_tag_form_phone_incoming0">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_phone_form_view"/>
<field name="view_id" ref="crm_case_inbound_phone_form_view"/>
<field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
</record>

View File

@ -53,7 +53,7 @@
type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<button string="Meeting"
states="draft,open,pending"
name="action_make_meeting" type="action" />
name="action_make_meeting" type="object" />
<field name="state"/>
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/>
<button name="case_close" string="Held" states="open,draft,pending" type="object" icon="gtk-jump-to"/>
@ -72,7 +72,7 @@
<field name="arch" type="xml">
<form string="Phone Call">
<group colspan="4" col="7">
<field name="name" string="Call Summary"/>
<field name="name" string="Summary"/>
<field name="date" string="Planned Date"/>
<field name="user_id"/>
<button string="Schedule a Meeting"
@ -137,6 +137,93 @@
</form>
</field>
</record>
<!--Inbound Phonecalls Form View -->
<record model="ir.ui.view" id="crm_case_inbound_phone_form_view">
<field name="name">CRM - Inbound Phone Call Form</field>
<field name="model">crm.phonecall</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Phone Call">
<group colspan="4" col="7">
<field name="name" string="Summary"/>
<field name="date" string="Planned Date"/>
<field name="user_id"/>
<button string="Schedule a Meeting"
name="action_make_meeting"
icon="gtk-redo"
type="object" />
<field name="partner_phone"/>
<field name="duration"/>
<field name="section_id" colspan="1" widget="selection" />
<button string="Convert to Opportunity"
name="%(phonecall2opportunity_act)d"
icon="gtk-index" type="action"
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<label colspan="6" string=""/>
<button string="Schedule Other Call"
icon="gtk-redo"
name="%(phonecall_to_phonecall_act)d"
type="action" />
</group>
<group col="3" colspan="2">
<separator colspan="3" string="Contacts" />
<field name="partner_id"
on_change="onchange_partner_id(partner_id, email_from)" />
<button string="Create a Partner"
icon="terp-crm"
name="%(action_crm_phonecall2partner)d"
type="action"
attrs="{'invisible':[('partner_id','!=',False)]}" />
<newline/>
<field name="partner_address_id" string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)" />
<newline/>
<field name="partner_phone" />
<newline/>
<field name="partner_mobile" />
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Categorization" />
<field name="priority"/>
<field name="opportunity_id"/>
</group>
<separator string="Description" colspan="4" />
<field name="description" nolabel="1" colspan="4" />
<separator colspan="4" />
</form>
</field>
</record>
<!--Inbound Phonecalls Tree View -->
<record model="ir.ui.view" id="crm_case_inbound_phone_tree_view">
<field name="name">CRM - Inbound Phone Calls Tree</field>
<field name="model">crm.phonecall</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Phone Calls" colors="grey:state in ('cancel','done');blue:state in ('pending',)">
<field name="date" string="Date"/>
<field name="name" string="Call Summary"/>
<field name="partner_id" string="Partner"/>
<field name="partner_contact"/>
<field name="partner_phone"/>
<field name="user_id"/>
<field name="state" invisible="1"/>
<button string="Opportunity"
name="%(phonecall2opportunity_act)d"
states="draft,open,pending"
icon="gtk-convert"
type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<button string="Meeting"
states="draft,open,pending" icon="gtk-redo"
name="action_make_meeting" type="object" />
</tree>
</field>
</record>
<!-- Phonecalls Calendar View -->
@ -190,7 +277,7 @@
help="My section" />
</field>
<newline/>
<group expand="1" string="Group By..." colspan="4">
<group expand="0" string="Group By..." colspan="4">
<filter string="Partner" icon="terp-crm" domain="[]"
context="{'group_by':'partner_id'}" />
<filter string="Responsible" icon="terp-crm"

View File

@ -9,7 +9,7 @@
<field name="model">report.crm.case.section.categ2</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Cases by Section and Type">
<tree string="Cases by Team and Type">
<field name="name"/>
<field name="month"/>
<field name="user_id"/>
@ -31,7 +31,7 @@
<field name="model">report.crm.case.section.categ2</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cases by Section and Category2">
<form string="Cases by Team and Category2">
<field name="name"/>
<field name="month"/>
<field name="user_id"/>
@ -49,11 +49,11 @@
<!-- Cases by section and category2 of case Graph View -->
<record model="ir.ui.view" id="view_crm_case_section_categ_graph">
<field name="name">CRM Report - Sections and Type(Graph)</field>
<field name="name">CRM Report - Teams and Type(Graph)</field>
<field name="model">report.crm.case.section.categ2</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Cases by Section and Type" type="bar" orientation="horizontal">
<graph string="Cases by Teams and Type" type="bar" orientation="horizontal">
<field name="category2_id"/>
<field name="amount_revenue" operator="+"/>
<field name="section_id" group="True"/>
@ -64,18 +64,18 @@
<!-- Cases by section and category2 of case Search View -->
<record id="view_crm_case_section_categ_filter" model="ir.ui.view">
<field name="name">CRM Report - Sections and Type(Select)</field>
<field name="name">CRM Report - Teams and Type(Select)</field>
<field name="model">report.crm.case.section.categ2</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Cases by Section and Type">
<search string="Cases by Team and Type">
<group col="10" colspan="4">
<filter string="This Year" icon="terp-hr"
domain="[('name','=',time.localtime()[0])]"
help="Cases by Section and Type for this year" />
help="Cases by Team and Type for this year" />
<filter string="This Month" icon="terp-hr"
domain="[('month','=',time.localtime()[1])]"
help="Cases by Section and Type for this month" />
help="Cases by Team and Type for this month" />
<separator orientation="vertical"/>
<field name="section_id"
select="1" widget="selection" />
@ -99,11 +99,11 @@
<!-- Cases by section and stage Tree View -->
<record model="ir.ui.view" id="view_crm_case_section_stage_tree">
<field name="name">CRM Report - Sections and Stage(Tree)</field>
<field name="name">CRM Report - Teams and Stage(Tree)</field>
<field name="model">report.crm.case.section.stage</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Cases by Section and Stage">
<tree string="Cases by Team and Stage">
<field name="name"/>
<field name="month"/>
<field name="user_id"/>
@ -120,11 +120,11 @@
<!-- Cases by section and stage Form View -->
<record model="ir.ui.view" id="view_crm_case_section_stage_form">
<field name="name">CRM Report - Sections and Stage(Form)</field>
<field name="name">CRM Report - Teams and Stage(Form)</field>
<field name="model">report.crm.case.section.stage</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cases by Section and Stage">
<form string="Cases by Team and Stage">
<field name="name"/>
<field name="month"/>
<field name="user_id"/>
@ -141,11 +141,11 @@
<!-- Cases by section and stage Graph View -->
<record model="ir.ui.view" id="view_crm_case_section_stage_graph">
<field name="name">CRM Report - Sections and Stage(Graph)</field>
<field name="name">CRM Report - Teams and Stage(Graph)</field>
<field name="model">report.crm.case.section.stage</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Cases by Section and Stage" type="bar" orientation="horizontal">
<graph string="Cases by Team and Stage" type="bar" orientation="horizontal">
<field name="stage_id"/>
<field name="amount_revenue" operator="+"/>
<field name="section_id" group="True"/>
@ -156,18 +156,18 @@
<!-- Cases by section and stage Search View -->
<record id="view_crm_case_section_stage_filter" model="ir.ui.view">
<field name="name">CRM Report - Sections and Stage(Select)</field>
<field name="name">CRM Report - Teams and Stage(Select)</field>
<field name="model">report.crm.case.section.stage</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Cases by Section and Stage">
<search string="Cases by Team and Stage">
<group col="8" colspan="4">
<filter string="This Year" icon="terp-hr"
domain="[('name','=',time.localtime()[0])]"
help="Cases by Section and Stage for this year" />
help="Cases by Team and Stage for this year" />
<filter string="This Month" icon="terp-hr"
domain="[('month','=',time.localtime()[1])]"
help="Cases by Section and Stage for this month" />
help="Cases by Team and Stage for this month" />
<separator orientation="vertical"/>
<field name="section_id" select="1" widget="selection"/>
<field name="nbr" select="1"/>
@ -189,11 +189,11 @@
<!-- Cases by section, category and stage Tree View -->
<record model="ir.ui.view" id="view_crm_case_section_categ_stage_tree">
<field name="name">CRM Report - Section, Category and Stage(Tree)</field>
<field name="name">CRM Report - Team, Category and Stage(Tree)</field>
<field name="model">report.crm.case.section.categ.stage</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Cases by Section, Category and Stage">
<tree string="Cases by Team, Category and Stage">
<field name="name"/>
<field name="month"/>
<field name="user_id"/>
@ -210,7 +210,7 @@
<!-- Cases by section, category and stage Form View -->
<record model="ir.ui.view" id="view_crm_case_section_categ_stage_form">
<field name="name">CRM Report - Section, Category and Stage(Form)</field>
<field name="name">CRM Report - Team, Category and Stage(Form)</field>
<field name="model">report.crm.case.section.categ.stage</field>
<field name="type">form</field>
<field name="arch" type="xml">

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