[MERGE] Merge from main addons

bzr revid: mra@tinyerp.com-20120823112104-5d4bx6cypst26zr0
bzr revid: mra@tinyerp.com-20120824064641-7jn10i1ykbndaywr
This commit is contained in:
Mustufa Rangwala (OpenERP) 2012-08-24 12:16:41 +05:30
commit 7902111733
23 changed files with 153 additions and 107 deletions

View File

@ -582,6 +582,8 @@ class account_account(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
if isinstance(ids, (int, long)):
ids = [ids]
reads = self.read(cr, uid, ids, ['name', 'code'], context=context)
res = []
for record in reads:

View File

@ -1127,7 +1127,7 @@ class account_invoice(osv.osv):
return map(lambda x: (0,0,x), lines)
def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None):
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id'])
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id', 'company_id'])
obj_invoice_line = self.pool.get('account.invoice.line')
obj_invoice_tax = self.pool.get('account.invoice.tax')
obj_journal = self.pool.get('account.journal')
@ -1175,7 +1175,7 @@ class account_invoice(osv.osv):
'name': description,
})
# take the id part of the tuple returned for many2one fields
for field in ('partner_id',
for field in ('partner_id', 'company_id',
'account_id', 'currency_id', 'payment_term', 'journal_id'):
invoice[field] = invoice[field] and invoice[field][0]
# create the new invoice

View File

@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<openerp>
<data noupdate="1">
<data>
<!-- FIELD LIST -->
@ -76,7 +76,7 @@
</field>
</record>
<!-- ACTION -->
<!-- ACTION -->
<record model="ir.actions.act_window" id="action_ir_model_fields_anonymize_wizard">
<field name="name">Anonymize Database</field>
@ -163,4 +163,3 @@
</data>
</openerp>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<data>
<record id="view_base_report_sxw" model="ir.ui.view">
<field name="name">Base Report sxw</field>
<field name="model">base.report.sxw</field>
@ -17,7 +18,7 @@
</footer>
</form>
</field>
</record>
</record>
<record id="action_view_base_report_sxw" model="ir.actions.act_window">
<field name="name">Base Report sxw</field>
@ -43,7 +44,8 @@
<label colspan="4" string="This is the template of your requested report.&#10;Save it as a .SXW file and open it with OpenOffice.&#10;Don't forget to install the OpenERP SA OpenOffice package to modify it.&#10;Once it is modified, re-upload it in OpenERP using this wizard." align="0.0"/>
</form>
</field>
</record>
</record>
<record id="view_base_report_file_rml" model="ir.ui.view">
<field name="name">Base Report File sxw</field>
<field name="model">base.report.rml.save</field>
@ -55,6 +57,5 @@
</field>
</record>
</data>
</openerp>

View File

@ -50,6 +50,13 @@
content: "+";
margin-left: 4px;
}
.openerp .oe_dashboard .oe_action .oe_header .oe_header_text {
visibility: hidden;
cursor: text;
}
.openerp .oe_dashboard .oe_action .oe_header span {
cursor: pointer;
}
.openerp .oe_dashboard .oe_action .oe_header_empty {
padding-top: 0;
padding-bottom: 2px;

View File

@ -49,6 +49,11 @@
.oe_maximize:after
content: "+"
margin-left: 4px
.oe_header_text
visibility: hidden
cursor: text
span
cursor: pointer
.oe_header_empty
padding-top: 0
padding-bottom: 2px

View File

@ -22,12 +22,15 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
connectWith: '.oe_dashboard_column',
handle: '.oe_header',
scroll: false
}).disableSelection().bind('sortstop', self.do_save_dashboard);
}).bind('sortstop', self.do_save_dashboard);
// Events
this.$element.find('.oe_dashboard_link_reset').click(this.on_reset);
this.$element.find('.oe_dashboard_link_change_layout').click(this.on_change_layout);
this.$element.find('h2.oe_header span.oe_header_txt').click(function(ev){
if(ev.target === ev.currentTarget)
self.on_header_string($(ev.target).parent());
});
this.$element.delegate('.oe_dashboard_column .oe_fold', 'click', this.on_fold_action);
this.$element.delegate('.oe_dashboard_column .oe_close', 'click', this.on_close_action);
@ -46,6 +49,30 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
});
});
},
on_header_string:function(h2){
var self = this;
var span = h2.find('span:first').hide();
var input = h2.find('.oe_header_text').css('visibility','visible');
var attr = h2.closest(".oe_action").data('action_attrs');
var change_string = function(new_name){
attr['string'] = new_name;
span.text(new_name).show();
input.css('visibility','hidden');
self.do_save_dashboard();
}
input.unbind()
.val(span.text())
.change(function(event){
change_string($(this).val());
})
.keyup(function(event){
if(event.keyCode == 27){
//esc key to cancel changes
input.css('visibility','hidden');
span.show();
}
});
},
on_reset: function() {
this.rpc('/web/view/undo_custom', {
view_id: this.view.fields_view.view_id,

View File

@ -23,13 +23,15 @@
<t t-name="DashBoard.action">
<div t-att-data-id="action.attrs.name" class="oe_action">
<h2 t-attf-class="oe_header #{action.attrs.string ? '' : 'oe_header_empty'}">
<t t-esc="action.attrs.string"/>
<span class="oe_header_txt"> <t t-esc="action.attrs.string"/> </span>
<input class = "oe_header_text" type="text"/>
<t t-if="!action.attrs.string">&amp;nbsp;</t>
<button t-if="action.attrs.creatable and action.attrs.creatable !== 'false'" class="oe_button oe_button_create">Create</button>
<span class='oe_icon oe_close'></span>
<span class='oe_icon oe_minimize oe_fold' t-if="!action.attrs.fold"></span>
<span class='oe_icon oe_maximize oe_fold' t-if="action.attrs.fold"></span>
</h2>
<div t-attf-id="#{view.element_id}_action_#{column_index}_#{action_index}" class="oe_content" t-att-style="action.attrs.fold ? 'display: none' : null"></div>
</div>
</t>

View File

@ -291,6 +291,7 @@ class crm_lead(base_stage, osv.osv):
def on_change_partner(self, cr, uid, ids, partner_id, context=None):
result = {}
values = {}
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
values = {

View File

@ -267,16 +267,16 @@
<field name="arch" type="xml">
<form string="Interview Appraisal" version="7.0">
<header>
<button string="Send Request" name="survey_req_waiting_answer" states="draft" type="object" icon="gtk-yes" class="oe_highlight"/>
<button string="Done" name="survey_req_done" states="waiting_answer" type="object" icon="gtk-jump-to"/>
<button string="Cancel" name="survey_req_cancel" states="draft,waiting_answer" type="object" icon="gtk-cancel"/>
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer,cancel" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
<button name="action_print_survey" string="Print Survey" type="object" states="draft" icon="gtk-print" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}" attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
<button string="Send Request" name="survey_req_waiting_answer" states="draft" type="object" icon="gtk-yes" class="oe_highlight"/>
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button string="Done" name="survey_req_done" states="waiting_answer" type="object" icon="gtk-jump-to"/>
<field name="state" widget="statusbar" statusbar_visible="waiting_answer,done"/>
</header>
<sheet>
<div class="oe_right oe_button_box" name="button_box">
<button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action" states="waiting_answer" class="oe_link"/>
<button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action" states="waiting_answer"/>
</div>
<group>
<group col="3" colspan="1">

View File

@ -108,7 +108,7 @@ class hr_payslip(osv.osv):
'journal_id': slip.journal_id.id,
'period_id': period_id,
}
for line in slip.line_ids:
for line in slip.details_by_salary_rule_category:
amt = slip.credit_note and -line.total or line.total
partner_id = line.salary_rule_id.register_id.partner_id and line.salary_rule_id.register_id.partner_id.id or default_partner_id
debit_account_id = line.salary_rule_id.account_debit.id

View File

@ -296,7 +296,7 @@ class mail_thread(osv.Model):
self.message_create_notify_by_email(cr, uid, vals, user_to_push_ids, context=context)
return msg_id
def message_get_user_ids_to_notify(self, cr, uid, thread_ids, new_msg_vals, context=None):
# get body
body = new_msg_vals.get('body_html', '') if new_msg_vals.get('content_subtype') == 'html' else new_msg_vals.get('body_text', '')
@ -1139,7 +1139,7 @@ class mail_thread(osv.Model):
""" When creating a new message, set as unread if uid is not the
object responsible. """
for obj in self.browse(cr, uid, ids, context=context):
if obj.message_state and self._columns.get('user_id') and (not obj.user_id or obj.user_id.id != uid):
if obj.message_state and ('user_id' in obj._columns.keys()) and (not obj.user_id or obj.user_id.id != uid) :
self.message_mark_as_unread(cr, uid, [obj.id], context=context)
def message_check_and_set_unread(self, cr, uid, ids, context=None):

View File

@ -580,8 +580,9 @@ class account_analytic_account(osv.osv):
return res
def _trigger_project_creation(self, cr, uid, vals, context=None):
if context is None: context = {}
res = super(account_analytic_account, self)._trigger_project_creation(cr, uid, vals, context=context)
return res or vals.get('use_issues')
return res or (vals.get('use_issues') and not 'project_creation_in_progress' in context)
account_analytic_account()

View File

@ -78,7 +78,7 @@ class purchase_report(osv.osv):
to_char(s.date_order, 'YYYY-MM-DD') as day,
s.state,
s.date_approve,
date_trunc('day',s.minimum_planned_date) as expected_date,
s.minimum_planned_date as expected_date,
s.dest_address_id,
s.pricelist_id,
s.validator,
@ -117,7 +117,7 @@ class purchase_report(osv.osv):
s.date_approve,
l.date_planned,
l.product_uom,
date_trunc('day',s.minimum_planned_date),
s.minimum_planned_date,
s.pricelist_id,
s.validator,
s.dest_address_id,
@ -129,7 +129,7 @@ class purchase_report(osv.osv):
to_char(s.date_order, 'YYYY-MM-DD'),
s.state,
s.warehouse_id,
u.uom_type,
u.uom_type,
u.category_id,
t.uom_id,
u.id,

View File

@ -22,6 +22,9 @@
attrs="{'invisible': [('advance_payment_method', '!=', 'percentage')]}"/>
</div>
</group>
<div>
<b><label string="After clicking 'Show Lines to Invoice' button, select lines to invoice and make invoice from the 'More' button." attrs="{'invisible': [('advance_payment_method', '!=', 'lines')]}"/></b>
</div>
<footer>
<button name="create_invoices" string="Create Invoice" type="object"
class="oe_highlight"

View File

@ -29,14 +29,7 @@ class picking(report_sxw.rml_parse):
super(picking, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_qtytotal':self._get_qtytotal
})
def _get_qtytotal(self,move_lines):
total = 0.0
uom = move_lines[0].product_uom.name
for move in move_lines:
total+=move.product_qty
return {'quantity':total,'uom':uom}
report_sxw.report_sxw('report.stock.picking.list','stock.picking','addons/stock/report/picking.rml',parser=picking)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -299,21 +299,6 @@
</tr>
</blockTable>
</section>
<blockTable colWidths="388.0,56.0,77.0" style="Table2">
<tr>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Total</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ formatLang(get_qtytotal(picking.move_lines)['quantity']) ]] [[ get_qtytotal(picking.move_lines)['uom'] ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>

View File

@ -153,7 +153,8 @@ class report_stock_inventory(osv.osv):
'date': fields.datetime('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September')]),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'product_categ_id':fields.many2one('product.category', 'Product Category', readonly=True),
@ -173,6 +174,8 @@ class report_stock_inventory(osv.osv):
CREATE OR REPLACE view report_stock_inventory AS (
(SELECT
min(m.id) as id, m.date as date,
to_char(m.date, 'YYYY') as year,
to_char(m.date, 'MM') as month,
m.partner_id as partner_id, m.location_id as location_id,
m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type,
m.company_id,
@ -191,10 +194,12 @@ CREATE OR REPLACE view report_stock_inventory AS (
LEFT JOIN stock_location l ON (m.location_id=l.id)
GROUP BY
m.id, m.product_id, m.product_uom, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id,
m.prodlot_id, m.date, m.state, l.usage, m.company_id, pt.uom_id
m.prodlot_id, m.date, m.state, l.usage, m.company_id, pt.uom_id, to_char(m.date, 'YYYY'), to_char(m.date, 'MM')
) UNION ALL (
SELECT
-m.id as id, m.date as date,
to_char(m.date, 'YYYY') as year,
to_char(m.date, 'MM') as month,
m.partner_id as partner_id, m.location_dest_id as location_id,
m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type,
m.company_id,
@ -212,7 +217,7 @@ CREATE OR REPLACE view report_stock_inventory AS (
LEFT JOIN stock_location l ON (m.location_dest_id=l.id)
GROUP BY
m.id, m.product_id, m.product_uom, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id,
m.prodlot_id, m.date, m.state, l.usage, m.company_id, pt.uom_id
m.prodlot_id, m.date, m.state, l.usage, m.company_id, pt.uom_id, to_char(m.date, 'YYYY'), to_char(m.date, 'MM')
)
);
""")

View File

@ -163,8 +163,10 @@
<filter name="group_lot" string="Lot" icon="terp-accessories-archiver" context="{'group_by':'prodlot_id'}"/>
<filter name="group_company" string="Company" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}"/>
<filter name="group_location" string="Location" icon="terp-go-home" context="{'group_by':'location_id'}"/>
<filter string="Date" icon="terp-go-month" context="{'group_by':'date'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Date" icon="terp-go-today" context="{'group_by':'date'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
</search>
</field>

View File

@ -78,16 +78,12 @@ openerp.web_linkedin = function(instance) {
}, _.bind(this.linkedin_disabled, this));
},
linkedin_disabled: function() {
if (instance.session.uid !== 1) {
instance.web.dialog($(QWeb.render("LinkedIn.DisabledWarning")), {
title: _t("LinkedIn is not enabled"),
buttons: [
{text: _t("Ok"), click: function() { $(this).dialog("close"); }}
]
});
} else {
new instance.web_linkedin.KeyWizard(this).open();
}
instance.web.dialog($(QWeb.render("LinkedIn.DisabledWarning")), {
title: _t("LinkedIn is not enabled"),
buttons: [
{text: _t("Ok"), click: function() { $(this).dialog("close"); }}
]
});
},
selected_entity: function(entity) {
var self = this;
@ -272,24 +268,5 @@ openerp.web_linkedin = function(instance) {
}
},
});
instance.web_linkedin.KeyWizard = instance.web.Dialog.extend({
template: "LinkedIn.KeyWizard",
init: function(parent, text) {
this._super(parent, {title:_t("LinkedIn API Key")});
this.api_domain = window.location.origin;
},
start: function() {
this._super();
var self = this;
this.$("button").click(function() {
var value = self.$("input").val();
return new instance.web.Model("ir.config_parameter").call("set_param", ["web.linkedin.apikey", value]).pipe(function() {
self.destroy();
});
});
},
});
};
// vim:et fdc=0 fdl=0:

View File

@ -30,30 +30,7 @@
<t t-name="LinkedIn.DisabledWarning">
<div>
LinkedIn access was not enabled on this server.
Please ask your administrator to activate it.
</div>
</t>
<t t-name="LinkedIn.KeyWizard">
<div>
<p>
To use the LinkedIn module with this database, an API Key is required. Please follow this procedure:
</p>
<ul>
<li>Go to this URL:
<a href="https://www.linkedin.com/secure/developer" target="_blank">https://www.linkedin.com/secure/developer</a>.
</li>
<li>Log into LinkedIn.</li>
<li>Add a new application and fill the form:
<ul>
<li>JavaScript API Domain: <t t-esc="widget.api_domain"/></li>
<li>The programming tool is Javascript</li>
</ul>
</li>
<li>Copy the API key here:
<input type="text"/>
<button>Apply</button>
</li>
</ul>
Please ask your administrator to configure it in Settings > Configuration > Linkedin.
</div>
</t>
</templates>

View File

@ -28,6 +28,7 @@ except ImportError:
import base64
import urllib2
from osv import osv, fields
class Binary(openerpweb.Controller):
_cp_path = "/web_linkedin/binary"
@ -36,4 +37,19 @@ class Binary(openerpweb.Controller):
def url2binary(self, req,url):
bfile = urllib2.urlopen(url)
return base64.b64encode(bfile.read())
class web_linkedin_settings(osv.osv_memory):
_name = 'web_linkedin.settings'
_inherit = 'res.config.settings'
_columns = {
'api_key': fields.char(string="API Key", size=50),
}
def get_default_linkedin(self, cr, uid, fields, context=None):
key = self.pool.get("ir.config_parameter").get_param(cr, uid, "web.linkedin.apikey") or ""
return {'api_key': key}
def set_linkedin(self, cr, uid, ids, context=None):
key = self.browse(cr, uid, ids[0], context)["api_key"] or ""
self.pool.get("ir.config_parameter").set_param(cr, uid, "web.linkedin.apikey", key)

View File

@ -10,12 +10,55 @@
<field name="name" position="replace">
<field name="name" default_focus="1" nolabel="1" widget="linkedin" />
</field>
<!--<field name="title" position="before">
<field name="linkedin_id" invisible="1"/>
<field name="profile_id" invisible="1"/>
<field name="twitter_id" invisible="1"/>
</field>-->
</field>
</record>
<record id="view_linkedin_config_settings" model="ir.ui.view">
<field name="name">linkedin_settings</field>
<field name="model">web_linkedin.settings</field>
<field name="arch" type="xml">
<form string="Configure Linkedin" version="7.0" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
or
<button string="Cancel" type="object" name="cancel" class="oe_link"/>
</header>
<div>
<p>
To use the LinkedIn module with this database, an API Key is required. Please follow this procedure:
</p>
<ul>
<li>Go to this URL:
<a href="https://www.linkedin.com/secure/developer" target="_blank">https://www.linkedin.com/secure/developer</a>.
</li>
<li>Log into LinkedIn.</li>
<li>Add a new application and fill the form:
<ul>
<li>JavaScript API Domain: the domain of the url used to log into this database (example: http://localhost:8069)</li>
<li>The programming tool is Javascript</li>
</ul>
</li>
<li>Copy the API key down here:</li>
</ul>
</div>
<group>
<field name="api_key"/>
</group>
</form>
</field>
</record>
<record id="action_linkedin_config_settings" model="ir.actions.act_window">
<field name="name">Configure Linkedin</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">web_linkedin.settings</field>
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<menuitem id="menu_linkedin_config_settings" name="Linkedin" parent="base.menu_config"
sequence="10" action="action_linkedin_config_settings"/>
</data>
</openerp>