[MERGE] Merge with main branch

bzr revid: mra@tinyerp.com-20100429083619-8r0pkxtjsnqcrb1f
This commit is contained in:
mra (Open ERP) 2010-04-29 14:06:19 +05:30
commit a3e5ebbbb5
172 changed files with 233 additions and 58 deletions

View File

@ -29,69 +29,15 @@ import tools
from tools import config
class account_analytic_line(osv.osv):
_name = 'account.analytic.line'
_inherit = 'account.analytic.line'
_description = 'Analytic lines'
def _amount_currency(self, cr, uid, ids, field_name, arg, context={}):
result = {}
for rec in self.browse(cr, uid, ids, context):
cmp_cur_id=rec.company_id.currency_id.id
aa_cur_id=rec.account_id.currency_id.id
# Always provide the amount in currency
if cmp_cur_id != aa_cur_id:
cur_obj = self.pool.get('res.currency')
ctx = {}
if rec.date and rec.amount:
ctx['date'] = rec.date
result[rec.id] = cur_obj.compute(cr, uid, rec.company_id.currency_id.id,
rec.account_id.currency_id.id, rec.amount,
context=ctx)
else:
result[rec.id]=rec.amount
return result
def _get_account_currency(self, cr, uid, ids, field_name, arg, context={}):
result = {}
for rec in self.browse(cr, uid, ids, context):
# Always provide second currency
result[rec.id] = (rec.account_id.currency_id.id,rec.account_id.currency_id.code)
return result
def _get_account_line(self, cr, uid, ids, context={}):
aac_ids = {}
for acc in self.pool.get('account.analytic.account').browse(cr, uid, ids):
aac_ids[acc.id] = True
aal_ids = []
if aac_ids:
aal_ids = self.pool.get('account.analytic.line').search(cr, uid, [('account_id','in',aac_ids.keys())], context=context)
return aal_ids
_columns = {
'name' : fields.char('Description', size=256, required=True),
'date' : fields.date('Date', required=True),
'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price.'),
'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'),
'product_uom_id' : fields.many2one('product.uom', 'UoM'),
'product_id' : fields.many2one('product.product', 'Product'),
'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True),
'general_account_id' : fields.many2one('account.account', 'General Account', required=True, ondelete='cascade'),
'move_id' : fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True),
'journal_id' : fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='cascade', select=True),
'code' : fields.char('Code', size=8),
'user_id' : fields.many2one('res.users', 'User',),
'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Account currency',
store={
'account.analytic.account': (_get_account_line, ['company_id'], 50),
'account.analytic.line': (lambda self,cr,uid,ids,c={}: ids, ['amount','unit_amount'],10),
},
help="The related account currency if not equal to the company one."),
'company_id': fields.many2one('res.company','Company',required=True),
'amount_currency': fields.function(_amount_currency, method=True, digits_compute= dp.get_precision('Account'), string='Amount currency',
store={
'account.analytic.account': (_get_account_line, ['company_id'], 50),
'account.analytic.line': (lambda self,cr,uid,ids,c={}: ids, ['amount','unit_amount'],10),
},
help="The amount expressed in the related account currency if not equal to the company one."),
'ref': fields.char('Ref.', size=64),
}
_defaults = {

0
addons/account/process/customer_invoice_process.xml Executable file → Normal file
View File

0
addons/account/process/statement_process.xml Executable file → Normal file
View File

0
addons/account/process/supplier_invoice_process.xml Executable file → Normal file
View File

0
addons/account/report/account_balance_landscape.py Executable file → Normal file
View File

0
addons/account/report/compare_account_balance.py Executable file → Normal file
View File

0
addons/account/report/partner_balance.py Executable file → Normal file
View File

0
addons/account/wizard/account_aged_trial_balance.py Executable file → Normal file
View File

View File

0
addons/account/wizard/account_third_party_ledger.py Executable file → Normal file
View File

0
addons/account/wizard/account_vat.py Executable file → Normal file
View File

0
addons/account_report/account_report.xml Executable file → Normal file
View File

0
addons/account_voucher/__init__.py Executable file → Normal file
View File

0
addons/account_voucher/__openerp__.py Executable file → Normal file
View File

0
addons/account_voucher/account_report.xml Executable file → Normal file
View File

0
addons/account_voucher/account_view.xml Executable file → Normal file
View File

0
addons/account_voucher/report/__init__.py Executable file → Normal file
View File

0
addons/account_voucher/report/report_voucher.py Executable file → Normal file
View File

0
addons/account_voucher/report/report_voucher_amount.py Executable file → Normal file
View File

0
addons/account_voucher/report/rml_parse.py Executable file → Normal file
View File

0
addons/account_voucher/voucher.py Executable file → Normal file
View File

0
addons/account_voucher/voucher_view.xml Executable file → Normal file
View File

View File

@ -22,8 +22,8 @@
import time
import operator
from osv import fields
from osv import osv
from osv import fields, osv
import decimal_precision as dp
#
# Object definition
@ -282,3 +282,70 @@ class account_analytic_account(osv.osv):
account_analytic_account()
class account_analytic_line(osv.osv):
_name = 'account.analytic.line'
_description = 'Analytic lines'
def _amount_currency(self, cr, uid, ids, field_name, arg, context={}):
result = {}
for rec in self.browse(cr, uid, ids, context):
cmp_cur_id=rec.company_id.currency_id.id
aa_cur_id=rec.account_id.currency_id.id
# Always provide the amount in currency
if cmp_cur_id != aa_cur_id:
cur_obj = self.pool.get('res.currency')
ctx = {}
if rec.date and rec.amount:
ctx['date'] = rec.date
result[rec.id] = cur_obj.compute(cr, uid, rec.company_id.currency_id.id,
rec.account_id.currency_id.id, rec.amount,
context=ctx)
else:
result[rec.id]=rec.amount
return result
def _get_account_currency(self, cr, uid, ids, field_name, arg, context={}):
result = {}
for rec in self.browse(cr, uid, ids, context):
# Always provide second currency
result[rec.id] = (rec.account_id.currency_id.id,rec.account_id.currency_id.code)
return result
def _get_account_line(self, cr, uid, ids, context={}):
aac_ids = {}
for acc in self.pool.get('account.analytic.account').browse(cr, uid, ids):
aac_ids[acc.id] = True
aal_ids = []
if aac_ids:
aal_ids = self.pool.get('account.analytic.line').search(cr, uid, [('account_id','in',aac_ids.keys())], context=context)
return aal_ids
_columns = {
'name' : fields.char('Description', size=256, required=True),
'date' : fields.date('Date', required=True),
'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price.'),
'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'),
'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True),
'user_id' : fields.many2one('res.users', 'User',),
'company_id': fields.many2one('res.company','Company',required=True),
'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Account currency',
store={
'account.analytic.account': (_get_account_line, ['company_id'], 50),
'account.analytic.line': (lambda self,cr,uid,ids,c={}: ids, ['amount','unit_amount'],10),
},
help="The related account currency if not equal to the company one."),
'amount_currency': fields.function(_amount_currency, method=True, digits_compute= dp.get_precision('Account'), string='Amount currency',
store={
'account.analytic.account': (_get_account_line, ['company_id'], 50),
'account.analytic.line': (lambda self,cr,uid,ids,c={}: ids, ['amount','unit_amount'],10),
},
help="The amount expressed in the related account currency if not equal to the company one."),
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', c),
}
_order = 'date'
account_analytic_line()

0
addons/base_calendar/__init__.py Executable file → Normal file
View File

0
addons/base_calendar/__openerp__.py Executable file → Normal file
View File

0
addons/base_calendar/base_calendar_data.xml Executable file → Normal file
View File

0
addons/base_calendar/base_calendar_view.xml Executable file → Normal file
View File

0
addons/base_calendar/wizard/__init__.py Executable file → Normal file
View File

View File

0
addons/base_calendar/wizard/calendar_event_edit_all.py Executable file → Normal file
View File

View File

0
addons/base_contact/process/base_contact_process.xml Executable file → Normal file
View File

0
addons/caldav/DAV/davcopy.py Executable file → Normal file
View File

0
addons/caldav/DAV/davmove.py Executable file → Normal file
View File

0
addons/caldav/DAV/delete.py Executable file → Normal file
View File

0
addons/caldav/DAV/errors.py Executable file → Normal file
View File

0
addons/caldav/DAV/propfind.py Executable file → Normal file
View File

0
addons/caldav/DAV/utils.py Executable file → Normal file
View File

0
addons/caldav/wizard/__init__.py Executable file → Normal file
View File

View File

@ -190,10 +190,13 @@
<field name="date"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
<button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.opportunity'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"
name="%(crm_opportunity_forward_to_partner_act)d"
icon="gtk-go-forward" type="action" />
</page>
</notebook>
</form>

0
addons/crm/process/crm_configuration_process.xml Executable file → Normal file
View File

View File

@ -157,4 +157,129 @@ class crm_lead_forward_to_partner(osv.osv_memory):
return res
crm_lead_forward_to_partner()
class crm_opportunity_forward_to_partner(osv.osv_memory):
_name = 'crm.opportunity.forward.to.partner'
_columns = {
'partner_id' : fields.many2one('res.partner', 'Partner'),
'address_id' : fields.many2one('res.partner.address', 'Address'),
'email_from' : fields.char('From', required=True, size=128),
'email_to' : fields.char('To', required=True, size=128),
'subject' : fields.char('Subject', required=True, size=128),
'message' : fields.text('Message', required=True),
}
def on_change_partner(self, cr, uid, ids, partner_id):
return {
'domain' : {
'address_id' : partner_id and "[('partner_id', '=', partner_id)]" or "[]",
}
}
def on_change_address(self, cr, uid, ids, address_id):
email = ''
if address_id:
email = self.pool.get('res.partner.address').browse(cr, uid, address_id).email
return {
'value' : {
'email_to' : email,
}
}
def action_cancel(self, cr, uid, ids, context=None):
return {'type' : 'ir.actions.act_window_close'}
def action_forward(self, cr, uid, ids, context=None):
"""
Forward the opportunity to a partner
"""
if context is None:
context = {}
res_id = context.get('active_id', False)
if not res_id:
return {}
this = self.browse(cr, uid, ids[0], context=context)
hist_obj = self.pool.get('crm.case.history')
smtp_pool = self.pool.get('email.smtpclient')
case_pool = self.pool.get('crm.opportunity')
case = case_pool.browse(cr, uid, res_id, context=context)
emails = [this.email_to]
body = case_pool.format_body(this.message)
email_from = this.email_from or False
case_pool._history(cr, uid, [case], _('Forward'), history=True, email=this.email_to, details=body, email_from=email_from)
flag = False
if case.section_id and case.section_id.server_id:
flag = smtp_pool.send_email(
cr=cr,
uid=uid,
server_id=case.section_id.server_id.id,
emailto=emails,
subject=this.subject,
body="<pre>%s</pre>" % body,
)
else:
flag = tools.email_send(
email_from,
emails,
this.subject,
body,
)
return {}
def default_get(self, cr, uid, fields, context=None):
"""
This function gets default values
"""
if context is None:
context = {}
active_ids = context.get('active_ids')
if not active_ids:
return {}
opportunity_proxy = self.pool.get('crm.opportunity')
opportunity = opportunity_proxy.browse(cr, uid, active_ids[0], context=context)
pa = opportunity.partner_address_id
message = [
"Partner: %s" % (opportunity.partner_id.name_get()[0][1]),
"Contact: %s" % (pa.name),
"Title: %s" % (pa.title),
"Function: %s" % (pa.function and pa.function.name_get()[0][1] or ''),
"Street: %s" % (pa.street),
"Street2: %s" % (pa.street2),
"Zip: %s" % (pa.zip),
"City: %s" % (pa.city),
"Country: %s" % (pa.country_id and pa.country_id.name_get()[0][1] or ''),
"State: %s" % (pa.state_id and pa.state_id.name_get()[0][1] or ''),
"Email: %s" % (pa.email),
"Phone: %s" % (pa.phone),
"Fax: %s" % (pa.fax),
"Mobile: %s" % (pa.mobile),
]
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
email_from = ''
if user.address_id and user.address_id.email:
email_from = "%s <%s>" % (user.name, user.address_id.email)
res = {
'email_from' : email_from,
'subject' : '[Opportunity-Forward:%06d] %s' % (opportunity.id, opportunity.name),
'message' : "\n".join(message + ['---']),
}
return res
crm_opportunity_forward_to_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -34,5 +34,39 @@
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.ui.view" id="crm_opportunity_forward_to_partner_form">
<field name="name">crm_opportunity_forward_to_partner</field>
<field name="model">crm.opportunity.forward.to.partner</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Forward to Partner">
<separator string="User" colspan="4" />
<field name="email_from" colspan="4" />
<separator string="Destination" colspan="4" />
<field name="partner_id" on_change="on_change_partner(partner_id)" colspan="4" />
<field name="address_id" string="Contact" on_change="on_change_address(address_id)" colspan="4" />
<field name="email_to" colspan="4" />
<separator string="Email" colspan="4" />
<field name="subject" colspan="4" />
<field name="message" colspan="4" />
<separator string="" colspan="4" />
<group colspan="4" col="2">
<button name="action_cancel" special="cancel" string="Cancel" icon="gtk-cancel" type="object" />
<button name="action_forward" string="Forward" icon="gtk-go-forward" type="object" />
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="crm_opportunity_forward_to_partner_act">
<field name="name">Forward to Partner</field>
<field name="res_model">crm.opportunity.forward.to.partner</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

0
addons/document/test_cindex.py Executable file → Normal file
View File

0
addons/document_webdav/DAV/davcopy.py Executable file → Normal file
View File

0
addons/document_webdav/DAV/davmove.py Executable file → Normal file
View File

0
addons/document_webdav/DAV/delete.py Executable file → Normal file
View File

0
addons/document_webdav/DAV/errors.py Executable file → Normal file
View File

0
addons/document_webdav/DAV/propfind.py Executable file → Normal file
View File

0
addons/document_webdav/DAV/utils.py Executable file → Normal file
View File

0
addons/hr/hr.py Executable file → Normal file
View File

0
addons/hr/process/hr_process.xml Executable file → Normal file
View File

0
addons/hr_expense/process/hr_expense_process.xml Executable file → Normal file
View File

0
addons/hr_holidays/hr_holidays.py Executable file → Normal file
View File

0
addons/hr_holidays/process/hr_holidays_process.xml Executable file → Normal file
View File

0
addons/hr_timesheet/process/hr_timesheet_process.xml Executable file → Normal file
View File

View File

0
addons/l10n_ch/__init__.py Executable file → Normal file
View File

0
addons/l10n_ch/__openerp__.py Executable file → Normal file
View File

0
addons/l10n_ch/account_invoice.xml Executable file → Normal file
View File

0
addons/l10n_ch/account_journal_view.xml Executable file → Normal file
View File

0
addons/l10n_ch/account_move_line.py Executable file → Normal file
View File

0
addons/l10n_ch/bank.py Executable file → Normal file
View File

0
addons/l10n_ch/bank_ch.xml Executable file → Normal file
View File

0
addons/l10n_ch/bank_view.xml Executable file → Normal file
View File

0
addons/l10n_ch/bvr_report.xml Executable file → Normal file
View File

0
addons/l10n_ch/bvr_view.xml Executable file → Normal file
View File

0
addons/l10n_ch/bvr_wizard.xml Executable file → Normal file
View File

0
addons/l10n_ch/company.py Executable file → Normal file
View File

0
addons/l10n_ch/company_view.xml Executable file → Normal file
View File

0
addons/l10n_ch/demo/dta_demo.xml Executable file → Normal file
View File

0
addons/l10n_ch/demo/vaudtax_data_demo.xml Executable file → Normal file
View File

0
addons/l10n_ch/dta.py Executable file → Normal file
View File

0
addons/l10n_ch/dta_data.xml Executable file → Normal file
View File

0
addons/l10n_ch/dta_view.xml Executable file → Normal file
View File

0
addons/l10n_ch/dta_wizard.xml Executable file → Normal file
View File

0
addons/l10n_ch/invoice.py Executable file → Normal file
View File

0
addons/l10n_ch/partner.py Executable file → Normal file
View File

0
addons/l10n_ch/payment.py Executable file → Normal file
View File

0
addons/l10n_ch/report/__init__.py Executable file → Normal file
View File

0
addons/l10n_ch/report/bvr.py Executable file → Normal file
View File

0
addons/l10n_ch/vaudtax_data.xml Executable file → Normal file
View File

0
addons/l10n_ch/wizard/__init__.py Executable file → Normal file
View File

0
addons/l10n_ch/wizard/bvr_import.py Executable file → Normal file
View File

0
addons/l10n_ch/wizard/dta_wizard.py Executable file → Normal file
View File

0
addons/l10n_ch/wizard/journal_config.py Executable file → Normal file
View File

0
addons/l10n_ch/wizard/wizard_bvr.py Executable file → Normal file
View File

0
addons/l10n_ch/zip_code_default.xml Executable file → Normal file
View File

0
addons/l10n_ch_chart_c2c_pcg/tax_template_view.xml Executable file → Normal file
View File

0
addons/l10n_ch_chart_c2c_pcg/vat.xml Executable file → Normal file
View File

0
addons/l10n_ch_chart_c2c_pcg/wizard.xml Executable file → Normal file
View File

0
addons/l10n_ch_chart_c2c_pcg/wizard/__init__.py Executable file → Normal file
View File

0
addons/l10n_ch_chart_c2c_pcg/wizard/config.py Executable file → Normal file
View File

0
addons/l10n_chart_uk_minimal/account_chart.xml Executable file → Normal file
View File

0
addons/l10n_chart_uk_minimal/account_tax.xml Executable file → Normal file
View File

0
addons/membership/process/membership_process.xml Executable file → Normal file
View File

0
addons/mrp/process/procurement_process.xml Executable file → Normal file
View File

0
addons/mrp_operations/report/__init__.py Executable file → Normal file
View File

0
addons/mrp_operations/report/mrp_code_barcode.py Executable file → Normal file
View File

0
addons/mrp_operations/report/mrp_wc_barcode.py Executable file → Normal file
View File

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