[MERGE] staging branch with misc fixes

bzr revid: qdp-launchpad@openerp.com-20121218152005-a1gahm72g6wylrg3
This commit is contained in:
Quentin (OpenERP) 2012-12-18 16:20:05 +01:00
commit 0e77d66989
11 changed files with 108 additions and 30 deletions

View File

@ -577,7 +577,7 @@
<field name="date"/>
<field name="name"/>
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>

View File

@ -109,20 +109,19 @@ class account_analytic_account(osv.osv):
return res
def open_hr_expense(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
dummy, act_window_id = mod_obj.get_object_reference(cr, uid, 'hr_expense', 'expense_all')
result = act_obj.read(cr, uid, act_window_id, context=context)
line_ids = self.pool.get('hr.expense.line').search(cr,uid,[('analytic_account', 'in', ids)])
domain = [('line_ids', 'in', line_ids)]
names = [record.name for record in self.browse(cr, uid, ids, context=context)]
name = _('Expenses of %s') % ','.join(names)
return {
'type': 'ir.actions.act_window',
'name': name,
'view_type': 'form',
'view_mode': 'tree,form',
'context':{'analytic_account':ids[0]},
'domain' : domain,
'res_model': 'hr.expense.expense',
'nodestroy': True,
}
result['domain'] = [('line_ids', 'in', line_ids)]
names = [account.name for account in self.browse(cr, uid, ids, context=context)]
result['name'] = _('Expenses of %s') % ','.join(names)
result['context'] = {'analytic_account': ids[0]}
result['view_type'] = 'form'
return result
def hr_to_invoice_expense(self, cr, uid, ids, context=None):
domain = [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'purchase'), ('account_id', 'in', ids)]

View File

@ -71,4 +71,21 @@
<field name="alias_defaults">{'type':'lead'}</field>
</record>
</data>
<!-- Mail template is done in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<!--Definition of an email template with an empty body that will be used in opportunity mailing. Used to give a
basis for email recipients, name and to ease the definition of a further elaborated template. -->
<record id="email_template_opportunity_mail" model="email.template">
<field name="name">Opportunity - Send Emails</field>
<field name="email_from">${object.user_id.email or ''}</field>
<field name="subject">Opportunity ${object.name | h})</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="auto_delete" eval="True"/>
<field name="email_recipients">${object.partner_id.id}</field>
<field name="body_html"></field>
</record>
</data>
</openerp>

View File

@ -920,6 +920,41 @@ class crm_lead(base_stage, format_address, osv.osv):
vals['message_follower_ids'] += [(4, follower.id) for follower in section_id.message_follower_ids]
return super(crm_lead,self).write(cr, uid, ids, vals, context)
def new_mail_send(self, cr, uid, ids, context=None):
'''
This function opens a window to compose an email, with the edi sale template message loaded by default
'''
assert len(ids) == 1, 'This option should only be used for a single id at a time.'
ir_model_data = self.pool.get('ir.model.data')
try:
template_id = ir_model_data.get_object_reference(cr, uid, 'crm', 'email_template_opportunity_mail')[1]
except ValueError:
template_id = False
try:
compose_form_id = ir_model_data.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')[1]
except ValueError:
compose_form_id = False
if context is None:
context = {}
ctx = context.copy()
ctx.update({
'default_model': 'crm.lead',
'default_res_id': ids[0],
'default_use_template': bool(template_id),
'default_template_id': template_id,
'default_composition_mode': 'comment',
})
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(compose_form_id, 'form')],
'view_id': compose_form_id,
'target': 'new',
'context': ctx,
}
# ----------------------------------------
# Mail Gateway
# ----------------------------------------

View File

@ -173,18 +173,19 @@
</page>
<page string="Extra Info">
<group>
<group string="Categorization">
<group string="Categorization" groups="base.group_multi_company,base.group_no_one" name="categorization">
<field name="company_id"
groups="base.group_multi_company"
widget="selection" colspan="2"/>
<field name="type_id"/>
<field name="channel_id" widget="selection"/>
<field name="referred"/>
<field name="state" groups="base.group_no_one"/>
</group>
<group string="Mailings">
<field name="opt_out"/>
</group>
<group string="Misc">
<field name="active"/>
<field name="referred"/>
</group>
</group>
</page>
</notebook>
@ -370,6 +371,7 @@
states="draft,open,pending" class="oe_highlight"/>
<button name="case_mark_lost" string="Mark Lost" type="object"
states="draft,open" class="oe_highlight"/>
<button name="new_mail_send" string="Send Mail" type="object" states="draft,open,pending"/>
<field name="stage_id" widget="statusbar" clickable="True"/>
</header>
<sheet>
@ -463,12 +465,7 @@
<field name="mobile"/>
<field name="fax"/>
</group>
<group string="Categorization">
<field name="type_id" />
<field name="channel_id" widget="selection"/>
</group>
<group string="Mailings">
<group string="Mailings" name="mailings">
<field name="opt_out"/>
</group>
<group string="Misc">

View File

@ -58,15 +58,16 @@
<record id="view_expenses_form" model="ir.ui.view">
<field name="name">hr.expense.form</field>
<field name="model">hr.expense.expense</field>
<field eval="25" name="priority"/>
<field name="arch" type="xml">
<form string="Expenses Sheet" version="7.0">
<header>
<button name="confirm" states="draft" string="Submit to Manager" type="workflow" class="oe_highlight"/>
<button name="validate" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
<button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
<button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
<button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/>
<button name="action_view_receipt" states="done" string="Open Receipt" type="object"/>
<button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
</header>
<sheet>

View File

@ -33,6 +33,7 @@ class lunch_order(osv.Model):
"""
_name = 'lunch.order'
_description = 'Lunch Order'
_order = 'date desc'
def _price_get(self, cr, uid, ids, name, arg, context=None):
"""

View File

@ -23,7 +23,7 @@
{
'name': 'Marketing',
'version': '1.1',
'depends': ['base', 'base_setup'],
'depends': ['base', 'base_setup', 'crm'],
'author': 'OpenERP SA',
'category': 'Hidden/Dependency',
'description': """

View File

@ -7,6 +7,32 @@
id="base.marketing_menu"
groups="marketing.group_marketing_user,marketing.group_marketing_manager"
sequence="85"/>
<record id="view_crm_lead_form" model="ir.ui.view">
<field name="name">crm.lead.inherit.form</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='categorization']" position="attributes">
<attribute name="string">Marketing</attribute>
</xpath>
<xpath expr="//field[@name='company_id']" position="after">
<field name="type_id"/>
<field name="channel_id" widget="selection"/>
</xpath>
</field>
</record>
<record id="view_crm_opportunity_form" model="ir.ui.view">
<field name="name">crm.lead.inherit.form</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='mailings']" position="before">
<group string="Marketing">
<field name="type_id" />
<field name="channel_id" widget="selection"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -19,7 +19,7 @@
#
##############################################################################
from openerp.osv import osv
from openerp.osv import osv, fields
from openerp.tools.translate import _
from openerp import netsvc
@ -72,7 +72,8 @@ class sale_order_line_make_invoice(osv.osv_memory):
'payment_term': pay_term,
'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id,
'user_id': order.user_id and order.user_id.id or False,
'company_id': order.company_id and order.company_id.id or False
'company_id': order.company_id and order.company_id.id or False,
'date_invoice': fields.date.today(),
}
inv_id = self.pool.get('account.invoice').create(cr, uid, inv)
return inv_id

View File

@ -30,7 +30,8 @@ class sale_make_invoice(osv.osv_memory):
'invoice_date': fields.date('Invoice Date'),
}
_defaults = {
'grouped': False
'grouped': False,
'invoice_date': fields.date.context_today,
}
def view_init(self, cr, uid, fields_list, context=None):