[MERGE] Merge with lp:openobject-addons

bzr revid: sbh@tinyerp.com-20100922045607-iv2x2ze4g50lwi0p
This commit is contained in:
sbh (Open ERP) 2010-09-22 10:26:07 +05:30
commit d82c2c5e0f
89 changed files with 3375 additions and 2612 deletions

View File

@ -157,8 +157,6 @@ class account_account_type(osv.osv):
('asset','Balance Sheet (Assets Accounts)'),
('liability','Balance Sheet (Liability Accounts)')
],'Type Heads', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)"),
'parent_id':fields.many2one('account.account.type', 'Parent Type', required=False),
'child_ids':fields.one2many('account.account.type', 'parent_id', 'Child Types', required=False),
'note': fields.text('Description'),
}
_defaults = {
@ -167,14 +165,6 @@ class account_account_type(osv.osv):
}
_order = "code"
def _check_recursion(self, cr, uid, ids):
#TODO: Need to check for recusrion
return True
_constraints = [
(_check_recursion, 'Error ! You can not create recursive types.', ['parent_id'])
]
account_account_type()
def _code_get(self, cr, uid, context={}):
@ -690,23 +680,23 @@ class account_journal(osv.osv):
"""
Returns a list of tupples containing id, name.
result format : {[(id, name), (id, name), ...]}
@param cr: A database cursor
@param user: ID of the user currently logged in
@param ids: list of ids for which name should be read
@param context: context arguments, like lang, time zone
@return: Returns a list of tupples containing id, name
"""
result = self.browse(cr, user, ids, context)
res = []
for rs in result:
name = rs.name
name = rs.name
if rs.currency:
name = "%s (%s)" % (rs.name, rs.currency.name)
res += [(rs.id, name)]
return res
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
@ -2747,7 +2737,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['sequence_id'] = seq_id
vals_journal['type'] = 'cash'
vals_journal['company_id'] = company_id
if line.currency_id:
vals_journal['view_id'] = view_id_cur
vals_journal['currency'] = line.currency_id.id

View File

@ -215,14 +215,15 @@ class account_bank_statement(osv.osv):
return True
def create_move_from_st_line(self, cr, uid, st_line, company_currency_id, next_number, context=None):
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
account_analytic_line_obj = self.pool.get('account.analytic.line')
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context)
st = st_line.statement_id
context.update({'date': st_line.date})
@ -230,6 +231,7 @@ class account_bank_statement(osv.osv):
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'date': st_line.date,
'name': st_line_number,
}, context=context)
account_bank_statement_line_obj.write(cr, uid, [st_line.id], {
'move_ids': [(4, move_id, False)]
@ -314,12 +316,13 @@ class account_bank_statement(osv.osv):
raise osv.except_osv(_('Error !'),
_('Journal Item "%s" is not valid') % line.name)
move_name = next_number + ' - ' + str(st_line.sequence)
account_move_obj.write(cr, uid, [move_id], {'name': move_name})
# Bank statements will not consider boolean on journal entry_posted
account_move_obj.post(cr, uid, [move_id], context=context)
return move_id
def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None):
return st_number + ' - ' + str(st_line.sequence)
def button_confirm_bank(self, cr, uid, ids, context=None):
done = []
obj_seq = self.pool.get('ir.sequence')
@ -342,13 +345,13 @@ class account_bank_statement(osv.osv):
_('Please verify that an account is defined in the journal.'))
if not st.name == '/':
next_number = st.name
st_number = st.name
else:
if st.journal_id.sequence_id:
c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
next_number = obj_seq.get_id(cr, uid, st.journal_id.sequence_id.id, context=c)
st_number = obj_seq.get_id(cr, uid, st.journal_id.sequence_id.id, context=c)
else:
next_number = obj_seq.get(cr, uid, 'account.bank.statement')
st_number = obj_seq.get(cr, uid, 'account.bank.statement')
for line in st.move_line_ids:
if line.state <> 'valid':
@ -360,12 +363,12 @@ class account_bank_statement(osv.osv):
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (st.journal_id.name,))
if not st_line.amount:
continue
st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context)
self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context)
self.create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context)
self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name)
self.write(cr, uid, [st.id], {'name': st_number}, context=context)
self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st_number)
done.append(st.id)
self.write(cr, uid, [st.id], {'name': next_number}, context=context)
self.write(cr, uid, done, {'state':'confirm'}, context=context)
return True

View File

@ -150,7 +150,7 @@
<field name="arch" type="xml">
<form string="Supplier invoice">
<group col="8" colspan="4">
<field domain="[('type', '=', 'purchase')]" name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
@ -212,7 +212,7 @@
<field name="residual"/>
<group col="6" colspan="4">
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
<button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
@ -431,7 +431,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
<field name="context">{'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">Most of customer invoices are automatically generated in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund your customers' invoices here. A manual invoice can be created here.</field>
</record>
@ -457,7 +457,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','in_invoice')]</field>
<field name="context">{'type':'in_invoice'}</field>
<field name="context">{'type':'in_invoice', 'journal_type': 'purchase'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">Proposal for vendor invoices are usually automatically generate by OpenERP, following a procurement order or a production order for instance. To consult and to check for, or to manually create a customer invoice, use this menu. You can review, confirm or cancel, pay or refund an invoice from the view from of the invoices.</field>
</record>
@ -470,7 +470,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','out_refund')]</field>
<field name="context">{'type':'out_refund'}</field>
<field name="context">{'type':'out_refund', 'journal_type': 'sale_refund'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">A customer refund is a credit note to your customer that cancel invoice or a part of it.</field>
</record>
@ -496,7 +496,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','in_refund')]</field>
<field name="context">{'type':'in_refund'}</field>
<field name="context">{'type':'in_refund', 'journal_type': 'purchase_refund'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">A vendor refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you.</field>
</record>
@ -504,11 +504,11 @@
<act_window context="{'search_default_partner_id':[active_id]}" id="act_res_partner_2_account_invoice_opened" name="Invoices" res_model="account.invoice" src_model="res.partner"/>
<act_window
id="act_account_journal_2_account_invoice_opened"
<act_window
id="act_account_journal_2_account_invoice_opened"
name="Unpaid Invoices"
context="{'search_default_journal_id':active_id, 'search_default_unpaid':1,}"
res_model="account.invoice"
res_model="account.invoice"
src_model="account.journal"/>
<act_window

View File

@ -160,10 +160,10 @@ class account_move_line(osv.osv):
return context
def _default_get(self, cr, uid, fields, context={}):
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
context['journal_id'] = context.get('search_default_journal_id')
period_obj = self.pool.get('account.period')
context = self.convert_to_period(cr, uid, context)
@ -946,6 +946,7 @@ class account_move_line(osv.osv):
if field in ('amount_currency', 'currency_id'):
attrs.append('on_change="onchange_currency(account_id, amount_currency,currency_id, date, journal_id)"')
attrs.append("attrs='{'readonly':[('state','=','valid')]}'")
if field in widths:
attrs.append('width="'+str(widths[field])+'"')

View File

@ -668,6 +668,7 @@
</tree>
</field>
</record>
<record id="view_account_type_form" model="ir.ui.view">
<field name="name">account.account.type.form</field>
<field name="model">account.account.type</field>
@ -677,7 +678,6 @@
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="parent_id"/>
</group>
<group col="2" colspan="2">
<separator string="Reporting Configuration" colspan="4"/>
@ -942,8 +942,8 @@
<field name="credit" sum="Total credit"/>
<field name="account_tax_id" groups="base.group_extended"/>
<field name="analytic_account_id" groups="base.group_extended" domain="[('parent_id','!=',False)]"/>
<field name="amount_currency" groups="base.group_extended"/>
<field name="currency_id" groups="base.group_extended"/>
<field name="amount_currency" groups="base.group_extended" attrs="{'readonly':[('state','=','valid')]}"/>
<field name="currency_id" groups="base.group_extended" attrs="{'readonly':[('state','=','valid')]}"/>
<field name="reconcile_partial_id" groups="base.group_extended"/>
<field name="reconcile_id"/>
<field name="state"/>
@ -998,7 +998,7 @@
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
</group>
<group col="2" colspan="2">
<group col="2" colspan="2" attrs="{'readonly':[('state','=','valid')]}" >
<separator colspan="2" string="Currency"/>
<field name="currency_id"/>
<field name="amount_currency"/>

View File

@ -22,6 +22,7 @@
import time
from operator import itemgetter
import decimal_precision as dp
from lxml import etree
import netsvc
from osv import fields, osv, orm
@ -341,7 +342,13 @@ class account_invoice(osv.osv):
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0]
else:
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0]
return super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
for field in res['fields']:
type = context.get('journal_type', 'sale')
if field == 'journal_id':
journal_select = self.pool.get('account.journal')._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
res['fields'][field]['selection'] = journal_select
return res
def create(self, cr, uid, vals, context=None):
try:

View File

@ -81,7 +81,6 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
result_pl = self.obj_pl.get_data(data)
self.res_bl = self.obj_pl.final_result()
type_pool = db_pool.get('account.account.type')
account_pool = db_pool.get('account.account')
year_pool = db_pool.get('account.fiscalyear')

View File

@ -55,13 +55,13 @@
<search string="Entries Analysis">
<group colspan="10" col="12">
<filter icon="terp-go-year" string="This F.Year"
name="year"
name="thisyear"
domain="[('period_id','in','current_year')]"
help="Entries with period in current year"/>
help="Journal Entries with period in current year"/>
<filter icon="terp-go-month" string="This Period"
name="period"
domain="[('period_id','in','current_period')]"
help="Entries with period in current period"/>
help="Journal Entries with period in current period"/>
<separator orientation="vertical"/>
<filter string="Unposted" icon="terp-document-new" domain="[('move_state','=','draft')]" help = "entries"/>
<filter string="Posted" icon="terp-camera_test" domain="[('move_state','=','posted')]" help = "Posted entries"/>
@ -70,7 +70,7 @@
<filter string="Reconciled" icon="terp-dolar" domain="[('reconcile_id','!=',False)]" help = "Reconciled entries"/>
<separator orientation="vertical"/>
<field name="account_id"/>
<field name="journal_id"/>
<field name="journal_id" widget="selection"/>
<field name="period_id"/>
</group>
<newline/>
@ -83,7 +83,7 @@
<filter string="Journal" name="group_journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<filter string="Account" name="group_account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
<separator orientation="vertical"/>
<filter string="Acc.Type" icon="terp-folder-blue" context="{'group_by':'user_type'}"/>
<filter string="Acc.Type" icon="terp-folder-blue" context="{'group_by':'user_type'}" name="usertype"/>
<filter string="Int.Type" icon="terp-folder-yellow" context="{'group_by':'type'}"/>
<separator orientation="vertical" groups="base.group_multi_company"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
@ -94,13 +94,11 @@
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="journal_id" widget="selection"/>
<field name="period_id"/>
<field name="fiscalyear_id"/>
<separator orientation="vertical"/>
<field name="product_id"/>
<field name="partner_id"/>
<separator orientation="vertical"/>
<separator orientation="vertical" groups="base.group_multi_company"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<field name="date_created"/>
@ -115,7 +113,7 @@
<field name="res_model">account.entries.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_profit': 1,'search_default_group_account':1,'search_default_group_journal':1,'search_default_group_month': 1, 'group_by_no_leaf':1,'group_by':[], 'search_default_year':1, 'search_default_period':1}</field>
<field name="context">{'group_by':[],'search_default_usertype':1, 'search_default_thisyear':1, 'group_by_no_leaf':1,}</field>
<field name="help">A tool search lets you know statistics on your different financial accounts that match your needs.</field>
</record>
<menuitem action="action_account_entries_report_all" id="menu_action_account_entries_report_all" parent="account.menu_finance_statistic_report_statement" sequence="2"/>

View File

@ -25,6 +25,7 @@
<field name="address_contact_id" invisible="1"/>
<field name="address_invoice_id" invisible="1"/>
<field name="partner_bank_id" invisible="1"/>
<field name="date_due" invisible="1"/>
<field name="account_id" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="product_qty" sum="Qty"/>
@ -57,19 +58,6 @@
<field name="arch" type="xml">
<search string="Invoices Analysis">
<group col="10" colspan="12">
<filter icon="terp-go-year" string=" 365 Days "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Validated invoices of last 365 days"/>
<filter icon="terp-go-month" string=" 30 Days "
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Validated invoices of last 30 days"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Validated invoices during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
icon="terp-document-new"
domain="[('state','=','draft')]"
@ -78,19 +66,25 @@
icon="terp-gtk-media-pause"
domain="['|', ('state','=','proforma'),('state','=','proforma2')]"
help = "Pro-forma Invoices"/>
<filter string="Invoiced"
name="current"
icon="terp-check"
domain="[('state','not in', ('draft','cancel'))]"
help = "Open and Paid Invoices"/>
<separator orientation="vertical"/>
<filter icon="terp-sale" string="Customer"
name="customer"
domain="['|', ('type','=','out_invoice'),('type','=','out_refund')]"
help="Customer Invoices And Refunds"/>
<filter icon="terp-purchase"
string="Supplier"
string="Vendor"
separator="1"
domain="['|', ('type','=','in_invoice'),('type','=','in_refund')]"
help="Supplier Invoices And Refunds"/>
help="Vendor Invoices And Refunds"/>
<separator orientation="vertical"/>
<filter icon="terp-dolar" string="Invoice"
domain="['|', ('type','=','out_invoice'),('type','=','in_invoice')]"
help="Customer And Supplier Invoices"/>
help="Customer And Vendor Invoices"/>
<filter icon="terp-dolar_ok!"
string="Refund"
separator="1"
@ -99,6 +93,7 @@
<separator orientation="vertical"/>
<field name="partner_id"/>
<field name="user_id" />
<field name="date" string="Date Invoiced"/>
<field name="categ_id" />
</group>
<newline/>
@ -113,30 +108,26 @@
<filter string="Type" icon="terp-stock_symbol-selection" context="{'group_by':'type'}"/>
<separator orientation="vertical"/>
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<filter string="Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
<separator orientation="vertical"/>
<filter string="Due Date" icon="terp-go-today" context="{'group_by':'date_due'}"/>
<filter string="Period" icon="terp-go-month" context="{'group_by':'period_id'}"/>
<separator orientation="vertical"/>
<separator orientation="vertical" groups="base.group_multi_company"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Day" name="day" icon="terp-go-today" context="{'group_by':'day'}"/>
<filter string="Month" name="month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" name="year" icon="terp-go-year" context="{'group_by':'year'}"/>
<filter string="Day" name="day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by Invoice Date"/>
<filter string="Month" name="month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of Invoice Date"/>
<filter string="Year" name="year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of Invoice Date"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="product_id"/>
<separator orientation="vertical"/>
<field name="journal_id" widget="selection"/>
<field name="account_id"/>
<separator orientation="vertical"/>
<field name="type"/>
<field name="journal_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="state"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<newline/>
<field name="date" string="Date Invoiced"/>
<field name="date_due"/>
<separator orientation="vertical" groups="base.group_multi_company"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
</search>
</field>
@ -147,7 +138,7 @@
<field name="res_model">account.invoice.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_month':1,'search_default_partner':1,'group_by_no_leaf':1,'group_by':[],'search_default_user_id':1}</field>
<field name="context">{'search_default_current':1,'search_default_customer':1, 'search_default_date': time.strftime('%Y-01-01'), 'group_by':[], 'group_by_no_leaf':1,}</field>
<field name="search_view_id" ref="view_account_invoice_report_search"/>
<field name="help">A tool search lets you know statistics on invoices that match your needs.</field>

View File

@ -74,7 +74,6 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
type_pool = db_pool.get('account.account.type')
account_pool = db_pool.get('account.account')
year_pool = db_pool.get('account.fiscalyear')

View File

@ -30,6 +30,7 @@ class report_voucher_move(report_sxw.rml_parse):
self.localcontext.update({
'time': time,
'convert':self.convert,
'get_title': self.get_title,
'debit':self.debit,
'credit':self.credit,
#'get_ref' : self._get_ref
@ -41,6 +42,13 @@ class report_voucher_move(report_sxw.rml_parse):
cur = user_id.company_id.currency_id.name
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
return amt_en
def get_title(self, voucher):
title = ''
if voucher.journal_id:
type = voucher.journal_id.type
title = type[0].swapcase() + type[1:] + " Voucher"
return title
def debit(self, move_ids):
debit = 0.0

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Voucher" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="42.0" width="525" height="772"/>
</pageTemplate>
@ -10,6 +10,10 @@
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
@ -94,15 +98,12 @@
</initialize>
<paraStyle name="P1" fontName="Helvetica"/>
<paraStyle name="P2" fontName="Helvetica" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica-Bold" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica-Bold" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P7" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
@ -116,19 +117,19 @@
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
@ -161,45 +162,55 @@
<images/>
</stylesheet>
<story>
<para style="P11">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P8">[[ repeatIn(objects,'voucher') ]]</para>
<blockTable colWidths="524.0" style="Table6">
<tr>
<td>
<para style="terp_header_Centre">[[ get_title(voucher) ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="63.0,200.0,52.0,210.0" style="Table4">
<tr>
<td>
<para style="terp_tblheader_Details">Journal:</para>
<para style="terp_tblheader_General">Journal:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.journal_id.name ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Number:</para>
<para style="terp_tblheader_General">Number:</para>
</td>
<td>
<para style="P3">[[ voucher.name ]]</para>
<para style="terp_default_9">[[ voucher.name ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="63.0,72.0,44.0,84.0,52.0,210.0" style="Table5">
<tr>
<td>
<para style="terp_default_Bold_9">State:</para>
<para style="terp_tblheader_General">State:</para>
</td>
<td>
<para style="P7">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P7">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P7">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P7">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_9">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_9">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_9">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="terp_default_9">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Ref. :</para>
<para style="terp_tblheader_General">Ref. :</para>
</td>
<td>
<para style="P7">[[ voucher.ref]]</para>
<para style="terp_default_9">[[ voucher.ref]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Date:</para>
<para style="terp_tblheader_General">Date:</para>
</td>
<td>
<para style="P3">[[ formatLang(voucher.date , date=True) or '' ]]</para>
<para style="terp_default_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
</td>
</tr>
</blockTable>
@ -280,7 +291,7 @@
<blockTable colWidths="313.0,106.0,105.0" style="last_info">
<tr>
<td>
<para style="P5">Through : </para>
<para style="P4">Through : </para>
</td>
<td>
<para style="P2">
@ -310,7 +321,7 @@
</tr>
<tr>
<td>
<para style="P5">On Account of : </para>
<para style="P4">On Account of : </para>
</td>
<td>
<para style="P2">
@ -325,7 +336,7 @@
</tr>
<tr>
<td>
<para style="P9">[[ voucher.line_id and voucher.line_id[0].name or removeParentNode('para') ]]</para>
<para style="P7">[[ voucher.line_id and voucher.line_id[0].name or removeParentNode('para') ]]</para>
</td>
<td>
<para style="P2">
@ -340,22 +351,7 @@
</tr>
<tr>
<td>
<para style="P5">Amount (in words) : </para>
</td>
<td>
<para style="P5">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P5">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P9">[[ convert(voucher.amount) ]]</para>
<para style="P4">Amount (in words) : </para>
</td>
<td>
<para style="P4">
@ -368,6 +364,21 @@
</para>
</td>
</tr>
<tr>
<td>
<para style="P7">[[ convert(voucher.amount) ]]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
@ -375,7 +386,7 @@
<blockTable colWidths="313.0,106.0,105.0" style="Table1">
<tr>
<td>
<para style="P6">
<para style="P5">
<font color="white"> </font>
</para>
</td>
@ -399,12 +410,6 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
@ -424,15 +429,15 @@
</tr>
<tr>
<td>
<para style="P8">Receiver's Signature</para>
<para style="P6">Receiver's Signature</para>
</td>
<td>
<para style="P8">
<para style="P6">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P8">
<para style="P6">
<font color="white"> </font>
</para>
</td>

View File

@ -67,8 +67,9 @@ class account_partner_reconcile_process(osv.osv_memory):
return res
def next_partner(self, cr, uid, ids, context=None):
partner_id = self.pool.get('account.move.line').read(cr, uid, context['active_id'], ['partner_id'])['partner_id'][0]
self.pool.get('res.partner').write(cr, uid, partner_id, {'last_reconciliation_date': time.strftime('%Y-%m-%d')}, context)
partner_id = self.pool.get('account.move.line').read(cr, uid, context['active_id'], ['partner_id'])['partner_id']
if partner_id:
self.pool.get('res.partner').write(cr, uid, partner_id[0], {'last_reconciliation_date': time.strftime('%Y-%m-%d')}, context)
#TODO: we have to find a way to update the context of the current tab (we could open a new tab with the context but it's not really handy)
#TODO: remove that comments when the client side dev is done
return {}

View File

@ -12,7 +12,7 @@
<field name="display_account"/>
<field name="target_move"/>
<field name="display_type"/>
<field name="reserve_account_id"/>
<field name="reserve_account_id" required="0" invisible="1"/>
<newline/>
</field>
</field>

View File

@ -20,4 +20,4 @@
##############################################################################
import report_voucher
import report_voucher_amount
import report_voucher_print

View File

@ -29,6 +29,7 @@ class report_voucher(report_sxw.rml_parse):
self.localcontext.update({
'time': time,
'convert':self.convert,
'get_title': self.get_title,
'debit':self.debit,
'credit':self.credit,
'get_ref' : self._get_ref
@ -38,6 +39,12 @@ class report_voucher(report_sxw.rml_parse):
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
return amt_en
def get_title(self, type):
title = ''
if type:
title = type[0].swapcase() + type[1:] + " Voucher"
return title
def debit(self, move_ids):
debit = 0.0
for move in move_ids:

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Voucher" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="42.0" width="525" height="772"/>
</pageTemplate>
@ -10,6 +10,10 @@
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
@ -89,14 +93,11 @@
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
@ -110,14 +111,14 @@
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
@ -154,23 +155,27 @@
<images/>
</stylesheet>
<story>
<para style="P8">[[ repeatIn(objects,'voucher') ]]</para>ref
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<para style="P5">[[ repeatIn(objects,'voucher') ]]</para>
<blockTable colWidths="524.0" style="Table4">
<tr>
<td>
<para style="terp_header_Centre">[[ get_title(voucher.type) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="63.0,200.0,52.0,210.0" style="Table7">
<tr>
<td>
<para style="terp_tblheader_Details">Journal:</para>
<para style="terp_tblheader_General">Journal:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.journal_id.name ]]</para>
<para style="terp_default_9">[[ voucher.type ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Number:</para>
<para style="terp_tblheader_General">Number:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.number ]]</para>
@ -180,22 +185,22 @@
<blockTable colWidths="63.0,72.0,44.0,84.0,52.0,210.0" style="Table8">
<tr>
<td>
<para style="terp_default_Bold_9">State:</para>
<para style="terp_tblheader_General">State:</para>
</td>
<td>
<para style="P3">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P3">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P3">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P3">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
<para style="P2">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P2">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P2">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P2">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Ref. :</para>
<para style="terp_tblheader_General">Ref. :</para>
</td>
<td>
<para style="P1">[[ voucher.reference or '' ]]</para>
<para style="terp_default_9">[[ voucher.reference or '' ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Date:</para>
<para style="terp_tblheader_General">Date:</para>
</td>
<td>
<para style="terp_default_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
@ -226,7 +231,7 @@
<blockTable colWidths="276.0,126.0,123.0" style="Table2">
<tr>
<td>
<para style="P4">[[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] </para>
<para style="P3">[[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(move_ids.debit) ]]</para>
@ -237,7 +242,7 @@
</tr>
<tr>
<td>
<para style="P5">[[ move_ids.account_id.name ]] </para>
<para style="P4">[[ move_ids.account_id.name ]] </para>
</td>
<td>
<para style="terp_default_Right_9">
@ -252,7 +257,7 @@
</tr>
<tr>
<td>
<para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ voucher.reference or '' ]]</para>
<para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]</para>
</td>
<td>
<para style="terp_default_9_50">
@ -371,7 +376,7 @@
<blockTable colWidths="276.0,127.0,122.0" style="Table1">
<tr>
<td>
<para style="P2">
<para style="P1">
<font color="white"> </font>
</para>
</td>

View File

@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher_print, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'get_title': self.get_title,
'get_lines':self.get_lines,
'get_on_account':self.get_on_account,
'convert':self.convert
})
def convert(self, amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
return amt_en
def get_lines(self,voucher):
result = []
if voucher.type in ('payment','receipt'):
type = voucher.line_ids and voucher.line_ids[0].type or False
for move in voucher.move_ids:
res = {}
amount = move.credit
if type == 'dr':
amount = move.debit
if amount > 0.0:
res['pname'] = move.partner_id.name
res['ref'] = 'Agst Ref'+" "+str(move.name)
res['aname'] = move.account_id.name
res['amount'] = amount
result.append(res)
else:
type = voucher.line_ids and voucher.line_ids[0].type or False
for move in voucher.move_ids:
res = {}
amount = move.credit
if type == 'dr':
amount = move.debit
if amount > 0.0:
res['pname'] = move.partner_id.name
res['ref'] = move.name
res['aname'] = move.account_id.name
res['amount'] = amount
result.append(res)
return result
def get_title(self, type):
title = ''
if type:
title = type[0].swapcase() + type[1:] + " Voucher"
return title
def get_on_account(self, voucher):
name = ""
if voucher.type == 'receipt':
name = "Received cash from "+str(voucher.partner_id.name)
elif voucher.type == 'payment':
name = "Payment from "+str(voucher.partner_id.name)
elif voucher.type == 'sale':
name = "Sale to "+str(voucher.partner_id.name)
elif voucher.type == 'purchase':
name = "Purchase from "+str(voucher.partner_id.name)
return name
report_sxw.report_sxw(
'report.voucher.print',
'account.voucher',
'addons/account_voucher/report/report_voucher_print.rml',
parser=report_voucher_print,header="external"
)

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Voucher Amount" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="42.0" width="525" height="772"/>
</pageTemplate>
@ -10,51 +10,17 @@
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEAFTER" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEAFTER" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Heading1">
<blockAlignment value="LEFT"/>
@ -65,7 +31,7 @@
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
@ -92,9 +58,8 @@
<paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
@ -108,16 +73,16 @@
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
@ -149,71 +114,87 @@
<paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_9_30" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9_50" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9_50_italic" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica-Oblique" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9_50_italic" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9_30cm" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="P6">[[ repeatIn(objects,'voucher') ]]</para>
<blockTable colWidths="52.0,123.0,50.0,92.0,63.0,144.0" style="Table2">
<para style="P5">[[ repeatIn(objects,'voucher') ]]</para>
<blockTable colWidths="524.0" style="Table6">
<tr>
<td>
<para style="terp_default_Bold_9">Type:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.journal_id.nme ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Number:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.number ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Date:</para>
</td>
<td>
<para style="terp_default_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="52.0,123.0,50.0,92.0,63.0,144.0" style="Table4">
<tr>
<td>
<para style="terp_default_Bold_9">State:</para>
</td>
<td>
<para style="P5">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P5">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P5">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P5">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Ref:</para>
</td>
<td>
<para style="P2">[[ voucher.reference ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Account:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.account_id.name ]]</para>
<para style="terp_header_Centre">[[ get_title(voucher.type) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="52.0,123.0,50.0,198.0,42.0,59.0" style="Table2">
<tr>
<td>
<para style="terp_tblheader_General">Number:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.number ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_General">Date:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="52.0,123.0,50.0,198.0,42.0,59.0" style="Table4">
<tr>
<td>
<para style="terp_tblheader_Details">State:</para>
</td>
<td>
<para style="P4">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P4">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P4">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P4">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_General">Currency:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ voucher.currency_id.code ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="381.0,144.0" style="Heading1">
<tr>
<td>
<para style="terp_header">Particulars</para>
<para style="terp_tblheader_Details">Particulars</para>
</td>
<td>
<para style="terp_header_Right">Amount</para>
<para style="terp_tblheader_Details_Right">Amount</para>
</td>
</tr>
</blockTable>
@ -221,29 +202,29 @@
<font color="white"> </font>
</para>
<section>
<para style="terp_default_8">[[ repeatIn(voucher.payment_ids,'payment_ids') ]] </para>
<blockTable colWidths="380.0,144.0" style="Table1">
<para style="terp_default_8">[[ repeatIn(get_lines(voucher),'p') ]] </para>
<blockTable colWidths="380.0,144.0" style="Table7">
<tr>
<td>
<para style="terp_default_Bold_9">[[ payment_ids.partner_id and payment_ids.partner_id.name or '' ]] </para>
<para style="terp_default_Bold_9">Account :</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ payment_ids.amount ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_30">[[ payment_ids.account_id.name ]] </para>
</td>
<td>
<para style="P4">
<para style="terp_default_Right_9_Bold">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_50_italic">[[ payment_ids.ref ]] [[ payment_ids.amount ]] </para>
<para style="terp_default_9_30cm">[[ p['pname'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ p['amount'] ]] [[ voucher.currency_id.symbol ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9_30cm">[[ p['ref'] ]] </para>
</td>
<td>
<para style="terp_default_9_50">
@ -253,7 +234,7 @@
</tr>
<tr>
<td>
<para style="terp_default_9_50_italic">[[ payment_ids.type ]]</para>
<para style="terp_default_9_30cm">Account : [[ p['aname'] ]] </para>
</td>
<td>
<para style="terp_default_9_50">
@ -282,7 +263,7 @@
</tr>
<tr>
<td>
<para style="terp_default_9_50_italic">[[ voucher.narration or '' ]] </para>
<para style="terp_default_9_30">[[ voucher.journal_id.name or '' ]] </para>
</td>
<td>
<para style="terp_default_9_50_italic">
@ -302,7 +283,7 @@
</tr>
<tr>
<td>
<para style="terp_default_9">[[ voucher.name ]]</para>
<para style="terp_default_9_30">[[ get_on_account(voucher) ]]</para>
</td>
<td>
<para style="terp_default_9_30">
@ -322,7 +303,7 @@
</tr>
<tr>
<td>
<para style="terp_default_9">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
<para style="terp_default_9_30">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
</td>
<td>
<para style="P3">
@ -337,12 +318,12 @@
<blockTable colWidths="380.0,144.0" style="Table3">
<tr>
<td>
<para style="P3">
<para style="terp_default_Right_9_Bold">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_header_Right">[[ voucher.amount ]]</para>
<para style="terp_default_Right_9_Bold">[[ voucher.amount ]] [[ voucher.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>
@ -358,9 +339,6 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">

View File

@ -15,15 +15,6 @@
name: Voucher Axelor
period_id: account.period_6
-
In order to test the PDF reports defined on a account_voucher, we will print account voucher amount Report
-
!python {model: account.voucher}: |
import netsvc, tools, os
(data, format) = netsvc.LocalService('report.voucher.cash_amount').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'account_voucher-amount.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a account_voucher, we will print account voucher Report
-

View File

@ -143,7 +143,7 @@ class account_voucher(osv.osv):
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
'move_id':fields.many2one('account.move', 'Account Entry'),
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Journal Items', readonly=True),
'move_ids': fields.related('move_id','line_id', type='one2many', relation='account.move.line', string='Journal Items', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', change_default=1, readonly=True, states={'draft':[('readonly',False)]}),
'audit': fields.related('move_id','to_check', type='boolean', relation='account.move', string='Audit Complete ?'),
'pay_now':fields.selection([
@ -375,7 +375,6 @@ class account_voucher(osv.osv):
else:
total_credit = price or 0.0
account_type = 'receivable'
ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context)
ids.reverse()
moves = move_line_pool.browse(cr, uid, ids)
@ -467,8 +466,8 @@ class account_voucher(osv.osv):
vals['value'].update({'currency_id':currency_id})
return vals
def proforma_voucher(self, cr, uid, ids):
self.action_move_line_create(cr, uid, ids)
def proforma_voucher(self, cr, uid, ids, context=None):
self.action_move_line_create(cr, uid, ids, context=context)
return True
def action_cancel_draft(self, cr, uid, ids, context={}):
@ -529,7 +528,7 @@ class account_voucher(osv.osv):
res['account_id'] = account_id
return {'value':res}
def action_move_line_create(self, cr, uid, ids, *args):
def action_move_line_create(self, cr, uid, ids, context=None):
def _get_payment_term_lines(term_id, amount):
term_pool = self.pool.get('account.payment.term')
@ -537,18 +536,20 @@ class account_voucher(osv.osv):
terms = term_pool.compute(cr, uid, term_id, amount)
return terms
return False
if not context:
context = {}
move_pool = self.pool.get('account.move')
move_line_pool = self.pool.get('account.move.line')
analytic_pool = self.pool.get('account.analytic.line')
currency_pool = self.pool.get('res.currency')
invoice_pool = self.pool.get('account.invoice')
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
if inv.journal_id.sequence_id:
if 'force_name' in context and context['force_name']:
name = context['force_name']
elif inv.journal_id.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, inv.journal_id.sequence_id.id)
else:
raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
@ -815,9 +816,14 @@ account_voucher_line()
class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
def create_move_from_st_line(self, cr, uid, st_line, company_currency_id, next_number, context=None):
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None):
st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line_id, context=context)
if st_line.voucher_id:
return self.pool.get('account.voucher').proforma_voucher(cr, uid, [st_line.voucher_id.id])
res = self.pool.get('account.voucher').proforma_voucher(cr, uid, [st_line.voucher_id.id], context={'force_name': next_number})
#force refresh of the cache
#st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line.id, context=context)
return self.pool.get('account.move.line').write(cr, uid, [x.id for x in st_line.voucher_id.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context)
account_bank_statement()

View File

@ -105,8 +105,8 @@
</group>
<notebook colspan="4">
<page string="Payment Information">
<field name="line_dr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
<tree string="Vendor Invoices and Outstanding transactions" editable="bottom">
<field name="line_dr_ids" attrs="{'invisible': [('type', '=', 'receipt')]}" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
<tree string="Open Vendor Journal Entries" editable="bottom">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
on_change="onchange_move_line_id(move_line_id)"
domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
@ -118,12 +118,9 @@
<field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
<field name="amount" sum="Payment"/>
</tree>
<form string="Payment Information">
<label string="Form view not available for Payment Lines"/>
</form>
</field>
<field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}">
<tree string="Credits" editable="bottom">
<field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('type', '=', 'payment')]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}">
<tree string="Open Customer Journal Entries" editable="bottom">
<field name="move_line_id"/>
<field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
<field name="date_original"/>

View File

@ -6,8 +6,19 @@
model="account.voucher"
name="voucher.cash_receipt.drcr"
rml="account_voucher/report/report_voucher.rml"
groups="base.group_extended"
auto="False"
header = "False"
menu="True"/>
<report id="report_account_voucher_print"
string="Voucher Print"
model="account.voucher"
name="voucher.print"
rml="account_voucher/report/report_voucher_print.rml"
auto="False"
header = "False"
menu="True"/>
</data>
</openerp>

View File

@ -85,7 +85,6 @@ Create dashboard for CRM that includes:
'wizard/crm_send_email_view.xml',
'wizard/crm_add_note_view.xml',
'wizard/crm_forward_to_partner_view.xml',
'wizard/crm_merge_opportunities_view.xml',
'crm_view.xml',

View File

@ -1,14 +1,14 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<data noupdate="1">
<!--
Administrator shortcut
Demo user startup menu
-->
<record model="res.users" id="base.user_root">
<field name="action_id" ref="open_board_crm"/>
</record>
<!--
Administrator shortcut
Demo user startup menu
-->
<record model="res.users" id="base.user_root">
<field name="action_id" ref="open_board_crm"/>
</record>
</data>
</data>
</openerp>

View File

@ -1,23 +1,23 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="board.note.type" id="note_crm_type">
<field name="name">CRM Configuration</field>
</record>
<data>
<record model="board.note.type" id="note_crm_type">
<field name="name">CRM Configuration</field>
</record>
<record model="ir.ui.view" id="view_crm_opportunity_user_graph1">
<field name="name">crm.opportunity.user.graph1</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="bar">
<field name="stage_id"/>
<field name="nbr" operator="+"/>
<field name="user_id" group="True"/>
</graph>
</field>
</record>
<record model="ir.ui.view" id="view_crm_opportunity_user_graph1">
<field name="name">crm.opportunity.user.graph1</field>
<field name="model">crm.lead.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunities by User and Team" type="bar">
<field name="stage_id"/>
<field name="nbr" operator="+"/>
<field name="user_id" group="True"/>
</graph>
</field>
</record>
<record id="view_report_crm_oppor_graph" model="ir.ui.view">
<field name="name">crm.lead.report.graph</field>
<field name="model">crm.lead.report</field>
@ -31,7 +31,7 @@
</record>
<record model="ir.ui.view" id="crm_case_my_open_oppor">
<field name="name">My Open Opportunities</field>
<field name="name">Opportunities</field>
<field name="model">crm.lead</field>
<field name="type">tree</field>
<field name="arch" type="xml">
@ -64,13 +64,13 @@
</field>
</record>
<record model="ir.actions.act_window" id="act_my_oppor">
<field name="name">My Open Opportunities</field>
<field name="res_model">crm.lead</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<record model="ir.actions.act_window" id="act_my_oppor">
<field name="name">My Open Opportunities</field>
<field name="res_model">crm.lead</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('user_id','=',uid),('state','=','open'), ('type', '=', 'opportunity')]</field>
</record>
</record>
<record model="ir.actions.act_window.view" id="act_my_oppor_tree_view">
<field name="sequence" eval="1"/>
@ -86,52 +86,52 @@
<field name="act_window_id" ref="act_my_oppor"/>
</record>
<record model="ir.actions.act_window" id="act_my_meetings">
<field name="res_model">crm.meeting</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm.crm_case_tree_view_meet"/>
<record model="ir.actions.act_window" id="act_my_meetings">
<field name="res_model">crm.meeting</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm.crm_case_tree_view_meet"/>
<field name="domain">[('user_id','=',uid),('state','not in',('cancel','done'))]</field>
</record>
</record>
<record model="ir.actions.act_window" id="act_my_oppor_stage">
<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_report_crm_oppor_graph"/>
<record model="ir.actions.act_window" id="act_my_oppor_stage">
<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_report_crm_oppor_graph"/>
<field name="domain">['&amp;', '&amp;', ('user_id','=',uid), ('type', '=', 'opportunity'), '!' , '&amp;', ('state', '=', 'done'), ('date_closed','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]</field>
</record>
</record>
<record model="ir.actions.act_window" id="act_sales_pipeline">
<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">['&amp;', ('user_id', '=', uid),'&amp;', ('state', '=', 'done') , '&amp;', ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%Y-%m-%d')), ('type', '=', 'opportunity')]</field>
</record>
<record model="ir.actions.act_window" id="act_sales_pipeline">
<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">['&amp;', ('user_id', '=', uid),'&amp;', ('state', '=', 'done') , '&amp;', ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%Y-%m-%d')), ('type', '=', 'opportunity')]</field>
</record>
<record model="ir.ui.view" id="board_crm_form">
<field name="name">CRM - Dashboard Form</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Connecting Dashboard">
<hpaned>
<child1>
<action
string="My Open Opportunities"
name="%(act_my_oppor)d"
colspan="4"
height="150"
width="510"/>
<action
string="My Meetings"
name="%(act_my_meetings)d"
height="150"
colspan="4"/>
</child1>
<child2>
<action
<record model="ir.ui.view" id="board_crm_form">
<field name="name">CRM - Dashboard Form</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Connecting Dashboard">
<hpaned>
<child1>
<action
string="My Open Opportunities"
name="%(act_my_oppor)d"
colspan="4"
height="150"
width="510"/>
<action
string="My Meetings"
name="%(act_my_meetings)d"
height="150"
colspan="4"/>
</child1>
<child2>
<action
string="My Planned Revenues by Stage"
name="%(act_my_oppor_stage)d"
colspan="4"/>
@ -152,7 +152,7 @@
<field name="usage">menu</field>
<field name="view_id" ref="board_crm_form"/>
</record>
<menuitem id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem
name="Connecting Dashboard" parent="board.menu_dasboard"
action="open_board_crm"

View File

@ -613,31 +613,13 @@ crm_case_categ()
class crm_case_resource_type(osv.osv):
""" Resource Type of case """
_name = "crm.case.resource.type"
_description = "Resource Type of case"
_description = "Campaign"
_rec_name = "name"
_columns = {
'name': fields.char('Resource Type', size=64, required=True, translate=True),
'name': fields.char('Campaign Name', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'object_id': fields.many2one('ir.model', 'Object Name'),
}
def _find_object_id(self, cr, uid, context=None):
"""Finds id for case object
@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
"""
object_id = context and context.get('object_id', False) or False
ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', object_id)])
return ids and ids[0]
_defaults = {
'object_id' : _find_object_id
}
crm_case_resource_type()
@ -711,17 +693,16 @@ res_partner()
class crm_case_section_custom(osv.osv):
_name = "crm.case.section.custom"
_description = 'Custom CRM Case Section'
_description = 'Custom CRM Case Teams'
_columns = {
'name': fields.char('Case Section',size=64, required=True, translate=True),
'code': fields.char('Section Code',size=8),
'name': fields.char('Case Team',size=64, required=True, translate=True),
'code': fields.char('Team Code',size=8),
'active': fields.boolean('Active'),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
'sequence': fields.integer('Sequence'),
'user_id': fields.many2one('res.users', 'Responsible User'),
'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by OpenERP about cases in this section"),
'parent_id': fields.many2one('crm.case.section.custom', 'Parent Section'),
'parent_id': fields.many2one('crm.case.section.custom', 'Parent Team'),
'note': fields.text('Notes'),
}
@ -731,7 +712,7 @@ class crm_case_section_custom(osv.osv):
}
_sql_constraints = [
('code_uniq', 'unique (code)', 'The code of the section must be unique !')
('code_uniq', 'unique (code)', 'The code of the team must be unique !')
]
def _check_recursion(self, cr, uid, ids):
@ -763,7 +744,7 @@ class crm_case_custom(osv.osv, crm_case):
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
'active': fields.boolean('Active'),
'description': fields.text('Description'),
'section_id': fields.many2one('crm.case.section.custom', 'Section', required=True, select=True),
'section_id': fields.many2one('crm.case.section.custom', 'Team', required=True, select=True),
'probability': fields.float('Probability (%)'),
'email_from': fields.char('Partner Email', size=128),
'email_cc': fields.char('CC', size=252),

View File

@ -114,17 +114,17 @@ class crm_lead(crm_case, osv.osv):
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which this case belongs to. Defines responsible user and e-mail address for the mail gateway.'),
'create_date': fields.datetime('Creation Date' , readonly=True),
'email_cc': fields.text('Watchers Emails', size=252 , help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'email_cc': fields.text('Global CC', size=252 , help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'description': fields.text('Notes'),
'write_date': fields.datetime('Update Date' , readonly=True),
# Lead fields
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\
('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')]"),
domain="['|',('section_id','=',section_id),('section_id','=',False)]"),
'type_id': fields.many2one('crm.case.resource.type', 'Campaign', \
domain="['|',('section_id','=',section_id),('section_id','=',False)]"),
'channel_id': fields.many2one('res.partner.canal', 'Channel'),
'partner_name': fields.char("Partner Name", size=64),
'optin': fields.boolean('Opt-In'),
'optout': fields.boolean('Opt-Out'),
@ -149,8 +149,6 @@ class crm_lead(crm_case, osv.osv):
\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\'.'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'partner_assigned_id': fields.many2one('res.partner', 'Assigned Partner', help="Partner this case has been forwarded/assigned to.", select=True),
'date_assign': fields.date('Assignation Date', help="Last date this case was forwarded/assigned to a partner"),
}
_defaults = {

View File

@ -56,49 +56,41 @@
<record model="crm.case.resource.type" id="type_lead1">
<field name="name">Telesales</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_lead2">
<field name="name">Mail</field>
<field name="name">Mail Campaign 1</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_lead3">
<field name="name">Email</field>
<field name="name">Mail Campaign 2</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_lead4">
<field name="name">Print</field>
<field name="name">Twitter Ads</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_lead5">
<field name="name">Web</field>
<field name="name">Google Adwords</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_lead6">
<field name="name">Radio</field>
<field name="name">Google Adwords 2</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_lead7">
<field name="name">Television</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_lead8">
<field name="name">Newsletter</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
</data>

View File

@ -85,7 +85,7 @@
<page string="Lead">
<group colspan="2" col="4">
<separator string="Contact" colspan="4" col="4"/>
<field name="partner_name" string="Partner Name" colspan="4"/>
<field name="partner_name" colspan="4"/>
<newline/>
<field domain="[('domain', '=', 'contact')]" name="title"/>
<field name="function" />
@ -146,7 +146,8 @@
<field name="company_id"
groups="base.group_multi_company"
widget="selection" colspan="2" />
<field name="type_id" string="Campaign" select="1"/>
<field name="type_id" select="1" widget="selection"/>
<field name="channel_id" select="1" widget="selection"/>
<field name="referred"/>
</group>
<group colspan="2" col="2">
@ -169,7 +170,7 @@
</page>
<page string="History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char" size="512"/>
<field colspan="4" name="email_cc" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
@ -218,9 +219,6 @@
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="terp-mail-message-new" type="action" />
<button string="Forward"
name="%(crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action" />
</page>
</notebook>
</form>
@ -246,6 +244,7 @@
<field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="referred" invisible="1"/>
<field name="channel_id" invisible="1"/>
<field name="stage_id" />
<button name="stage_previous" string="Previous Stage"
@ -341,7 +340,12 @@
<group expand="0" string="Group By...">
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Source" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'categ_id'}"/>
<separator orientation="vertical"/>
<filter string="Category" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'categ_id'}"/>
<filter string="Campaign" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'type_id'}" />
<filter string="Channel" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'channel_id'}" />
<separator orientation="vertical"/>
<filter string="Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
<filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>

View File

@ -26,19 +26,17 @@
<form string="Meetings">
<group col="6" colspan="4">
<field name="name" select="1" string="Summary"
required="1" colspan="2" />
required="1" />
<field name="categ_id" widget="selection"
string="Meeting Type"
groups="base.group_extended"
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="allday" on_change="onchange_allday(allday)" />
<newline/>
<field name="date" string="Start Date" required="1"
on_change="onchange_dates(date,duration,False,allday)" />
<field name="duration" widget="float_time"
on_change="onchange_dates(date,duration,False,allday)" />
<field name="date_deadline" string="End Date"
required="1"
<field name="date_deadline" string="End Date" required="1"
on_change="onchange_dates(date,False,date_deadline)" />
<field name="location" />
<field name="alarm_id" string="Reminder"
@ -308,8 +306,8 @@
<separator orientation="vertical"/>
<field name="name" select="1" string="Subject"/>
<field name="categ_id" select="1"
string="Meeting Type" widget="selection"
domain="[('object_id.model', '=', 'crm.meeting')]" />
string="Meeting Type" widget="selection"
domain="[('object_id.model', '=', 'crm.meeting')]" />
<separator orientation="vertical"/>
<field name="partner_id" select="1" />
<field name="section_id" select="1" widget="selection">

View File

@ -152,19 +152,6 @@ class crm_opportunity(osv.osv):
return {'value':{}}
return {'value':{'probability': stage.probability}}
def onchange_assign_id(self, cr, uid, ids, partner_assigned_id, context={}):
"""This function updates the "assignation date" automatically, when manually assign a partner in the geo assign tab
@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 stages IDs
@stage_id: change state id on run time """
if not partner_assigned_id:
return {'value':{'date_assign': False}}
else:
return {'value':{'date_assign': time.strftime('%Y-%m-%d')}}
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c),
'priority': crm.AVAILABLE_PRIORITIES[2][0],

View File

@ -44,14 +44,12 @@
<!-- Case Resource(type_id) -->
<record model="crm.case.resource.type" id="type_oppor1">
<field name="name">Existing Business</field>
<field name="name">Campaign 2</field>
<field name="section_id" ref="section_sales_department"/>
<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="name">Campaign 1</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
</data>

View File

@ -29,7 +29,7 @@
<field name="planned_revenue"/>
<field name="probability"/>
<field name="date_deadline" string="Expected Closing"/>
<field name="date_deadline"/>
<button string="Schedule/Log Call"
name="%(opportunity2phonecall_act)d" icon="terp-call-start" type="action" groups="base.group_extended"/>
<newline/>
@ -116,6 +116,11 @@
<field name="fax"/>
<field name="mobile"/>
</group>
<group colspan="2" col="2">
<separator string="Categorization" colspan="2"/>
<field name="type_id" widget="selection"/>
<field name="channel_id" widget="selection"/>
</group>
<group colspan="2" col="2">
<separator string="Mailings" colspan="2"/>
<field name="optin"/>
@ -174,9 +179,6 @@
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="terp-mail-message-new" type="action" />
<button string="Forward"
name="%(crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action" />
</page>
<page string="Extra Info" groups="base.group_extended">
<group col="2" colspan="2">
@ -197,21 +199,6 @@
<field name="ref"/>
<field name="ref2"/>
</page>
<page string="Assignation" groups="base.group_extended">
<group name="partner_assign_group" col="5" colspan="4">
<separator string="Partner Assignation" colspan="5"/>
<field name="partner_assigned_id" on_change="onchange_assign_id(partner_assigned_id)"/>
<field name="date_assign"/>
<group colspan="1" col="1">
<button string="Forward"
attrs="{'invisible':[('partner_assigned_id','=',False)]}"
name="%(crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action"
context="{'default_name': 'partner', 'default_partner_id': partner_assigned_id}"
/>
</group>
</group>
</page>
</notebook>
</form>
</field>
@ -234,6 +221,8 @@
<field name="title_action" />
<field name="stage_id"/>
<field name="partner_assigned_id" invisible="1"/>
<field name="channel_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<button name="stage_previous" string="Previous Stage"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next Stage"
@ -331,6 +320,10 @@
context="{'group_by':'priority'}" />
<filter string="Category" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'categ_id'}" />
<filter string="Campaign" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'type_id'}" />
<filter string="Channel" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'channel_id'}" />
<separator orientation="vertical" />
<filter string="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />

View File

@ -36,7 +36,7 @@ class crm_phonecall(crm_case, osv.osv):
_columns = {
# From crm.case
'id': fields.integer('ID'),
'name': fields.char('Name', size=64),
'name': fields.char('Call Summary', size=64),
'active': fields.boolean('Active', required=False),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),

View File

@ -19,16 +19,14 @@
<!-- ResourceType Form View -->
<record id="crm_phonecall_resource_act" model="ir.actions.act_window">
<field name="name">Phonecall Resource Type</field>
<field name="name">Phonecall Campaigns</field>
<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.phonecall')]</field>
<field name="context">{'object_id':'crm.phonecall'}</field>
</record>
</record>
<menuitem action="crm_phonecall_resource_act"
id="menu_crm_phonecall_resource_act" name="Resource Type"
id="menu_crm_phonecall_resource_act" name="Campaigns"
parent="menu_crm_config_phonecall" />
<!-- PhoneCalls Tree View -->
@ -39,9 +37,9 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="gray:state in ('cancel','done');blue:state in ('pending',)" string="Phone Calls">
<field name="date" string="Date"/>
<field name="name" string="Call Summary"/>
<field name="partner_id" string="Partner"/>
<field name="date"/>
<field name="name"/>
<field name="partner_id"/>
<field name="partner_contact"/>
<field name="partner_phone"/>
<field name="user_id"/>
@ -71,12 +69,12 @@
<field name="arch" type="xml">
<form string="Phone Call">
<group colspan="6" col="7">
<field name="name" string="Summary" required="1"/>
<field name="name" required="1"/>
<field name="partner_phone" required="1"/>
<field name="duration" widget="float_time" required="1"/>
<button string="Schedule a Meeting" name="action_make_meeting" icon="gtk-redo" type="object"/>
<field name="date" string="Date" required="1"/>
<field name="date" required="1"/>
<field name="user_id"/>
<field name="section_id" colspan="1" widget="selection" />
<button string="Convert to Opportunity"
@ -101,7 +99,7 @@
type="action"
attrs="{'invisible':[('partner_id','!=',False)]}" />
<newline/>
<field name="partner_address_id" string="Contact"
<field name="partner_address_id"
on_change="onchange_partner_address_id(partner_address_id, email_from)" />
<newline/>
<field name="partner_mobile" />
@ -147,7 +145,7 @@
<field name="arch" type="xml">
<form string="Phone Call">
<group colspan="4" col="7">
<field name="name" string="Summary" required="1"/>
<field name="name" required="1"/>
<field name="partner_phone"/>
<field name="duration" widget="float_time"/>
<button string="Schedule a Meeting"
@ -155,7 +153,7 @@
icon="gtk-redo"
type="object" />
<field name="date" string="Date" required="1"/>
<field name="date" required="1"/>
<field name="user_id"/>
<field name="section_id" colspan="1" widget="selection" />
<button string="Convert to Opportunity"
@ -179,7 +177,7 @@
type="action"
attrs="{'invisible':[('partner_id','!=',False)]}" />
<newline/>
<field name="partner_address_id" string="Contact"
<field name="partner_address_id"
on_change="onchange_partner_address_id(partner_address_id, email_from)" />
<newline/>
<field name="partner_mobile" />
@ -207,12 +205,12 @@
<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="date"/>
<field name="name"/>
<field name="partner_id"
on_change="onchange_partner_id(partner_id, email_from)"
string="Partner" />
<field name="partner_address_id" string="Contact"
<field name="partner_address_id"
on_change="onchange_partner_address_id(partner_address_id, email_from)" />
<field name="partner_phone"/>
<field name="user_id"/>
@ -273,7 +271,7 @@
/>
<separator orientation="vertical"/>
<field name="name" string="Call Summary"/>
<field name="name"/>
<field name="partner_id"/>
<field name="user_id">
<filter icon="terp-personal-"

View File

@ -169,9 +169,8 @@
<field name="model">crm.case.resource.type</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Resource Type">
<tree string="Campaign">
<field name="name"/>
<field name="object_id"/>
<field name="section_id"/>
</tree>
</field>
@ -184,10 +183,9 @@
<field name="model">crm.case.resource.type</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Resource Type">
<form string="Campaign">
<field name="name" select="1"/>
<field name="section_id" select="1" widget="selection"/>
<field name="object_id" />
</form>
</field>
</record>
@ -195,14 +193,14 @@
<!-- Resource Type of case Action -->
<record id="crm_case_resource_type_act" model="ir.actions.act_window">
<field name="name">Resource Type</field>
<field name="name">Campaigns</field>
<field name="res_model">crm.case.resource.type</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_case_resource_type_tree"/>
</record>
<record id="crm_case_section_act_tree" model="ir.actions.act_window">
<field name="name">Cases by section</field>
<field name="name">Cases by Sales Team</field>
<field name="res_model">crm.case.section</field>
<field name="domain">[('parent_id','=',False)]</field>
<field name="view_type">tree</field>
@ -436,7 +434,7 @@
<field name="model">crm.case.section.custom</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Custom Case Section">
<tree string="Custom Case Teams">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
@ -527,7 +525,7 @@
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char" size="512"/>
<field colspan="4" name="email_cc" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
@ -576,9 +574,6 @@
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.case.custom'}"
icon="terp-mail-message-new" type="action" />
<button string="Forward to Partner"
name="%(crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action" />
</page>
</notebook>
</form>

View File

@ -77,7 +77,9 @@ class crm_lead_report(osv.osv):
'name': fields.char('Year', size=64, required=False, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'country_id':fields.many2one('res.country', 'Country', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Sales Team', readonly=True),
'channel_id':fields.many2one('res.partner.canal', 'Channel', readonly=True),
'type_id':fields.many2one('crm.case.resource.type', 'Campaign', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'avg_answers': fields.function(_get_data, string='Avg. Answers', method=True, type="integer"),
'perc_done': fields.function(_get_data, string='%Done', method=True, type="float"),
@ -99,8 +101,7 @@ class crm_lead_report(osv.osv):
'planned_revenue': fields.float('Planned Revenue',digits=(16,2),readonly=True),
'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]" , readonly=True),
domain="[('section_id','=',section_id)]" , readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]", readonly=True),
@ -141,6 +142,8 @@ class crm_lead_report(osv.osv):
c.company_id,
c.priority,
c.section_id,
c.channel_id,
c.type_id,
c.categ_id,
c.partner_id,
c.country_id,

View File

@ -14,6 +14,8 @@
<field name="state" invisible="1"/>
<field name="stage_id" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="channel_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="month" invisible="1"/>
@ -69,9 +71,17 @@
<field name="arch" type="xml">
<search string="Leads Analysis">
<group col="20" colspan="8">
<filter string="Last 365 Days" icon="terp-go-year"
domain="[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
<filter string="Last 30 Days" icon="terp-go-month" name="this_month"
<filter string="Leads"
icon="terp-check"
name="filter_lead"
groups="base.group_extended"
domain="[('type','=','lead')]"/>
<filter string="Opportunities"
icon="terp-check"
name="filter_opportunity"
domain="[('type','=','opportunity')]"/>
<separator orientation="vertical" />
<filter string="30 Days" icon="terp-go-month" name="this_month"
domain="[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
<filter icon="terp-go-week" string="7 Days" separator="1"
domain="[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
@ -111,6 +121,10 @@
context="{'group_by':'section_id'}" />
<filter string="Category" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'categ_id'}" />
<filter string="Campaign" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'type_id'}" />
<filter string="Channel" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'channel_id'}" />
<separator orientation="vertical" />
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<separator orientation="vertical"/>
@ -135,7 +149,9 @@
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]" />
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
<field name="categ_id" widget="selection"/>
<field name="type_id" widget="selection"/>
<field name="channel_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
@ -166,6 +182,8 @@
<field name="stage_id" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="channel_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
@ -186,9 +204,9 @@
<field name="name">Leads Analysis</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="context">{'search_default_lead':1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_filter_lead': 1, 'search_default_lead':1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('type', '=', 'lead')]</field>
<field name="domain">[]</field>
<field name="help">Leads Analysis allows you to consult different informations relative to CRM. Check for treatments delays, number of responses given and emails send. You can sort out your leads analysis on different groups to get fine grained analysis.</field>
</record>
@ -210,9 +228,9 @@
<field name="name">Opportunities Analysis</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="context">{"search_default_opportunity": 1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{"search_default_filter_opportunity":1, "search_default_opportunity": 1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('type', '=', 'opportunity')]</field>
<field name="domain">[]</field>
<field name="help">Opportunities Analysis menu gives you an instant access to your opportunities like expected revenue, planned cost, overpassed deadline or the number of exchanges by opportunity.</field>
</record>

View File

@ -31,8 +31,6 @@ class res_partner(osv.osv):
'Meetings'),
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id',\
'Phonecalls'),
'opportunity_assigned_ids': fields.one2many('crm.lead', 'partner_assigned_id',\
'Assigned Opportunities'),
}
res_partner()

View File

@ -44,39 +44,6 @@
icon="gtk-cancel" />
</tree>
</field>
<field name="opportunity_assigned_ids" colspan="4" nolabel="1">
<tree string="Assigned Opportunities" colors="blue:state=='pending';gray:state=='cancel'">
<field name="create_date"/>
<field name="name"/>
<field name="type"/>
<field name="stage_id"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="section_id"
invisible="context.get('invisible_section', True)" />
<field name="user_id" />
<field name="state" />
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button string="Convert to Opportunity"
name="convert_opportunity"
states="draft,open,pending" icon="gtk-index"
type="object" attrs="{'invisible':[('type','=','opportunity')]}" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
icon="gtk-go-up" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
<field name="meeting_ids" colspan="4" nolabel="1" >
<tree string="Meetings" colors="gray:state in ('draft', 'cancel','done','pending')">
<field name="user_id" string="Responsible"/>

View File

@ -20,7 +20,6 @@
##############################################################################
import crm_send_email
import crm_forward_to_partner
import crm_add_note
import crm_lead_to_partner

View File

@ -20,3 +20,5 @@
##############################################################################
import partner_geo_assign
import wizard
import report

View File

@ -30,9 +30,11 @@ based on geolocalization.
""",
'author': 'OpenERP SA',
'depends': ['crm'],
'data': [
'update_xml': [
'res_partner_view.xml',
'wizard/crm_forward_to_partner_view.xml',
'crm_lead_view.xml',
'report/crm_lead_report_view.xml',
],
'installable': True,
'active': False,

View File

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_crm_opportunity_geo_assign_form" model="ir.ui.view">
<field name="name">crm.lead.geo_assign.inherit</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<data>
<xpath expr="//notebook[last()]" position="inside">
<page string="Assignation" groups="base.group_extended">
<group name="partner_assign_group" col="5" colspan="4">
<separator string="Partner Assignation" colspan="5"/>
<field name="partner_assigned_id" on_change="onchange_assign_id(partner_assigned_id)" domain="[('grade_id','&lt;&gt;',False)]"/>
<field name="date_assign"/>
<group colspan="1" col="1">
<button string="Forward"
attrs="{'invisible':[('partner_assigned_id','=',False)]}"
name="%(crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action"
context="{'default_name': 'partner', 'default_partner_id': partner_assigned_id}"
/>
</group>
<group name="geo_assign_group" col="5" colspan="4">
<separator string="Geo Assignation" colspan="5"/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
<group colspan="1" col="1">
<button string="Geo Assign" name="assign_partner" type="object" colspan="1"
icon="gtk-apply"/>
</group>
</group>
</group>
</page>
</xpath>
</data>
</field>
</record>
</data>
</openerp>

View File

@ -41,6 +41,20 @@ def geo_find(addr):
_('Could not contact geolocation servers, please make sure you have a working internet connection (%s)') % e)
class res_partner_grade(osv.osv):
_order = 'sequence'
_name = 'res.partner.grade'
_columns = {
'sequence': fields.integer('Sequence'),
'active': fields.boolean('Active'),
'name': fields.char('Grade Name', size=32)
}
_defaults = {
'active': lambda *args: 1
}
res_partner_grade()
class res_partner(osv.osv):
_inherit = "res.partner"
_columns = {
@ -49,6 +63,9 @@ class res_partner(osv.osv):
'date_localization': fields.date('Geo Localization Date'),
'partner_weight': fields.integer('Weight',
help="Gives the probability to assign a lead to this partner. (0 means no assignation.)"),
'opportunity_assigned_ids': fields.one2many('crm.lead', 'partner_assigned_id',\
'Assigned Opportunities'),
'grade_id': fields.many2one('res.partner.grade', 'Partner Grade')
}
_defaults = {
'partner_weight': lambda *args: 0
@ -74,7 +91,21 @@ class crm_lead(osv.osv):
_columns = {
'partner_latitude': fields.float('Geo Latitude'),
'partner_longitude': fields.float('Geo Longitude'),
'partner_assigned_id': fields.many2one('res.partner', 'Assigned Partner', help="Partner this case has been forwarded/assigned to.", select=True),
'date_assign': fields.date('Assignation Date', help="Last date this case was forwarded/assigned to a partner"),
}
def onchange_assign_id(self, cr, uid, ids, partner_assigned_id, context={}):
"""This function updates the "assignation date" automatically, when manually assign a partner in the geo assign tab
@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 stages IDs
@stage_id: change state id on run time """
if not partner_assigned_id:
return {'value':{'date_assign': False}}
else:
return {'value':{'date_assign': time.strftime('%Y-%m-%d')}}
def assign_partner(self, cr, uid, ids, context=None):
ok = False

View File

@ -19,26 +19,5 @@
#
##############################################################################
import time
from report import report_sxw
from tools import amount_to_text_en
import crm_lead_report
class report_voucher_amount(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher_amount, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'convert':self.convert
})
def convert(self, amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
return amt_en
report_sxw.report_sxw(
'report.voucher.cash_amount',
'account.voucher',
'addons/account_voucher/report/report_voucher_amount.rml',
parser=report_voucher_amount,header="external"
)

View File

@ -0,0 +1,127 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
import tools
from crm import crm
AVAILABLE_STATES = [
('draft','Draft'),
('open','Open'),
('cancel', 'Cancelled'),
('done', 'Closed'),
('pending','Pending')
]
class crm_lead_report_assign(osv.osv):
""" CRM Lead Report """
_name = "crm.lead.report.assign"
_auto = False
_description = "CRM Lead Report"
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'partner_assigned_id':fields.many2one('res.partner', 'Partner', readonly=True),
'grade_id':fields.many2one('res.partner.grade', 'Grade', readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'country_id':fields.many2one('res.country', 'Country', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Sales Team', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
('07', 'July'), ('08', 'August'),\
('09', 'September'), ('10', 'October'),\
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'partner_date': fields.date('Partner Date', readonly=True),
'create_date': fields.datetime('Create Date', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'delay_open': fields.float('Delay to Open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"),
'delay_close': fields.float('Delay to Close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"),
'probability': fields.float('Avg Probability',digits=(16,2),readonly=True, group_operator="avg"),
'probability_max': fields.float('Max Probability',digits=(16,2),readonly=True, group_operator="max"),
'planned_revenue': fields.float('Planned Revenue',digits=(16,2),readonly=True),
'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id)]" , readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]", readonly=True),
'partner_id': fields.many2one('res.partner', 'Customer' , readonly=True),
'opening_date': fields.date('Opening Date', readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),
'date_closed': fields.date('Close Date', readonly=True),
'nbr': fields.integer('# of Cases', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'type':fields.selection([
('lead','Lead'),
('opportunity','Opportunity'),
],'Type', help="Type is used to separate Leads and Opportunities"),
}
def init(self, cr):
"""
CRM Lead Report
@param cr: the current row, from the database cursor
"""
tools.drop_view_if_exists(cr, 'crm_lead_report_assign')
cr.execute("""
CREATE OR REPLACE VIEW crm_lead_report_assign AS (
SELECT
c.id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
to_char(c.create_date, 'YYYY-MM-DD') as day,
to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
c.state,
c.user_id,
c.probability,
c.probability as probability_max,
c.stage_id,
c.type,
c.company_id,
c.priority,
c.section_id,
c.categ_id,
c.partner_id,
c.country_id,
c.planned_revenue,
c.partner_assigned_id,
p.grade_id,
p.date as partner_date,
c.planned_revenue*(c.probability/100) as probable_revenue,
1 as nbr,
date_trunc('day',c.create_date) as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected,
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open
FROM
crm_lead c
left join res_partner p on (c.partner_assigned_id=p.id)
)""")
crm_lead_report_assign()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Opportunity tree view -->
<record id="view_report_crm_lead_assign_filter" model="ir.ui.view">
<field name="name">crm.lead.report.assign.select</field>
<field name="model">crm.lead.report.assign</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Leads Analysis">
<group col="20" colspan="8">
<filter string="Last 30 Days" icon="terp-go-month" name="this_month"
domain="[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
<filter icon="terp-go-week" string="7 Days" separator="1"
domain="[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical" />
<filter icon="terp-check"
string="Current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-check"
string="Closed"
domain="[('state','=','done')]"/>
<separator orientation="vertical" />
<field name="section_id"
default="context.get('section_id', False)"
widget="selection"
context="{'invisible_section': False}"/>
<field name="grade_id"/>
<field name="user_id"/>
<field name="partner_assigned_id"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="user" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_assigned_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<separator orientation="vertical" />
<filter string="Section" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" />
<filter string="Grade" name="group_grade" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'grade_id'}" />
<filter string="Category" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<separator orientation="vertical"/>
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}" />
<separator orientation="vertical" />
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
<separator orientation="vertical" />
<filter string="Partner Date" icon="terp-go-today"
domain="[]"
name="group_partner_date"
context="{'group_by':'partner_date'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" />
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]" />
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
</search>
</field>
</record>
<record id="view_report_crm_opportunity_assign_tree" model="ir.ui.view">
<field name="name">crm.lead.assign.report.tree</field>
<field name="model">crm.lead.report.assign</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities Assignment Analysis">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="partner_date" invisible="1"/>
<field name="section_id" invisible="1" groups="base.group_extended"/>
<field name="user_id" invisible="1"/>
<field name="grade_id" invisible="1" widget="selection"/>
<field name="partner_assigned_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="country_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="state" invisible="1"/>
<field name="stage_id" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
<field name="planned_revenue" sum="Planned Revenues"/>
<field name="delay_open" sum='Delay to open'/>
<field name="delay_close" sum='Delay to close'/>
<field name="delay_expected"/>
<field name="probability" widget="progressbar"/>
<field name="probability_max" widget="progressbar"/>
<field name="probable_revenue"/>
</tree>
</field>
</record>
<!-- Leads by user and section Action -->
<record id="action_report_crm_opportunity_assign" model="ir.actions.act_window">
<field name="name">Opp. Assignment Analysis</field>
<field name="res_model">crm.lead.report.assign</field>
<field name="view_type">form</field>
<field name="context">{"search_default_group_partner_date": 1, "search_default_group_grade":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_mode">tree</field>
<field name="domain">[('type', '=', 'opportunity')]</field>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_opportunity_assign_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_crm_opportunity_assign_tree"/>
<field name="act_window_id" ref="action_report_crm_opportunity_assign"/>
</record>
<menuitem id="menu_report_crm_opportunities_assign_tree"
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_opportunity_assign" sequence="5"/>
</data>
</openerp>

View File

@ -0,0 +1,126 @@
<?xml version="1.0"?>
<openerp>
<data>
<!--Partner Grade -->
<record id="view_partner_grade_tree" model="ir.ui.view">
<field name="name">res.partner.grade.tree</field>
<field name="model">res.partner.grade</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Partner Grade">
<field name="sequence" invisible="1"/>
<field name="name"/>
</tree>
</field>
</record>
<record id="view_partner_grade_form" model="ir.ui.view">
<field name="name">res.partner.grade.form</field>
<field name="model">res.partner.grade</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Partner Grade">
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="sequence"/>
<field name="active"/>
</group>
</form>
</field>
</record>
<record id="res_partner_grade_action" model="ir.actions.act_window">
<field name="name">Partner Grade</field>
<field name="res_model">res.partner.grade</field>
<field name="view_type">form</field>
</record>
<menuitem action="res_partner_grade_action" id="menu_res_partner_grade_action"
groups="base.group_extended"
parent="base.menu_crm_config_lead" />
<!-- Partner form -->
<record id="view_res_partner_filter_assign_tree" model="ir.ui.view">
<field name="name">res.partner.geo.inherit.tree</field>
<field name="model">res.partner</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="grade_id"/>
</field>
</field>
</record>
<record id="view_res_partner_filter_assign" model="ir.ui.view">
<field name="name">res.partner.geo.inherit.search</field>
<field name="model">res.partner</field>
<field name="type">search</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<field name="category_id" position="after">
<field name="grade_id"/>
</field>
</field>
</record>
<record id="view_crm_partner_geo_form" model="ir.ui.view">
<field name="name">res.partner.geo.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook[last()]" position="inside">
<page string="Geo Localization">
<field name="grade_id" widget="selection"/>
<newline/>
<field name="partner_weight"/>
<label string="" colspan="1"/>
<button
string="Geo Localize"
name="geo_localize"
icon="gtk-apply"
type="object"/>
<newline/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
<field name="date_localization"/>
<field name="opportunity_assigned_ids" colspan="4" nolabel="1">
<tree string="Assigned Opportunities" colors="blue:state=='pending';gray:state=='cancel'">
<field name="create_date"/>
<field name="name"/>
<field name="type"/>
<field name="stage_id"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="section_id"
invisible="context.get('invisible_section', True)" />
<field name="user_id" />
<field name="state" />
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button string="Convert to Opportunity"
name="convert_opportunity"
states="draft,open,pending" icon="gtk-index"
type="object" attrs="{'invisible':[('type','=','opportunity')]}" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
icon="gtk-go-up" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</page>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import crm_forward_to_partner

View File

@ -5,7 +5,7 @@
<field name="name">crm_lead_forward_to_partner</field>
<field name="model">crm.lead.forward.to.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="crm_send_new_mail_view"/>
<field name="inherit_id" ref="crm.crm_send_new_mail_view"/>
<field name="arch" type="xml">
<field name="email_from" position="before">
<separator string="Forward to Partner" colspan="4" />
@ -31,7 +31,7 @@
<field name="name">crm_lead_forward_to_partner1</field>
<field name="model">crm.lead.forward.to.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="crm_send_new_mail_view"/>
<field name="inherit_id" ref="crm.crm_send_new_mail_view"/>
<field name="arch" type="xml">
<button name="action_send" position="replace">
<button name="action_forward" string="Forward" icon="gtk-go-forward" type="object" />

View File

@ -20,6 +20,9 @@
##############################################################################
from osv import osv, fields
from tools import cache
import pooler
class decimal_precision(osv.osv):
_name = 'decimal.precision'
@ -30,23 +33,33 @@ class decimal_precision(osv.osv):
_defaults = {
'digits': lambda *a : 2,
}
_sql_constraints = [
('name_uniq', 'unique (name)', """The Usage of the decimal precision must be unique!"""),
]
@cache(skiparg=3)
def precision_get(self, cr, uid, application):
cr.execute('select digits from decimal_precision where name=%s', (application,))
res = cr.fetchone()
return res and res[0] or 2
def write(self, cr, uid, ids, data, *args, **argv):
self.precision_get.clear_cache(cr.dbname)
res = super(decimal_precision, self).write(cr, uid, ids, data, *args, **argv)
for obj in self.pool.obj_list():
for colname,col in self.pool.get(obj)._columns.items():
if isinstance(col, fields.float):
col.digits_change(cr)
return res
decimal_precision()
def get_precision(application):
def change_digit(cr):
cr.execute('select digits from decimal_precision where name=%s', (application,))
res = cr.fetchone()
return (16,res and res[0] or 2)
res = pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application)
return (16, res)
return change_digit

View File

@ -154,7 +154,7 @@ class email_server(osv.osv):
for num in range(1, numMsgs + 1):
(header, msges, octets) = pop_server.retr(num)
msg = '\n'.join(msges)
res_id = email_tool.process_email(cr, uid, server.object_id.model, data[0][1], attach=server.attach, context=context)
res_id = email_tool.process_email(cr, uid, server.object_id.model, msg, attach=server.attach, context=context)
if res_id and server.action_id:
action_pool = self.pool.get('ir.actions.server')
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})

View File

@ -27,28 +27,39 @@ from mx import DateTime
from tools.translate import _
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context={}, values={}):
res = {}
for id in ids:
res[id] = []
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
if context is None:
context = {}
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)
res6 = {}
for r in res5:
res6[r['id']] = (r['date_current'], r['user_id'][0])
if values is None:
values = {}
ids2 = []
for id in ids:
dom = []
res = {}.fromkeys(ids, [])
# dict:
# {idn: (date_current, user_id), ...
# 1: ('2010-08-15', 1)}
res6 = dict([(rec['id'], (rec['date_current'], rec['user_id'][0]))
for rec
in obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)])
# eg: ['|', '|',
# '&', '&', ('name', '>=', '2011-03-01'), ('name', '<=', '2011-03-01'), ('employee_id.user_id', '=', 1),
# '&', '&', ('name', '>=', '2011-02-01'), ('name', '<=', '2011-02-01'), ('employee_id.user_id', '=', 1)]
dom = []
for c, id in enumerate(ids):
if id in res6:
dom = [('name', '>=', res6[id][0] + ' 00:00:00'),
('name', '<=', res6[id][0] + ' 23:59:59'),
('employee_id.user_id', '=', res6[id][1])]
ids2.extend(obj.pool.get(self._obj).search(cr, user,
dom, limit=self._limit))
if c: # skip first
dom.insert(0 ,'|')
dom.append('&')
dom.append('&')
dom.append(('name', '>=', res6[id][0]))
dom.append(('name', '<=', res6[id][0]))
dom.append(('employee_id.user_id', '=', res6[id][1]))
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2,
[self._fields_id], context=context, load='_classic_write'):
ids2 = obj.pool.get(self._obj).search(cr, user, dom, limit=self._limit)
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
if r[self._fields_id]:
res.setdefault(r[self._fields_id][0], []).append(r['id'])
@ -57,17 +68,21 @@ class one2many_mod2(fields.one2many):
def set(self, cr, obj, id, field, values, user=None, context=None):
if context is None:
context = {}
context = context.copy()
context['sheet_id'] = id
return super(one2many_mod2, self).set(cr, obj, id, field, values, user=user,
context=context)
return super(one2many_mod2, self).set(cr, obj, id, field, values, user=user, context=context)
class one2many_mod(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context={}, values={}):
res = {}
for id in ids:
res[id] = []
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
if context is None:
context = {}
if values is None:
values = {}
res = {}.fromkeys(ids, [])
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)
res6 = {}

View File

@ -378,7 +378,6 @@ class one2many_domain(fields.one2many):
move_obj = obj.pool.get('stock.move')
res = {}.fromkeys(ids, [])
key = operator.itemgetter(0)
move_ids = move_obj.search(cr, user, self._domain+[('production_id', 'in', tuple(ids))], context=context)
related_move_dict = dict([(o.production_id.id, [o.id]) for o in move_obj.browse(cr, user, move_ids, context=context)])
res.update(related_move_dict)

View File

@ -1,5 +1,27 @@
#!/usr/bin/python
#-*- encoding: utf-8 -*-
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- 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 win32com import universal
from win32com.server.exception import COMException
@ -40,8 +62,12 @@ def GetConn():
class ButtonEvent:
def OnClick(self, button, cancel):
mngr = manager.GetManager()
mngr.ShowManager()
import win32ui
try:
mngr = manager.GetManager()
mngr.ShowManager()
except Exception,e:
win32ui.MessageBox("Fail to Initialize dialog.\n"+str(e),"OpenERP Configuration", win32con.MB_ICONERROR)
return cancel
#
class ViewPartners:
@ -55,12 +81,12 @@ class ViewPartners:
if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "Database Connection", win32con.MB_ICONEXCLAMATION)
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
elif ex.Selection.Count == 1 or ex.Selection.Count == 0:
mngr = manager.GetManager()
mngr.ShowManager("IDD_VIEW_PARTNER_DIALOG")
elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","",win32con.MB_ICONINFORMATION)
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Open Contact",win32con.MB_ICONINFORMATION)
return cancel
#
class ArchiveEvent:
@ -74,14 +100,14 @@ class ArchiveEvent:
if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "Database Connection", win32con.MB_ICONEXCLAMATION)
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
elif ex.Selection.Count == 1:
mngr = manager.GetManager()
mngr.ShowManager("IDD_SYNC")
elif ex.Selection.Count == 0:
win32ui.MessageBox("No mail selected to archive to OpenERP","",win32con.MB_ICONINFORMATION)
win32ui.MessageBox("No mail selected to push to OpenERP","Push to OpenERP",win32con.MB_ICONINFORMATION)
elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","",win32con.MB_ICONINFORMATION)
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Push to OpenERP",win32con.MB_ICONINFORMATION)
return cancel
#
class OutlookAddin:
@ -111,8 +137,8 @@ class OutlookAddin:
item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.menu_bar_arch_Button = DispatchWithEvents(item, ArchiveEvent)
item.Caption="Archive to OpenERP"
item.TooltipText = "Click to archive to OpenERP"
item.Caption="Push to OpenERP"
item.TooltipText = "Click to push to OpenERP"
item.Enabled = True
toolbar = bars.Item("Standard")
@ -120,8 +146,8 @@ class OutlookAddin:
item = toolbar.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.toolbarButton = DispatchWithEvents(item, ArchiveEvent)
item.Caption="Archive to OpenERP"
item.TooltipText = "Click to archive to OpenERP"
item.Caption="Push to OpenERP"
item.TooltipText = "Click to push to OpenERP"
item.Enabled = True
# Adding Menu in Menu Bar to the Web Menu of the Outlook
@ -196,9 +222,11 @@ if __name__ == '__main__':
if "--unregister" in sys.argv:
UnregisterAddin(OutlookAddin)
UnregisterXMLConn(NewConn)
print "\n \tPlug In Un-registered Successfully.\n\tThank You for Using PlugIn."
else:
RegisterAddin(OutlookAddin)
RegisterXMLConn(NewConn)
print "\n \tPlug In Registered Successfully.\n\tEnjoy Archiving with OpenERP.\n\tSee UserGuide for More. "
#mngr = manager.GetManager()
#mngr.ShowManager("IDD_MANAGER")

View File

@ -218,6 +218,7 @@ class CkHtmlToXml(_object):
__del__ = lambda self : None;
def get_Utf8(self): return _chilkat.CkHtmlToXml_get_Utf8(self)
def put_Utf8(self, *args): return _chilkat.CkHtmlToXml_put_Utf8(self, *args)
def SetHtmlBytes(self, *args): return _chilkat.CkHtmlToXml_SetHtmlBytes(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkHtmlToXml_UnlockComponent(self, *args)
def IsUnlocked(self): return _chilkat.CkHtmlToXml_IsUnlocked(self)
def SaveLastError(self, *args): return _chilkat.CkHtmlToXml_SaveLastError(self, *args)
@ -630,6 +631,10 @@ class CkSocket(_object):
def put_HttpProxyHostname(self, *args): return _chilkat.CkSocket_put_HttpProxyHostname(self, *args)
def get_HttpProxyPort(self): return _chilkat.CkSocket_get_HttpProxyPort(self)
def put_HttpProxyPort(self, *args): return _chilkat.CkSocket_put_HttpProxyPort(self, *args)
def get_NumSslAcceptableClientCAs(self): return _chilkat.CkSocket_get_NumSslAcceptableClientCAs(self)
def GetSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_GetSslAcceptableClientCaDn(self, *args)
def getSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_getSslAcceptableClientCaDn(self, *args)
def AddSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_AddSslAcceptableClientCaDn(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkSocket_UnlockComponent(self, *args)
def IsUnlocked(self): return _chilkat.CkSocket_IsUnlocked(self)
def AsyncSendBytes(self, *args): return _chilkat.CkSocket_AsyncSendBytes(self, *args)
@ -1241,6 +1246,8 @@ class CkRsa(_object):
def signHashENC(self, *args): return _chilkat.CkRsa_signHashENC(self, *args)
def get_VerboseLogging(self): return _chilkat.CkRsa_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkRsa_put_VerboseLogging(self, *args)
def get_NoUnpad(self): return _chilkat.CkRsa_get_NoUnpad(self)
def put_NoUnpad(self, *args): return _chilkat.CkRsa_put_NoUnpad(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkRsa_UnlockComponent(self, *args)
def SaveLastError(self, *args): return _chilkat.CkRsa_SaveLastError(self, *args)
def LastErrorXml(self, *args): return _chilkat.CkRsa_LastErrorXml(self, *args)
@ -1338,7 +1345,6 @@ class CkEmail(_object):
def ComputeGlobalKey(self, *args): return _chilkat.CkEmail_ComputeGlobalKey(self, *args)
def computeGlobalKey(self, *args): return _chilkat.CkEmail_computeGlobalKey(self, *args)
def get_NumDaysOld(self): return _chilkat.CkEmail_get_NumDaysOld(self)
def UnwrapSecurity(self): return _chilkat.CkEmail_UnwrapSecurity(self)
def get_PreferredCharset(self, *args): return _chilkat.CkEmail_get_PreferredCharset(self, *args)
def preferredCharset(self): return _chilkat.CkEmail_preferredCharset(self)
def put_PreferredCharset(self, *args): return _chilkat.CkEmail_put_PreferredCharset(self, *args)
@ -1349,6 +1355,22 @@ class CkEmail(_object):
def AddEncryptCert(self, *args): return _chilkat.CkEmail_AddEncryptCert(self, *args)
def UnpackHtml(self, *args): return _chilkat.CkEmail_UnpackHtml(self, *args)
def SetFromMimeBytes(self, *args): return _chilkat.CkEmail_SetFromMimeBytes(self, *args)
def SetAttachmentDisposition(self, *args): return _chilkat.CkEmail_SetAttachmentDisposition(self, *args)
def RemoveHtmlAlternative(self): return _chilkat.CkEmail_RemoveHtmlAlternative(self)
def RemovePlainTextAlternative(self): return _chilkat.CkEmail_RemovePlainTextAlternative(self)
def AddHeaderField2(self, *args): return _chilkat.CkEmail_AddHeaderField2(self, *args)
def get_PrependHeaders(self): return _chilkat.CkEmail_get_PrependHeaders(self)
def put_PrependHeaders(self, *args): return _chilkat.CkEmail_put_PrependHeaders(self, *args)
def CreateDsn(self, *args): return _chilkat.CkEmail_CreateDsn(self, *args)
def CreateMdn(self, *args): return _chilkat.CkEmail_CreateMdn(self, *args)
def get_SigningHashAlg(self, *args): return _chilkat.CkEmail_get_SigningHashAlg(self, *args)
def signingHashAlg(self): return _chilkat.CkEmail_signingHashAlg(self)
def put_SigningHashAlg(self, *args): return _chilkat.CkEmail_put_SigningHashAlg(self, *args)
def get_Pkcs7CryptAlg(self, *args): return _chilkat.CkEmail_get_Pkcs7CryptAlg(self, *args)
def pkcs7CryptAlg(self): return _chilkat.CkEmail_pkcs7CryptAlg(self)
def put_Pkcs7CryptAlg(self, *args): return _chilkat.CkEmail_put_Pkcs7CryptAlg(self, *args)
def get_Pkcs7KeyLength(self): return _chilkat.CkEmail_get_Pkcs7KeyLength(self)
def put_Pkcs7KeyLength(self, *args): return _chilkat.CkEmail_put_Pkcs7KeyLength(self, *args)
def SetTextBody(self, *args): return _chilkat.CkEmail_SetTextBody(self, *args)
def getRelatedStringCrLf(self, *args): return _chilkat.CkEmail_getRelatedStringCrLf(self, *args)
def getRelatedContentID(self, *args): return _chilkat.CkEmail_getRelatedContentID(self, *args)
@ -1664,7 +1686,20 @@ class CkCert(_object):
__del__ = lambda self : None;
def CheckRevoked(self): return _chilkat.CkCert_CheckRevoked(self)
def get_Sha1Thumbprint(self, *args): return _chilkat.CkCert_get_Sha1Thumbprint(self, *args)
def TestCert(self): return _chilkat.CkCert_TestCert(self)
def ExportCertXml(self, *args): return _chilkat.CkCert_ExportCertXml(self, *args)
def exportCertXml(self): return _chilkat.CkCert_exportCertXml(self)
def get_VerboseLogging(self): return _chilkat.CkCert_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkCert_put_VerboseLogging(self, *args)
def get_CertVersion(self): return _chilkat.CkCert_get_CertVersion(self)
def SetPrivateKey(self, *args): return _chilkat.CkCert_SetPrivateKey(self, *args)
def get_OcspUrl(self, *args): return _chilkat.CkCert_get_OcspUrl(self, *args)
def ocspUrl(self): return _chilkat.CkCert_ocspUrl(self)
def FindIssuer(self): return _chilkat.CkCert_FindIssuer(self)
def LoadByIssuerAndSerialNumber(self, *args): return _chilkat.CkCert_LoadByIssuerAndSerialNumber(self, *args)
def get_SelfSigned(self): return _chilkat.CkCert_get_SelfSigned(self)
def SetPrivateKeyPem(self, *args): return _chilkat.CkCert_SetPrivateKeyPem(self, *args)
def GetPrivateKeyPem(self, *args): return _chilkat.CkCert_GetPrivateKeyPem(self, *args)
def getPrivateKeyPem(self): return _chilkat.CkCert_getPrivateKeyPem(self)
def getEncoded(self): return _chilkat.CkCert_getEncoded(self)
def issuerE(self): return _chilkat.CkCert_issuerE(self)
def issuerC(self): return _chilkat.CkCert_issuerC(self)
@ -1781,6 +1816,8 @@ class CkCertStore(_object):
def OpenOutlookStore(self, *args): return _chilkat.CkCertStore_OpenOutlookStore(self, *args)
def OpenRegistryStore(self, *args): return _chilkat.CkCertStore_OpenRegistryStore(self, *args)
def FindCertBySha1Thumbprint(self, *args): return _chilkat.CkCertStore_FindCertBySha1Thumbprint(self, *args)
def get_VerboseLogging(self): return _chilkat.CkCertStore_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkCertStore_put_VerboseLogging(self, *args)
def lastErrorText(self): return _chilkat.CkCertStore_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkCertStore_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkCertStore_lastErrorHtml(self)
@ -1875,6 +1912,23 @@ class CkMime(_object):
def AddContentLength(self): return _chilkat.CkMime_AddContentLength(self)
def get_VerboseLogging(self): return _chilkat.CkMime_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkMime_put_VerboseLogging(self, *args)
def DecryptUsingPfxData(self, *args): return _chilkat.CkMime_DecryptUsingPfxData(self, *args)
def DecryptUsingPfxFile(self, *args): return _chilkat.CkMime_DecryptUsingPfxFile(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkMime_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkMime_AddPfxSourceFile(self, *args)
def get_Pkcs7CryptAlg(self, *args): return _chilkat.CkMime_get_Pkcs7CryptAlg(self, *args)
def pkcs7CryptAlg(self): return _chilkat.CkMime_pkcs7CryptAlg(self)
def put_Pkcs7CryptAlg(self, *args): return _chilkat.CkMime_put_Pkcs7CryptAlg(self, *args)
def get_Pkcs7KeyLength(self): return _chilkat.CkMime_get_Pkcs7KeyLength(self)
def put_Pkcs7KeyLength(self, *args): return _chilkat.CkMime_put_Pkcs7KeyLength(self, *args)
def get_SigningHashAlg(self, *args): return _chilkat.CkMime_get_SigningHashAlg(self, *args)
def signingHashAlg(self): return _chilkat.CkMime_signingHashAlg(self)
def put_SigningHashAlg(self, *args): return _chilkat.CkMime_put_SigningHashAlg(self, *args)
def GetHeaderFieldAttribute(self, *args): return _chilkat.CkMime_GetHeaderFieldAttribute(self, *args)
def getHeaderFieldAttribute(self, *args): return _chilkat.CkMime_getHeaderFieldAttribute(self, *args)
def HasSignatureSigningTime(self, *args): return _chilkat.CkMime_HasSignatureSigningTime(self, *args)
def GetSignatureSigningTime(self, *args): return _chilkat.CkMime_GetSignatureSigningTime(self, *args)
def RemoveHeaderField(self, *args): return _chilkat.CkMime_RemoveHeaderField(self, *args)
def entireHead(self): return _chilkat.CkMime_entireHead(self)
def entireBody(self): return _chilkat.CkMime_entireBody(self)
def xml(self): return _chilkat.CkMime_xml(self)
@ -2111,6 +2165,14 @@ class CkMailMan(_object):
def put_HttpProxyPassword(self, *args): return _chilkat.CkMailMan_put_HttpProxyPassword(self, *args)
def get_HttpProxyPort(self): return _chilkat.CkMailMan_get_HttpProxyPort(self)
def put_HttpProxyPort(self, *args): return _chilkat.CkMailMan_put_HttpProxyPort(self, *args)
def get_AutoFix(self): return _chilkat.CkMailMan_get_AutoFix(self)
def put_AutoFix(self, *args): return _chilkat.CkMailMan_put_AutoFix(self, *args)
def get_VerboseLogging(self): return _chilkat.CkMailMan_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkMailMan_put_VerboseLogging(self, *args)
def get_Pop3Stls(self): return _chilkat.CkMailMan_get_Pop3Stls(self)
def put_Pop3Stls(self, *args): return _chilkat.CkMailMan_put_Pop3Stls(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkMailMan_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkMailMan_AddPfxSourceFile(self, *args)
def lastErrorText(self): return _chilkat.CkMailMan_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkMailMan_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkMailMan_lastErrorHtml(self)
@ -2183,8 +2245,6 @@ class CkMailMan(_object):
def put_ReadTimeout(self, *args): return _chilkat.CkMailMan_put_ReadTimeout(self, *args)
def get_ConnectTimeout(self): return _chilkat.CkMailMan_get_ConnectTimeout(self)
def put_ConnectTimeout(self, *args): return _chilkat.CkMailMan_put_ConnectTimeout(self, *args)
def get_AutoUnwrapSecurity(self): return _chilkat.CkMailMan_get_AutoUnwrapSecurity(self)
def put_AutoUnwrapSecurity(self, *args): return _chilkat.CkMailMan_put_AutoUnwrapSecurity(self, *args)
def get_ResetDateOnLoad(self): return _chilkat.CkMailMan_get_ResetDateOnLoad(self)
def put_ResetDateOnLoad(self, *args): return _chilkat.CkMailMan_put_ResetDateOnLoad(self, *args)
def get_OpaqueSigning(self): return _chilkat.CkMailMan_get_OpaqueSigning(self)
@ -2197,8 +2257,6 @@ class CkMailMan(_object):
def put_StartTLS(self, *args): return _chilkat.CkMailMan_put_StartTLS(self, *args)
def get_EmbedCertChain(self): return _chilkat.CkMailMan_get_EmbedCertChain(self)
def put_EmbedCertChain(self, *args): return _chilkat.CkMailMan_put_EmbedCertChain(self, *args)
def get_AutoSaveCerts(self): return _chilkat.CkMailMan_get_AutoSaveCerts(self)
def put_AutoSaveCerts(self, *args): return _chilkat.CkMailMan_put_AutoSaveCerts(self, *args)
def get_PopSsl(self): return _chilkat.CkMailMan_get_PopSsl(self)
def put_PopSsl(self, *args): return _chilkat.CkMailMan_put_PopSsl(self, *args)
def get_SmtpSsl(self): return _chilkat.CkMailMan_get_SmtpSsl(self)
@ -2320,6 +2378,8 @@ class CkGzip(_object):
def xfdlToXml(self, *args): return _chilkat.CkGzip_xfdlToXml(self, *args)
def Encode(self, *args): return _chilkat.CkGzip_Encode(self, *args)
def encode(self, *args): return _chilkat.CkGzip_encode(self, *args)
def get_VerboseLogging(self): return _chilkat.CkGzip_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkGzip_put_VerboseLogging(self, *args)
def lastErrorText(self): return _chilkat.CkGzip_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkGzip_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkGzip_lastErrorHtml(self)
@ -2471,6 +2531,11 @@ class CkCrypt2(_object):
def put_UuFilename(self, *args): return _chilkat.CkCrypt2_put_UuFilename(self, *args)
def get_VerboseLogging(self): return _chilkat.CkCrypt2_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkCrypt2_put_VerboseLogging(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkCrypt2_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkCrypt2_AddPfxSourceFile(self, *args)
def get_Pkcs7CryptAlg(self, *args): return _chilkat.CkCrypt2_get_Pkcs7CryptAlg(self, *args)
def pkcs7CryptAlg(self): return _chilkat.CkCrypt2_pkcs7CryptAlg(self)
def put_Pkcs7CryptAlg(self, *args): return _chilkat.CkCrypt2_put_Pkcs7CryptAlg(self, *args)
def get_FirstChunk(self): return _chilkat.CkCrypt2_get_FirstChunk(self)
def put_FirstChunk(self, *args): return _chilkat.CkCrypt2_put_FirstChunk(self, *args)
def get_LastChunk(self): return _chilkat.CkCrypt2_get_LastChunk(self)
@ -2847,6 +2912,16 @@ class CkFtp2(_object):
def get_SslProtocol(self, *args): return _chilkat.CkFtp2_get_SslProtocol(self, *args)
def sslProtocol(self): return _chilkat.CkFtp2_sslProtocol(self)
def put_SslProtocol(self, *args): return _chilkat.CkFtp2_put_SslProtocol(self, *args)
def get_AutoGetSizeForProgress(self): return _chilkat.CkFtp2_get_AutoGetSizeForProgress(self)
def put_AutoGetSizeForProgress(self, *args): return _chilkat.CkFtp2_put_AutoGetSizeForProgress(self, *args)
def get_SyncPreview(self, *args): return _chilkat.CkFtp2_get_SyncPreview(self, *args)
def syncPreview(self): return _chilkat.CkFtp2_syncPreview(self)
def SyncRemoteTree2(self, *args): return _chilkat.CkFtp2_SyncRemoteTree2(self, *args)
def get_AutoFix(self): return _chilkat.CkFtp2_get_AutoFix(self)
def put_AutoFix(self, *args): return _chilkat.CkFtp2_put_AutoFix(self, *args)
def get_ClientIpAddress(self, *args): return _chilkat.CkFtp2_get_ClientIpAddress(self, *args)
def clientIpAddress(self): return _chilkat.CkFtp2_clientIpAddress(self)
def put_ClientIpAddress(self, *args): return _chilkat.CkFtp2_put_ClientIpAddress(self, *args)
CkFtp2_swigregister = _chilkat.CkFtp2_swigregister
CkFtp2_swigregister(CkFtp2)
@ -3060,6 +3135,40 @@ class CkHttp(_object):
def PostUrlEncoded(self, *args): return _chilkat.CkHttp_PostUrlEncoded(self, *args)
def PostBinary(self, *args): return _chilkat.CkHttp_PostBinary(self, *args)
def postBinary(self, *args): return _chilkat.CkHttp_postBinary(self, *args)
def QuickGetObj(self, *args): return _chilkat.CkHttp_QuickGetObj(self, *args)
def get_SessionLogFilename(self, *args): return _chilkat.CkHttp_get_SessionLogFilename(self, *args)
def sessionLogFilename(self): return _chilkat.CkHttp_sessionLogFilename(self)
def put_SessionLogFilename(self, *args): return _chilkat.CkHttp_put_SessionLogFilename(self, *args)
def get_BgLastErrorText(self, *args): return _chilkat.CkHttp_get_BgLastErrorText(self, *args)
def bgLastErrorText(self): return _chilkat.CkHttp_bgLastErrorText(self)
def get_BgResultData(self, *args): return _chilkat.CkHttp_get_BgResultData(self, *args)
def get_BgResultInt(self): return _chilkat.CkHttp_get_BgResultInt(self)
def get_BgResultString(self, *args): return _chilkat.CkHttp_get_BgResultString(self, *args)
def bgResultString(self): return _chilkat.CkHttp_bgResultString(self)
def get_BgTaskFinished(self): return _chilkat.CkHttp_get_BgTaskFinished(self)
def get_BgTaskRunning(self): return _chilkat.CkHttp_get_BgTaskRunning(self)
def get_BgTaskSuccess(self): return _chilkat.CkHttp_get_BgTaskSuccess(self)
def get_EventLogCount(self): return _chilkat.CkHttp_get_EventLogCount(self)
def get_KeepEventLog(self): return _chilkat.CkHttp_get_KeepEventLog(self)
def put_KeepEventLog(self, *args): return _chilkat.CkHttp_put_KeepEventLog(self, *args)
def get_UseBgThread(self): return _chilkat.CkHttp_get_UseBgThread(self)
def put_UseBgThread(self, *args): return _chilkat.CkHttp_put_UseBgThread(self, *args)
def BgResponseObject(self): return _chilkat.CkHttp_BgResponseObject(self)
def BgTaskAbort(self): return _chilkat.CkHttp_BgTaskAbort(self)
def ClearEventLog(self): return _chilkat.CkHttp_ClearEventLog(self)
def EventLogName(self, *args): return _chilkat.CkHttp_EventLogName(self, *args)
def eventLogName(self, *args): return _chilkat.CkHttp_eventLogName(self, *args)
def EventLogValue(self, *args): return _chilkat.CkHttp_EventLogValue(self, *args)
def eventLogValue(self, *args): return _chilkat.CkHttp_eventLogValue(self, *args)
def SleepMs(self, *args): return _chilkat.CkHttp_SleepMs(self, *args)
def get_ClientIpAddress(self, *args): return _chilkat.CkHttp_get_ClientIpAddress(self, *args)
def clientIpAddress(self): return _chilkat.CkHttp_clientIpAddress(self)
def put_ClientIpAddress(self, *args): return _chilkat.CkHttp_put_ClientIpAddress(self, *args)
def get_ProxyAuthMethod(self, *args): return _chilkat.CkHttp_get_ProxyAuthMethod(self, *args)
def proxyAuthMethod(self): return _chilkat.CkHttp_proxyAuthMethod(self)
def put_ProxyAuthMethod(self, *args): return _chilkat.CkHttp_put_ProxyAuthMethod(self, *args)
def AddQuickHeader(self, *args): return _chilkat.CkHttp_AddQuickHeader(self, *args)
def RemoveQuickHeader(self, *args): return _chilkat.CkHttp_RemoveQuickHeader(self, *args)
def SetSslClientCert(self, *args): return _chilkat.CkHttp_SetSslClientCert(self, *args)
def get_LastHeader(self, *args): return _chilkat.CkHttp_get_LastHeader(self, *args)
def lastHeader(self): return _chilkat.CkHttp_lastHeader(self)
@ -3210,6 +3319,10 @@ class CkHttpRequest(_object):
def UsePostMultipartForm(self): return _chilkat.CkHttpRequest_UsePostMultipartForm(self)
def GetUrlEncodedParams(self, *args): return _chilkat.CkHttpRequest_GetUrlEncodedParams(self, *args)
def getUrlEncodedParams(self): return _chilkat.CkHttpRequest_getUrlEncodedParams(self)
def AddStringForUpload(self, *args): return _chilkat.CkHttpRequest_AddStringForUpload(self, *args)
def AddFileForUpload2(self, *args): return _chilkat.CkHttpRequest_AddFileForUpload2(self, *args)
def AddStringForUpload2(self, *args): return _chilkat.CkHttpRequest_AddStringForUpload2(self, *args)
def AddBytesForUpload2(self, *args): return _chilkat.CkHttpRequest_AddBytesForUpload2(self, *args)
def path(self): return _chilkat.CkHttpRequest_path(self)
def charset(self): return _chilkat.CkHttpRequest_charset(self)
def httpVersion(self): return _chilkat.CkHttpRequest_httpVersion(self)
@ -3290,6 +3403,7 @@ class CkHttpResponse(_object):
def get_Header(self, *args): return _chilkat.CkHttpResponse_get_Header(self, *args)
def get_Body(self, *args): return _chilkat.CkHttpResponse_get_Body(self, *args)
def get_BodyStr(self, *args): return _chilkat.CkHttpResponse_get_BodyStr(self, *args)
def get_BodyQP(self, *args): return _chilkat.CkHttpResponse_get_BodyQP(self, *args)
def get_StatusLine(self, *args): return _chilkat.CkHttpResponse_get_StatusLine(self, *args)
def get_StatusCode(self): return _chilkat.CkHttpResponse_get_StatusCode(self)
def get_Charset(self, *args): return _chilkat.CkHttpResponse_get_Charset(self, *args)
@ -3386,6 +3500,11 @@ class CkImap(_object):
def put_HttpProxyHostname(self, *args): return _chilkat.CkImap_put_HttpProxyHostname(self, *args)
def get_HttpProxyPort(self): return _chilkat.CkImap_get_HttpProxyPort(self)
def put_HttpProxyPort(self, *args): return _chilkat.CkImap_put_HttpProxyPort(self, *args)
def get_UidNext(self): return _chilkat.CkImap_get_UidNext(self)
def get_AutoFix(self): return _chilkat.CkImap_get_AutoFix(self)
def put_AutoFix(self, *args): return _chilkat.CkImap_put_AutoFix(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkImap_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkImap_AddPfxSourceFile(self, *args)
def Connect(self, *args): return _chilkat.CkImap_Connect(self, *args)
def Disconnect(self): return _chilkat.CkImap_Disconnect(self)
def IsConnected(self): return _chilkat.CkImap_IsConnected(self)
@ -3447,8 +3566,6 @@ class CkImap(_object):
def GetMailNumAttach(self, *args): return _chilkat.CkImap_GetMailNumAttach(self, *args)
def GetMailAttachSize(self, *args): return _chilkat.CkImap_GetMailAttachSize(self, *args)
def GetMailAttachFilename(self, *args): return _chilkat.CkImap_GetMailAttachFilename(self, *args)
def get_AutoUnwrapSecurity(self): return _chilkat.CkImap_get_AutoUnwrapSecurity(self)
def put_AutoUnwrapSecurity(self, *args): return _chilkat.CkImap_put_AutoUnwrapSecurity(self, *args)
def get_PeekMode(self): return _chilkat.CkImap_get_PeekMode(self)
def put_PeekMode(self, *args): return _chilkat.CkImap_put_PeekMode(self, *args)
def get_SessionLog(self, *args): return _chilkat.CkImap_get_SessionLog(self, *args)
@ -4557,6 +4674,12 @@ class CkSFtp(_object):
def get_HttpProxyUsername(self, *args): return _chilkat.CkSFtp_get_HttpProxyUsername(self, *args)
def httpProxyUsername(self): return _chilkat.CkSFtp_httpProxyUsername(self)
def put_HttpProxyUsername(self, *args): return _chilkat.CkSFtp_put_HttpProxyUsername(self, *args)
def get_TcpNoDelay(self): return _chilkat.CkSFtp_get_TcpNoDelay(self)
def put_TcpNoDelay(self, *args): return _chilkat.CkSFtp_put_TcpNoDelay(self, *args)
def get_AccumulateBuffer(self, *args): return _chilkat.CkSFtp_get_AccumulateBuffer(self, *args)
def ClearAccumulateBuffer(self): return _chilkat.CkSFtp_ClearAccumulateBuffer(self)
def AccumulateBytes(self, *args): return _chilkat.CkSFtp_AccumulateBytes(self, *args)
def AuthenticatePwPk(self, *args): return _chilkat.CkSFtp_AuthenticatePwPk(self, *args)
CkSFtp_swigregister = _chilkat.CkSFtp_swigregister
CkSFtp_swigregister(CkSFtp)
@ -4683,6 +4806,8 @@ class CkSsh(_object):
def httpProxyUsername(self): return _chilkat.CkSsh_httpProxyUsername(self)
def put_HttpProxyUsername(self, *args): return _chilkat.CkSsh_put_HttpProxyUsername(self, *args)
def ChannelReceiveUntilMatchN(self, *args): return _chilkat.CkSsh_ChannelReceiveUntilMatchN(self, *args)
def ChannelReadAndPoll2(self, *args): return _chilkat.CkSsh_ChannelReadAndPoll2(self, *args)
def AuthenticatePwPk(self, *args): return _chilkat.CkSsh_AuthenticatePwPk(self, *args)
def SaveLastError(self, *args): return _chilkat.CkSsh_SaveLastError(self, *args)
def LastErrorXml(self, *args): return _chilkat.CkSsh_LastErrorXml(self, *args)
def LastErrorHtml(self, *args): return _chilkat.CkSsh_LastErrorHtml(self, *args)
@ -5271,6 +5396,7 @@ class CkSshTunnel(_object):
def put_SocksVersion(self, *args): return _chilkat.CkSshTunnel_put_SocksVersion(self, *args)
def get_ConnectTimeoutMs(self): return _chilkat.CkSshTunnel_get_ConnectTimeoutMs(self)
def put_ConnectTimeoutMs(self, *args): return _chilkat.CkSshTunnel_put_ConnectTimeoutMs(self, *args)
def get_ListenPort(self): return _chilkat.CkSshTunnel_get_ListenPort(self)
CkSshTunnel_swigregister = _chilkat.CkSshTunnel_swigregister
CkSshTunnel_swigregister(CkSshTunnel)
@ -5352,6 +5478,7 @@ class CkNtlm(_object):
def get_ServerChallenge(self, *args): return _chilkat.CkNtlm_get_ServerChallenge(self, *args)
def serverChallenge(self): return _chilkat.CkNtlm_serverChallenge(self)
def put_ServerChallenge(self, *args): return _chilkat.CkNtlm_put_ServerChallenge(self, *args)
def LoadType3(self, *args): return _chilkat.CkNtlm_LoadType3(self, *args)
CkNtlm_swigregister = _chilkat.CkNtlm_swigregister
CkNtlm_swigregister(CkNtlm)
@ -5415,6 +5542,8 @@ class CkDkim(_object):
def NumDomainKeySignatures(self, *args): return _chilkat.CkDkim_NumDomainKeySignatures(self, *args)
def AddDkimSignature(self, *args): return _chilkat.CkDkim_AddDkimSignature(self, *args)
def AddDomainKeySignature(self, *args): return _chilkat.CkDkim_AddDomainKeySignature(self, *args)
def LoadDkimPkBytes(self, *args): return _chilkat.CkDkim_LoadDkimPkBytes(self, *args)
def LoadDomainKeyPkBytes(self, *args): return _chilkat.CkDkim_LoadDomainKeyPkBytes(self, *args)
def SaveLastError(self, *args): return _chilkat.CkDkim_SaveLastError(self, *args)
def LastErrorXml(self, *args): return _chilkat.CkDkim_LastErrorXml(self, *args)
def LastErrorHtml(self, *args): return _chilkat.CkDkim_LastErrorHtml(self, *args)

View File

@ -1,4 +1,8 @@
# This package defines dialog boxes used by the main
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
import os, sys, stat
#import dialog_map

View File

@ -1,6 +1,10 @@
# A core, data-driven dialog.
# Driven completely by "Control Processor" objects.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
import win32gui, win32api, win32con
import commctrl
import struct, array

View File

@ -1,5 +1,9 @@
# Generic utilities for dialog functions.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
def MAKELONG(l,h):
return ((h & 0xFFFF) << 16) | (l & 0xFFFF)

View File

@ -2,18 +2,39 @@
# These are extensions to basic Control Processors that are linked with
# Outlook-Plugin options.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import win32gui, win32api, win32con, win32ui
import commctrl
import struct, array
from dlgutils import *
import xmlrpclib
import processors
verbose = 0 # set to 1 to see option values fetched and set.
# A ControlProcessor that is linked up with options. These get a bit smarter.
class OptionControlProcessor(processors.ControlProcessor):
def __init__(self, window, control_ids):
processors.ControlProcessor.__init__(self, window, control_ids)
@ -204,8 +225,8 @@ class CSComboProcessor(ComboProcessor):
try:
list=['CRM Lead']#, 'CRM Helpdesk', 'CRM Lead', 'CRM Meeting', 'CRM Opportunity', 'CRM Phonecall']
objlist = conn.GetAllObjects()
if 'crm.claim' in objlist:
list.append('CRM Claim')
# if 'crm.claim' in objlist:
# list.append('CRM Claim')
if 'crm.helpdesk' in objlist:
list.append('CRM Helpdesk')
if 'crm.fundraising' in objlist:
@ -284,4 +305,4 @@ class GroupProcessor(OptionControlProcessor):
def UpdateControl_FromValue(self):
pass
def UpdateValue_FromControl(self):
pass
pass

View File

@ -1,5 +1,30 @@
# Control Processors for our dialog.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import win32gui, win32api, win32con
import commctrl
import struct, array
@ -87,21 +112,6 @@ class RadioButtonProcessor(ControlProcessor):
conn.setitem('protocol', text)
p=conn.getitem('protocol')
# def OnCommand(self, wparam, lparam):
# win32ui.MessageBox("clicked===",'')
# code = win32api.HIWORD(wparam)
# id = win32api.LOWORD(wparam)
# win32ui.MessageBox("clicked===",'')
# if code == win32con.BN_CLICKED:
# win32ui.MessageBox("clicked===",'')
# import win32ui
# conn = self.func()
# win32ui.MessageBox("clicked===",'')
# text=win32gui.GetDlgItemText(self.window.hwnd, self.control_id)
# win32ui.MessageBox("clicked===",'')
# conn.setitem('protocol', text)
# win32ui.MessageBox("clicked==="+text,'')
class CloseButtonProcessor(ButtonProcessor):
def OnClicked(self, id):
win32gui.EndDialog(self.window.hwnd, id)

View File

@ -1,3 +1,7 @@
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# Package that manages and defines dialog resources
def GetImageParamsFromBitmapID(rc_parser, bmpid):

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@ STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_MODALFRAME
CAPTION "OpenERP Configuarion"
FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
DEFPUSHBUTTON "Cancel",ID_DONE,400,239,50,14//,WS_VISIBLE //| WS_TABSTOP
DEFPUSHBUTTON "Close",ID_DONE,400,239,50,14//,WS_VISIBLE //| WS_TABSTOP
CONTROL "",IDC_TAB,"SysTabControl32",0x0,8,7,440,228
CONTROL "",IDC_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_REPORT | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES,0,0,0,0
@ -86,9 +86,9 @@ EXSTYLE WS_EX_CONTEXTHELP
CAPTION "About"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
GROUPBOX "About OpenERP Outlook Plugin",IDC_STATIC,7,3,422,200
GROUPBOX "About Plugin",IDC_STATIC,7,3,422,200
CONTROL 1062,IDB_OPENERPLOGO,"Static",SS_BITMAP | SS_REALSIZEIMAGE,60,30,20,20
LTEXT "",IDC_ABOUT,80,90,250,100
LTEXT "",IDC_ABOUT,80,90,300,100
END
IDD_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 55
@ -108,7 +108,7 @@ END
IDD_SYNC DIALOGEX 0, 0, 470, 320
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Archive to OpenERP"
CAPTION "Push to OpenERP"
FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
GROUPBOX " Link to an Existing Documents ", IDC_STATIC_GROUP, 8,5,250,290,WS_TABSTOP
@ -117,7 +117,7 @@ BEGIN
PUSHBUTTON "Search",ID_SEARCH,187,15,40,14,WS_TABSTOP
LTEXT "Documents : ",IDC_STATIC,15,140,100,14
CONTROL "List1",IDC_NAME_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SHOWSELALWAYS | LVS_REPORT | WS_TABSTOP, 15,150,234,110
PUSHBUTTON "Archive to OpenERP",ID_MAKE_ATTACHMENT,160,270,85,14,WS_TABSTOP
PUSHBUTTON "Push",ID_MAKE_ATTACHMENT,160,270,85,14,WS_TABSTOP
GROUPBOX " Create a Document ", IDC_STATIC_GROUP, 263,5,202,100,WS_TABSTOP
LTEXT "Type of Document : ",IDC_STATIC,266,25,100,12

View File

@ -1,3 +1,26 @@
##############################################################################
#
# 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/>.
#
##############################################################################
#!/usr/bin/python
#-*- encoding: utf-8 -*-
import sys
import chilkat
import os
@ -10,31 +33,20 @@ def generateEML(mail):
body = mail.Body.encode("utf-8")
recipients = mail.Recipients
sender_email = mail.SenderEmailAddress
sender_name = mail.SenderName
sender_name = mail.SenderEmailAddress
attachments=mail.Attachments
# to = mail.To
# cc = mail.CC
# rec_date = mail.ReceivedTime
email = chilkat.CkEmail()
email.put_Subject (ustr(sub).encode('iso-8859-1'))
email.put_Body (ustr(body).encode('utf-8'))
email.put_FromAddress (ustr(sender_email).encode('iso-8859-1'))
email.put_From (ustr(sender_name).encode('iso-8859-1'))
email.put_From (ustr(sender_email).encode('iso-8859-1'))
for i in xrange(1, recipients.Count+1):
name = ustr(recipients.Item(i).Name).encode('iso-8859-1')
address = ustr(recipients.Item(i).Address).encode('iso-8859-1')
email.AddTo(name,address)
# email.AddMultipleTo(to)
# email.AddMultipleCC(cc)
# win32ui.MessageBox("cccc---"+str(dir(cc)),'')
# for i in xrange(1, cc.Count+1):
# name = ustr(recipients.Item(i).Name).encode('iso-8859-1')
# address = ustr(recipients.Item(i).Address).encode('iso-8859-1')
# email.AddCC(name,address)
eml_name= ustr(sub).encode('iso-8859-1')+'-'+str(mail.EntryID)[-9:]
ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n']
mails_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\")
@ -79,5 +91,4 @@ def generateEML(mail):
sys.exit()
print "Saved EML!",eml_path
return eml_path
return eml_path

View File

@ -1,3 +1,28 @@
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import os
import sys
import win32api, win32con
@ -83,6 +108,7 @@ class OpenERPManager:
('Account Invoices','account.invoice',''), ('Accounts','account.account',''), \
('Projects', 'project.project',''),('Sale Orders','sale.order',''), \
('Project Tasks','project.task',''), ('Products', 'product.product', '')]
self.config=self.LoadConfig()
def WorkerThreadStarting(self):

View File

@ -1,376 +1,389 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import xmlrpclib
import sys
import socket
import os
import pythoncom
import time
from manager import ustr
import smtplib
from email.mime.text import MIMEText
from email.parser import*
import email
waittime = 10
wait_count = 0
wait_limit = 12
import binascii
import base64
def execute(connector, method, *args):
global wait_count
res = False
try:
res = getattr(connector,method)(*args)
except socket.error,e:
if e.args[0] == 111:
if wait_count > wait_limit:
print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit)
clean()
sys.exit(1)
print 'Please wait %d sec to start server....'%(waittime)
wait_count += 1
time.sleep(waittime)
res = execute(connector, method, *args)
else:
return res
wait_count = 0
return res
class XMLRpcConn(object):
__name__ = 'XMLRpcConn'
_com_interfaces_ = ['_IDTExtensibility2']
_public_methods_ = ['GetDBList', 'login', 'GetAllObjects', 'GetObjList', 'InsertObj', 'DeleteObject', \
'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \
'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry' ]
_reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
_reg_clsid_ = "{C6399AFD-763A-400F-8191-7F9D0503CAE2}"
_reg_progid_ = "Python.OpenERP.XMLRpcConn"
_reg_policy_spec_ = "win32com.server.policy.EventHandlerPolicy"
def __init__(self,server='localhost',port=8069,uri='http://localhost:8069'):
self._server=server
self._port=port
self._uri=uri
self._obj_list=[]
self._dbname=''
self._uname='admin'
self._pwd='a'
self._login=False
self._running=False
self._uid=False
self._iscrm=True
self.partner_id_list=None
self.protocol=None
def getitem(self, attrib):
v=self.__getattribute__(attrib)
return str(v)
def setitem(self, attrib, value):
return self.__setattr__(attrib, value)
def GetDBList(self):
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/db')
try:
db_list = execute(conn, 'list')
if db_list == False:
self._running=False
return []
else:
self._running=True
except:
db_list=-1
self._running=True
return db_list
def login(self,dbname, user, pwd):
self._dbname = dbname
self._uname = user
self._pwd = pwd
conn = xmlrpclib.ServerProxy(str(self._uri) + '/xmlrpc/common')
uid = execute(conn,'login',dbname, ustr(user), ustr(pwd))
return uid
def GetAllObjects(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[])
objects = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',ids,['model'])
obj_list = [item['model'] for item in objects]
return obj_list
def GetObjList(self):
self._obj_list=list(self._obj_list)
self._obj_list.sort(reverse=True)
return self._obj_list
def InsertObj(self, obj_title,obj_name,image_path):
self._obj_list=list(self._obj_list)
self._obj_list.append((obj_title,obj_name,ustr(image_path)))
self._obj_list.sort(reverse=True)
def DeleteObject(self,sel_text):
self._obj_list=list(self._obj_list)
for obj in self._obj_list:
if obj[0] == sel_text:
self._obj_list.remove(obj)
break
def ArchiveToOpenERP(self, recs, mail):
import win32ui, win32con
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object')
import eml
new_msg = files = ext_msg =""
eml_path=eml.generateEML(mail)
att_name = ustr(eml_path.split('\\')[-1])
flag=False
attachments=mail.Attachments
try:
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Reading Error Mail")
for rec in recs: #[('res.partner', 3, 'Agrolait')]
model = rec[0]
res_id = rec[1]
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
#Reading the Object ir.model Name
ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',mail.EntryID),('model','=',model),('res_id','=',res_id)])
if ext_ids:
name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name']
ext_msg += """This mail is already archived to {1} '{2}'.
""".format(object_name,name)
continue
msg = {
'subject':mail.Subject,
'date':str(mail.ReceivedTime),
'body':mail.Body,
'cc':mail.CC,
'from':mail.SenderEmailAddress,
'to':mail.To,
'message-id':str(new_mail.get('Message-Id')),
'references':str(new_mail.get('References')),
}
result = {}
if attachments:
result = self.MakeAttachment([rec], mail)
attachment_ids = result.get(model, {}).get(res_id, [])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids)
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
flag = True
if flag:
t = ext_msg
t += """Mail archived Successfully with attachments.\n"""+new_msg
win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION)
return flag
def IsCRMInstalled(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','crm.lead')])
return id
def GetPartners(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[])
ids.sort()
obj_list=[]
obj_list.append((-999, ustr('')))
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
return obj_list
def GetObjectItems(self, search_list=[], search_text=''):
import win32ui
res = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
for obj in search_list:
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',obj)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
if obj == "res.partner.address":
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',['|',('name','ilike',ustr(search_text)),('email','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name','street','city'])
for rec in recs:
name = ustr(rec['name'])
if rec['street']:
name += ', ' + ustr(rec['street'])
if rec['city']:
name += ', ' + ustr(rec['city'])
res.append((obj,rec['id'],name,object_name))
else:
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',[('name','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name'])
for rec in recs:
name = ustr(rec['name'])
res.append((obj,rec['id'],name,object_name))
return res
def CreateCase(self, section, mail, partner_ids, with_attachments=True):
res={}
import win32ui
import eml
section=str(section)
partner_ids=eval(str(partner_ids))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
try:
eml_path=eml.generateEML(mail)
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Mail Reading Error")
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(new_mail))
def MakeAttachment(self, recs, mail):
attachments = mail.Attachments
result = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
att_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\attachments\\")
if not os.path.exists(att_folder_path):
os.makedirs(att_folder_path)
for rec in recs: #[('res.partner', 3, 'Agrolait')]
obj = rec[0]
obj_id = rec[1]
res={}
res['res_model'] = obj
attachment_ids = []
if obj not in result:
result[obj] = {}
for i in xrange(1, attachments.Count+1):
fn = ustr(attachments[i].FileName)
if len(fn) > 64:
l = 64 - len(fn)
f = fn.split('.')
fn = f[0][0:l] + '.' + f[-1]
att_path = os.path.join(att_folder_path,fn)
attachments[i].SaveAsFile(att_path)
f=open(att_path,"rb")
content = "".join(f.readlines()).encode('base64')
f.close()
res['name'] = ustr(attachments[i].DisplayName)
res['datas_fname'] = ustr(fn)
res['datas'] = content
res['res_id'] = obj_id
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
attachment_ids.append(id)
result[obj].update({obj_id: attachment_ids})
return result
def CreateContact(self, sel=None, res=None):
res=eval(str(res))
self.partner_id_list=eval(str(self.partner_id_list))
if self.partner_id_list.get(sel,-999) != -999:
res['partner_id'] = self.partner_id_list[sel]
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
def CreatePartner(self, res):
res=eval(str(res))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[('name','=',res['name'])])
if ids:
return False
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','create',res)
return id
def SearchPartnerDetail(self, search_email_id):
import win32ui
res_vals = []
address = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','ilike',ustr(search_email_id))])
if not address_id :
return
address = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','name','street','street2','city','state_id','country_id','phone','mobile','email','fax','zip'])
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
def WritePartnerValues(self, new_vals):
import win32ui
flag = -1
new_dict = dict(new_vals)
email=new_dict['email']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_id:
return flag
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','state_id','country_id'])
vals_res_address={ 'name' : new_dict['name'],
'street':new_dict['street'],
'street2' : new_dict['street2'],
'city' : new_dict['city'],
'phone' : new_dict['phone'],
'mobile' : new_dict['mobile'],
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
}
if new_dict['partner_id'] != -1:
vals_res_address['partner_id'] = new_dict['partner_id']
if new_dict['state_id'] != -1:
vals_res_address['state_id'] = new_dict['state_id']
if new_dict['country_id'] != -1:
vals_res_address['country_id'] = new_dict['country_id']
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
flag=1
else:
flag=0
return flag
def GetAllState(self):
import win32ui
state_list = []
state_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
state_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [])
for state_id in state_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'read', [state_id],['id','name'])[0]
state_list.append((obj['id'], ustr(obj['name'])))
return state_list
def GetAllCountry(self):
import win32ui
country_list = []
country_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
country_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [])
for country_id in country_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0]
country_list.append((obj['id'], ustr(obj['name'])))
return country_list
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import xmlrpclib
import sys
import socket
import os
import pythoncom
import time
from manager import ustr
import email
waittime = 10
wait_count = 0
wait_limit = 12
def execute(connector, method, *args):
global wait_count
res = False
try:
res = getattr(connector,method)(*args)
except socket.error,e:
if e.args[0] == 111:
if wait_count > wait_limit:
print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit)
clean()
sys.exit(1)
print 'Please wait %d sec to start server....'%(waittime)
wait_count += 1
time.sleep(waittime)
res = execute(connector, method, *args)
else:
return res
wait_count = 0
return res
class XMLRpcConn(object):
__name__ = 'XMLRpcConn'
_com_interfaces_ = ['_IDTExtensibility2']
_public_methods_ = ['GetDBList', 'login', 'GetAllObjects', 'GetObjList', 'InsertObj', 'DeleteObject', 'GetCSList', \
'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \
'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry' ]
_reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
_reg_clsid_ = "{C6399AFD-763A-400F-8191-7F9D0503CAE2}"
_reg_progid_ = "Python.OpenERP.XMLRpcConn"
_reg_policy_spec_ = "win32com.server.policy.EventHandlerPolicy"
def __init__(self,server='localhost',port=8069,uri='http://localhost:8069'):
self._server=server
self._port=port
self._uri=uri
self._obj_list=[]
self._dbname=''
self._uname='admin'
self._pwd='a'
self._login=False
self._running=False
self._uid=False
self._iscrm=True
self.partner_id_list=None
self.protocol=None
def getitem(self, attrib):
v=self.__getattribute__(attrib)
return str(v)
def setitem(self, attrib, value):
return self.__setattr__(attrib, value)
def GetDBList(self):
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/db')
try:
db_list = execute(conn, 'list')
if db_list == False:
self._running=False
return []
else:
self._running=True
except:
db_list=-1
self._running=True
return db_list
def login(self,dbname, user, pwd):
self._dbname = dbname
self._uname = user
self._pwd = pwd
conn = xmlrpclib.ServerProxy(str(self._uri) + '/xmlrpc/common')
uid = execute(conn,'login',dbname, ustr(user), ustr(pwd))
return uid
def GetAllObjects(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[])
objects = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',ids,['model'])
obj_list = [item['model'] for item in objects]
return obj_list
def GetObjList(self):
self._obj_list=list(self._obj_list)
self._obj_list.sort(reverse=True)
return self._obj_list
def InsertObj(self, obj_title,obj_name,image_path):
self._obj_list=list(self._obj_list)
self._obj_list.append((obj_title,obj_name,ustr(image_path)))
self._obj_list.sort(reverse=True)
def DeleteObject(self,sel_text):
self._obj_list=list(self._obj_list)
for obj in self._obj_list:
if obj[0] == sel_text:
self._obj_list.remove(obj)
break
def ArchiveToOpenERP(self, recs, mail):
import win32ui, win32con
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object')
import eml
new_msg = files = ext_msg =""
eml_path=eml.generateEML(mail)
att_name = ustr(eml_path.split('\\')[-1])
flag=False
attachments=mail.Attachments
try:
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Reading Error Mail")
for rec in recs: #[('res.partner', 3, 'Agrolait')]
model = rec[0]
res_id = rec[1]
#Check if mailgate installed
object_id = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','mailgate.message')])
if not object_id:
win32ui.MessageBox("Mailgate is not installed on your configured database '%s' !!\n\nPlease install it to archive the mail."%(self._dbname),"Mailgate not installed",win32con.MB_ICONERROR)
return
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
#Reading the Object ir.model Name
ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',mail.EntryID),('model','=',model),('res_id','=',res_id)])
if ext_ids:
name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name']
ext_msg += """This mail is already archived to {1} '{2}'.
""".format(object_name,name)
continue
msg = {
'subject':mail.Subject,
'date':str(mail.ReceivedTime),
'body':mail.Body,
'cc':mail.CC,
'from':mail.SenderEmailAddress,
'to':mail.To,
'message-id':str(new_mail.get('Message-Id')),
'references':str(new_mail.get('References')),
}
result = {}
if attachments:
result = self.MakeAttachment([rec], mail)
attachment_ids = result.get(model, {}).get(res_id, [])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids)
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
flag = True
if flag:
t = ext_msg
t += """Mail archived Successfully with attachments.\n"""+new_msg
win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION)
return flag
def IsCRMInstalled(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','crm.lead')])
return id
def GetCSList(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(int(self._uid)),self._pwd,'crm.case.section','search',[])
objects = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'crm.case.section','read',ids,['name'])
obj_list = [ustr(item['name']).encode('iso-8859-1') for item in objects]
return obj_list
def GetPartners(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[])
if ids:
ids.sort()
obj_list.append((-999, ustr('')))
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
obj_list.sort(lambda x, y: cmp(x[1],y[1]))
return obj_list
def GetObjectItems(self, search_list=[], search_text=''):
import win32ui
res = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
for obj in search_list:
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',obj)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
if obj == "res.partner.address":
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',['|',('name','ilike',ustr(search_text)),('email','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name','street','city'])
for rec in recs:
name = ustr(rec['name'])
if rec['street']:
name += ', ' + ustr(rec['street'])
if rec['city']:
name += ', ' + ustr(rec['city'])
res.append((obj,rec['id'],name,object_name))
else:
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',[('name','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name'])
for rec in recs:
name = ustr(rec['name'])
res.append((obj,rec['id'],name,object_name))
return res
def CreateCase(self, section, mail, partner_ids, with_attachments=True):
res={}
import win32ui
import eml
section=str(section)
partner_ids=eval(str(partner_ids))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
try:
eml_path=eml.generateEML(mail)
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Mail Reading Error")
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(new_mail))
def MakeAttachment(self, recs, mail):
attachments = mail.Attachments
result = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
att_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\attachments\\")
if not os.path.exists(att_folder_path):
os.makedirs(att_folder_path)
for rec in recs: #[('res.partner', 3, 'Agrolait')]
obj = rec[0]
obj_id = rec[1]
res={}
res['res_model'] = obj
attachment_ids = []
if obj not in result:
result[obj] = {}
for i in xrange(1, attachments.Count+1):
fn = ustr(attachments[i].FileName)
if len(fn) > 64:
l = 64 - len(fn)
f = fn.split('.')
fn = f[0][0:l] + '.' + f[-1]
att_path = os.path.join(att_folder_path,fn)
attachments[i].SaveAsFile(att_path)
f=open(att_path,"rb")
content = "".join(f.readlines()).encode('base64')
f.close()
res['name'] = ustr(attachments[i].DisplayName)
res['datas_fname'] = ustr(fn)
res['datas'] = content
res['res_id'] = obj_id
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
attachment_ids.append(id)
result[obj].update({obj_id: attachment_ids})
return result
def CreateContact(self, sel=None, res=None):
res=eval(str(res))
self.partner_id_list=eval(str(self.partner_id_list))
if self.partner_id_list.get(sel,-999) != -999:
res['partner_id'] = self.partner_id_list[sel]
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
def CreatePartner(self, res):
res=eval(str(res))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[('name','=',res['name'])])
if ids:
return False
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','create',res)
return id
def SearchPartnerDetail(self, search_email_id):
import win32ui
res_vals = []
address = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','ilike',ustr(search_email_id))])
if not address_id :
return
address = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','name','street','street2','city','state_id','country_id','phone','mobile','email','fax','zip'])
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
def WritePartnerValues(self, new_vals):
import win32ui
flag = -1
new_dict = dict(new_vals)
email=new_dict['email']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_id:
return flag
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','state_id','country_id'])
vals_res_address={ 'name' : new_dict['name'],
'street':new_dict['street'],
'street2' : new_dict['street2'],
'city' : new_dict['city'],
'phone' : new_dict['phone'],
'mobile' : new_dict['mobile'],
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
}
if new_dict['partner_id'] != -1:
vals_res_address['partner_id'] = new_dict['partner_id']
if new_dict['state_id'] != -1:
vals_res_address['state_id'] = new_dict['state_id']
if new_dict['country_id'] != -1:
vals_res_address['country_id'] = new_dict['country_id']
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
flag=1
else:
flag=0
return flag
def GetAllState(self):
import win32ui
state_list = []
state_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
state_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [])
for state_id in state_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'read', [state_id],['id','name'])[0]
state_list.append((obj['id'], ustr(obj['name'])))
return state_list
def GetAllCountry(self):
import win32ui
country_list = []
country_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
country_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [])
for country_id in country_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0]
country_list.append((obj['id'], ustr(obj['name'])))
return country_list

View File

@ -1,29 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_crm_opportunity_geo_assign_form" model="ir.ui.view">
<field name="name">crm.lead.geo_assign.inherit</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<data>
<xpath expr="//notebook[last()]/page[@string='Assignation']/group[@name='partner_assign_group']" position="after">
<group name="geo_assign_group" col="5" colspan="4">
<separator string="Geo Assignation" colspan="5"/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
<group colspan="1" col="1">
<button string="Geo Assign" name="assign_partner" type="object" colspan="1"
icon="gtk-apply"/>
</group>
</group>
</xpath>
<xpath expr="//notebook[last()]/page[@string='Assignation']/group[@name='partner_assign_group']/field[@name='partner_assigned_id']" position="attributes">
<attribute name="domain">[('partner_weight','&gt;',0)]</attribute>
</xpath>
</data>
</field>
</record>
</data>
</openerp>

View File

@ -1,28 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_crm_partner_geo_form" model="ir.ui.view">
<field name="name">res.partner.geo.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook[last()]" position="inside">
<page string="Geo Localization">
<field name="partner_weight"/>
<label string="" colspan="1"/>
<button
string="Geo Localize"
name="geo_localize"
icon="gtk-apply"
type="object"/>
<newline/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
<field name="date_localization"/>
</page>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -463,18 +463,17 @@
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Restaurant Expenses</field>
<field eval="1" name="hr_expense_ok"/>
<field name="categ_id" ref="product_category_otherproducts0"/>
</record>
<record id="product_product_worker0" model="product.product">
<field name="default_code">WORK</field>
<field name="supply_method">produce</field>
<field name="type">service</field>
<field eval="'make_to_order'" name="procure_method"/>
<field name="default_code">WORK</field>
<field name="supply_method">produce</field>
<field name="type">service</field>
<field eval="'make_to_order'" name="procure_method"/>
<field eval="0" name="sale_ok"/>
<field eval="1" name="purchase_ok"/>
<field name="standard_price">20.0</field>
<field name="standard_price">20.0</field>
<field name="uom_id" ref="uom_hour"/>
<field name="uom_po_id" ref="uom_hour"/>
<field name="name">Worker</field>
@ -486,15 +485,12 @@
<field name="supply_method">buy</field>
<field name="standard_price">10.0</field>
<field eval="0" name="sale_ok"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Rear Panel SHE100</field>
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Rear Panel SHE100</field>
<field eval="5" name="seller_delay"/>
<field name="categ_id" ref="product_category_misc0"/>
</record>
<field name="categ_id" ref="product_category_misc0"/>
</record>
<record id="product_product_rearpanelarm1" model="product.product">
<field name="default_code">RPAN200</field>
@ -504,9 +500,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Rear Panel SHE200</field>
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field eval="5" name="seller_delay"/>
<field name="categ_id" ref="product_category_misc0"/>
</record>
@ -519,9 +512,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Side Panel</field>
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field eval="5" name="seller_delay"/>
<field name="categ_id" ref="product_category_misc0"/>
</record>
@ -534,9 +524,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Rack 100cm</field>
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field eval="8" name="seller_delay"/>
<field name="categ_id" ref="product_category_misc0"/>
</record>
@ -549,9 +536,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Rack 200cm</field>
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field eval="8" name="seller_delay"/>
<field name="categ_id" ref="product_category_misc0"/>
</record>
@ -576,9 +560,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Wood Lintel 4m</field>
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field eval="10" name="seller_delay"/>
<field name="categ_id" ref="product_category_misc0"/>
</record>
@ -590,9 +571,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Metal Cleats</field>
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field eval="20" name="seller_delay"/>
<field name="categ_id" ref="product_category_misc0"/>
</record>
@ -607,7 +585,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="name">Hotel Expenses</field>
<field eval="1" name="hr_expense_ok"/>
<field name="categ_id" ref="product_category_otherproducts0"/>
</record>

View File

@ -3,7 +3,7 @@
-
!python {model: product.product}: |
import netsvc, tools, os
data_dict = {'model': 'product.price_list'}
data_dict = {'model': 'product.product'}
data_dict['form'] = {
'qty1': 1,
'qty2': 5,

View File

@ -140,7 +140,7 @@ class project_scrum_sprint(osv.osv):
if default is None:
default = {}
default.update({'backlog_ids': [], 'meeting_ids': []})
return super(scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
return super(project_scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
def onchange_project_id(self, cr, uid, ids, project_id=False):
v = {}

View File

@ -193,6 +193,48 @@
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="uom_po_id" ref="product.product_uom_unit"/>
</record>
<record id="product.product_product_rearpanelarm0" model="product.product">
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
</record>
<record id="product.product_product_rearpanelarm1" model="product.product">
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
</record>
<record id="product.product_product_sidepanel0" model="product.product">
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
</record>
<record id="product.product_product_shelf0" model="product.product">
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
</record>
<record id="product.product_product_shelf1" model="product.product">
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
</record>
<record id="product.product_product_woodlintelm0" model="product.product">
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
</record>
<record id="product.product_product_metalcleats0" model="product.product">
<field eval="'Public Pricelist (0.00) : 1.00
One-shot customers (0.00) : 1.00
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
</record>
</data>
</openerp>

View File

@ -1460,7 +1460,7 @@ class stock_move(osv.osv):
'create_date': fields.datetime('Creation Date', readonly=True),
'date': fields.datetime('Date Planned', required=True, help="Scheduled date for the movement of the products or real date if the move is done."),
'date_expected': fields.datetime('Date Expected', readonly=True,required=True, help="Scheduled date for the movement of the products"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')]),
'product_qty': fields.float('Quantity', required=True),
'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True),

View File

@ -13,7 +13,7 @@
<hbox>
<description>&name.value;</description>
<spacer width="50"/>
<textbox id="txtname" align="right" />
<textbox id="txtselectpartner" align="right" />
</hbox>
</groupbox>
<description></description>

View File

@ -38,7 +38,7 @@
<toolbarbutton id="GA-button"
class="toolbarbutton-1"
image="&menuicon.value;"
label= "Archive To OpenERP"
label= "Push To OpenERP"
oncommand="searchmail();" />
</toolbarpalette>

View File

@ -3,7 +3,7 @@
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/plugin.dtd">
<window id="pluginwindows" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&title.label;" onload="myPrefObserver.loaddata()" height="600" width="1000">
title="&title.label;" onload="myPrefObserver.loaddata()" height="650" width="1000">
<script type="text/javascript" src="chrome://openerp_plugin/content/tiny_xmlrpc.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/config.js"></script>
@ -12,17 +12,22 @@
<script type="text/javascript" src="chrome://openerp_plugin/content/overlay.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/exportTools.js"></script>
<description></description>
<hbox id="root">
<vbox width="50%" style="padding:12px;">
<caption label="&gptinyobj.label;" />
<groupbox height="375" id="existsobjectgroup" width="100%" style="border:1px solid black">
<separator class="groove-thin" orient="horizontal" width="1000"/>
<hbox>
<hbox id="root" height="10" width="800" style="padding:12px;border:1px solid black">
<caption label="&title.label;" />
</hbox>
<hbox id="root1" height="380" width="800" style="padding:12px;border:1px solid black">
<vbox>
<caption label="&gptinyobj.label;" />
<groupbox id="existsobjectgroup" width="400" style="border:1px solid black">
<separator class="groove-thin" orient="horizontal" width="400"/>
<hbox>
<label id="lblsearch" control="txtvalueobj" value="&search.label;"/>
<textbox id="txtvalueobj" size="30"/>
<button label="&bsearch.label;" oncommand="searchCheckbox()" image="&imagesearch.value;" accesskey="s"/>
</hbox>
<vbox align="left" id="checkbox-dynamic" >
<vbox align="left" id="checkbox-dynamic" >
</vbox>
<hbox align="left">
<image src='chrome://openerp_plugin/skin/perform.gif'/>
@ -30,12 +35,11 @@
</hbox>
<hbox>
<description>Documents</description>
<caption label="&document.label;" />
</hbox>
<vbox>
<hbox height="250" width="100%">
<listbox height="250" width="480" id="listSearchBox" seltype="multiple">
<listbox height="250" width="100%" id="listSearchBox" style="border:1px solid red" seltype="multiple">
<listhead>
<listheader label="&listSearchBox.header;"/>
</listhead>
@ -43,21 +47,21 @@
<listcol flex="1"/>
</listcols>
</listbox>
</hbox>
</vbox>
<separator class="groove-thin" orient="horizontal" width="1000"/>
<hbox align="right">
<hbox align="right" width="480">
<button label="&attach.label;" accesskey="u" image="&imagearchive.value;" oncommand="attachmentWidnowOpen('upload');"/>
</hbox>
<separator class="groove-thin" orient="horizontal" width="1000"/>
<separator class="groove-thin" orient="horizontal" width="480"/>
</groupbox>
</vbox>
<vbox width="50%" align="left" style="padding:12px;" >
<caption label="&newobject.label;" />
<groupbox id="newobjectgroup" align="left" width="100%" height="440" style="border:1px solid black;">
<separator class="groove-thin" orient="horizontal" width="1000"/>
<hbox align="left">
<vbox>
<caption label="&newobject.label;" />
<groupbox id="newobjectgroup" width="400" align="left" style="border:1px solid black;">
<separator class="groove-thin" orient="horizontal" width="400"/>
<hbox align="left">
<vbox>
<label id="lblex3" align="right" width="135" control="section" value="&object.label;"/>
</vbox>
@ -82,14 +86,14 @@
<vbox>
<button label="&create.label;" image="&imagecreate.value;" oncommand="Create.onMenuItemCommand(event);"/>
</vbox>
</hbox>
</hbox>
<separator class="groove-thin" orient="horizontal" width="480"/>
</groupbox>
<separator class="groove-thin" orient="horizontal" width="1000"/>
<hbox align="right" width="1000">
<button label="&close.label;" accesskey="l" image="&imagecancel.value;" oncommand="win_close();"/>
</hbox>
</vbox>
</vbox>
</hbox>
<hbox height="60" align="right" width="800">
<button label="&close.label;" accesskey="l" image="&imagecancel.value;" oncommand="win_close();"/>
</hbox>
</window>

View File

@ -1329,9 +1329,7 @@ var listPartnerHandler = {
listItem.value = arrPartnerList[i][0];
cmdPartnerList.appendChild(listItem);
}
}
},
onFault: function (client, ctxt, fault) {
@ -1873,7 +1871,10 @@ var listCreatePartnerHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var createId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
setPartnerId(createId);
txtselectpartner = document.getElementById('txtselectpartner')
if(typeof(createId.data) == 'number' && createId!=0){
window.opener.document.getElementById('txtselectpartner').setAttribute('value',txtselectpartner.value);
window.close();
}
if(createId == 0){
@ -1891,6 +1892,7 @@ var listCreatePartnerHandler = {
//function to create the tiny partner object
function createPartner(){
var branchobj = getPref();
txtselectpartner = document.getElementById('txtselectpartner')
setServerService('xmlrpc/object');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var xmlRpcClient = getXmlRpc();
@ -1904,12 +1906,13 @@ function createPartner(){
strmethod.data = 'create_partner';
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strobj.data = 'thunderbird.partner';
if(document.getElementById('txtname').value ==''){
if(document.getElementById('txtselectpartner').value ==''){
alert("You Must Enter Partner Name.");
return false;
}
var a = ['name'];
var b = [document.getElementById('txtname').value];
setPartnerId(txtselectpartner.value)
var a = ['partner_id','name'];
var b = [getPartnerId(),txtselectpartner.value];
var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listCreatePartnerHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
}

View File

@ -1,6 +1,6 @@
<!ENTITY tinyplugin "OpenERP Configuration">
<!ENTITY tinypluginconfig "Archieve To OpenERP">
<!ENTITY tinyarchive "Archive to OpenERP">
<!ENTITY tinypluginconfig "Push To OpenERP">
<!ENTITY tinyarchive "Push to OpenERP">
<!ENTITY imageicon.value "chrome://openerp_plugin/skin/NEWT1.png">
<!ENTITY menuicon.value "chrome://openerp_plugin/skin/openerp-icon.png">
<!ENTITY partnericon.value "chrome://openerp_plugin/skin/partner.png">

View File

@ -1,9 +1,10 @@
<!ENTITY title.label "Archive To OpenERP">
<!ENTITY title.label "Push To OpenERP">
<!ENTITY gptinyobj.label "Link to an Existing Document">
<!ENTITY newobject.label "New Documents">
<!ENTITY document.label "Documents">
<!ENTITY bsearch.label "Search">
<!ENTITY close.label "Close">
<!ENTITY attach.label "Archive to OpenERP">
<!ENTITY attach.label "Push">
<!ENTITY create.label "New Contact">
<!ENTITY archive.label "Create">
<!ENTITY attach.label "Attach">