[MERGE] merged latest bugfixes from 6.0 into trunk (up to rev 4375)

bzr revid: odo@openerp.com-20110201142528-5w9ns20flxmetf3i
This commit is contained in:
Olivier Dony 2011-02-01 15:25:28 +01:00
commit 1da43ed8ba
15 changed files with 213 additions and 192 deletions

View File

@ -94,7 +94,7 @@ class account_invoice(osv.osv):
if invoice.move_id:
for m in invoice.move_id.line_id:
if m.account_id.type in ('receivable','payable'):
result[invoice.id] = m.amount_residual_currency
result[invoice.id] += m.amount_residual_currency
return result
# Give Journal Items related to the payment reconciled to this invoice
@ -353,6 +353,8 @@ class account_invoice(osv.osv):
raise orm.except_orm(_('Unknown Error'), str(e))
def confirm_paid(self, cr, uid, ids, context=None):
if context is None:
context = {}
self.write(cr, uid, ids, {'state':'paid'}, context=context)
for inv_id, name in self.name_get(cr, uid, ids, context=context):
message = _("Invoice '%s' is paid.") % name
@ -360,6 +362,8 @@ class account_invoice(osv.osv):
return True
def unlink(self, cr, uid, ids, context=None):
if context is None:
context = {}
invoices = self.read(cr, uid, ids, ['state'], context=context)
unlink_ids = []
for t in invoices:
@ -598,6 +602,8 @@ class account_invoice(osv.osv):
return res
def copy(self, cr, uid, id, default={}, context=None):
if context is None:
context = {}
default.update({
'state':'draft',
'number':False,

View File

@ -306,7 +306,7 @@ class payment_line(osv.osv):
if id.move_line_id:
res[id.id] = id.move_line_id.date_maturity
else:
res[id.id] = ""
res[id.id] = False
return res
def _get_ml_created_date(self, cr, uid, ids, *a):
@ -315,7 +315,7 @@ class payment_line(osv.osv):
if id.move_line_id:
res[id.id] = id.move_line_id.date_created
else:
res[id.id] = ""
res[id.id] = False
return res
_columns = {

View File

@ -108,7 +108,7 @@
<field name="date_scheduled" select="1" attrs="{'readonly':[('date_prefered','!=','fixed')]}" />
<button colspan="2" name="%(action_create_payment_order)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
</group>
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id}" >
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id or False}" >
<form string="Payment Line">
<notebook>
<page string="Payment">

View File

@ -179,6 +179,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
if context is None:
context = {}
def make_call_old(cr, uid, ids, vals, context=context):
if context is None:
context = {}
if isinstance(ids, (str, int, long)):
ids = [ids]
if not context.get('action'):

View File

@ -124,11 +124,13 @@
<form string="Stage">
<separator string="Stage Definition" colspan="4"/>
<field name="name" select="1"/>
<field name="type" invisible="1" />
<field name="type" groups="base.group_extended" />
<field name="sequence"/>
<field name="probability"/>
<field name="on_change"/>
<group colspan="4" col="2" >
<field name="on_change"/>
</group>
<separator string="Requirements" colspan="4"/>
<field name="requirements" nolabel="1" colspan="4"/>
<field name="section_ids" invisible="1" />

View File

@ -70,8 +70,10 @@ class crm_lead2opportunity(osv.osv_memory):
cr, uid, opportunity_view_tree, context=context).res_id
lead = leads.browse(cr, uid, record_id, context=context)
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1)])
if(lead.section_id):
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1), ('section_ids','=', lead.section_id.id)])
else:
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1)])
for this in self.browse(cr, uid, ids, context=context):
vals ={
'planned_revenue': this.planned_revenue,

View File

@ -75,7 +75,7 @@ class hr_attendance(osv.osv):
LIMIT 2 '''
cr.execute(sql,(id,id))
atts = cr.fetchall()
if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])):
if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (len(atts)==2 and atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])):
return False
return True

View File

@ -567,7 +567,7 @@ class product_product(osv.osv):
ptrn=re.compile('(\[(.*?)\])')
res = ptrn.search(name)
if res:
ids = self.search(cr, user, [('default_code','ilike',res.group(2))]+ args, limit=limit, context=context)
ids = self.search(cr, user, [('default_code','=', res.group(2))] + args, limit=limit, context=context)
else:
ids = self.search(cr, user, args, limit=limit, context=context)
result = self.name_get(cr, user, ids, context=context)

View File

@ -8,7 +8,7 @@
<field name="name">Project_Planning</field>
<field name="business_days">20</field>
<field name="date_from" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="date_to" eval="time.strftime('%Y-%m-30 15:23:00')"/>
<field name="date_to" eval="time.strftime('%Y-%m-28 15:00:00')"/>
<field name="state">open</field>
<field name="user_id" ref="project.res_users_project_manager"/>
</record>

View File

@ -2,126 +2,134 @@
function config_close()
{
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
//set the value of the configuration fields
function config_change_load()
{
var s = getServer();
var a =s.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcurl').value = "localhost"
document.getElementById('txtcport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcurl').value = "localhost"
}
else
{
document.getElementById('txtcurl').value = url
}
var s = getServer();
var a =s.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcurl').value = "localhost"
document.getElementById('txtcport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcurl').value = "localhost"
}
else
{
document.getElementById('txtcurl').value = url
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcport').value = "8069"
setPort("8069");
}
else
{
document.getElementById('txtcport').value = a[2]
setPort(a[2]);
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcport').value = "8069"
setPort("8069");
}
else
{
document.getElementById('txtcport').value = a[2]
setPort(a[2]);
}
}
}
}
function config_change_load_web()
{
//var s = getServer();
//var s = getServer();
weburl = getWebServerURL();
webport = getwebPort();
var urlport = weburl+':'+webport;
var a =urlport.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcweburl').value = "localhost"
document.getElementById('txtcwebport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcweburl').value = "localhost"
}
else
{
document.getElementById('txtcweburl').value = url
}
var a =urlport.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcweburl').value = "localhost"
document.getElementById('txtcwebport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcweburl').value = "localhost"
}
else
{
document.getElementById('txtcweburl').value = url
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcwebport').value = "8069"
setwebPort("8069");
}
else
{
document.getElementById('txtcwebport').value = a[2]
setwebPort(a[2]);
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcwebport').value = "8069"
setwebPort("8069");
}
else
{
document.getElementById('txtcwebport').value = a[2]
setwebPort(a[2]);
}
}
}
}
function config_ok()
{
if (document.getElementById('txtcurl').value == '')
{
if (document.getElementById('txtcurl').value == '')
{
alert("You Must Enter Server Name!")
return false;
return false;
}
if (document.getElementById('txtcport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setServer("http://"+document.getElementById('txtcurl').value +":" + document.getElementById('txtcport').value);
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
}
if (document.getElementById('txtcport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setServer("http://"+document.getElementById('txtcurl').value +":" + document.getElementById('txtcport').value);
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
function config_ok_web()
{
if (document.getElementById('txtcweburl').value == '')
{
if (document.getElementById('txtcweburl').value == '')
{
alert("You Must Enter Server Name!")
return false;
return false;
}
if (document.getElementById('txtcwebport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setWebServerURL("http://"+document.getElementById('txtcweburl').value +":" + document.getElementById('txtcwebport').value);
window.close("chrome://openerp_plugin/content/config_change_web.xul", "", "chrome");
}
if (document.getElementById('txtcwebport').value == '' && !document.getElementById('lblssl').checked)
{
alert("You Must Enter Port!")
return false;
}
var protocol = "http://";
var port = document.getElementById('txtcwebport').value
if(document.getElementById('lblssl').checked) {
protocol = "https://";
if(port == '') {
port = 443
}
}
setWebServerURL(protocol + document.getElementById('txtcweburl').value +":" + port);
window.close("chrome://openerp_plugin/content/config_change_web.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
@ -139,89 +147,89 @@ function openConfigChangeweb()
function appendDbList()
{
setServerService('xmlrpc/db');
getDbList('DBlist');
setServerService('xmlrpc/db');
getDbList('DBlist');
}
//set the database list in the listbox in configuration window
function setDb()
{
var cmbDbList = document.getElementById('listDBListBox');
document.getElementById('DBlist').value = cmbDbList.getItemAtIndex(cmbDbList.selectedIndex).value;
var cmbDbList = document.getElementById('listDBListBox');
document.getElementById('DBlist').value = cmbDbList.getItemAtIndex(cmbDbList.selectedIndex).value;
}
//stores the value of configuration fields in preferences
function okClick()
{
if (getDBList()=="false")
{
if (document.getElementById('DBlist_text').value =='')
{
alert("You Must Enter Database Name");
return false;
}
setDbName(document.getElementById('DBlist_text').value);
}
else if(document.getElementById('DBlist') != null)
{
setDbName(document.getElementById('DBlist').value);
}
setServer(document.getElementById('txturl').value);
var s = document.getElementById('txturl').value;
var a =s.split(':');
setPort(a[a.length-1]);
setUsername(document.getElementById('txtusername').value);
setPassword(document.getElementById('txtpassword').value);
window.close();
if (getDBList()=="false")
{
if (document.getElementById('DBlist_text').value =='')
{
alert("You Must Enter Database Name");
return false;
}
setDbName(document.getElementById('DBlist_text').value);
}
else if(document.getElementById('DBlist') != null)
{
setDbName(document.getElementById('DBlist').value);
}
setServer(document.getElementById('txturl').value);
var s = document.getElementById('txturl').value;
var a =s.split(':');
setPort(a[a.length-1]);
setUsername(document.getElementById('txtusername').value);
setPassword(document.getElementById('txtpassword').value);
window.close();
}
//deletes the value of the selected value in the listbox in configuraton menu
function deleteDocument(){
if(document.getElementById("listObjectListBox").selectedItem){
var objectlist = getPref().getCharPref("object").split(',');
var imagelist = getPref().getCharPref("imagename").split(',');
var objlist = getPref().getCharPref("listobject").split(',');
if(objectlist.length>0){
var objectcharpref = '';
var imagecharpref = '';
var objcharpref = '';
var nodelist = document.getElementById("listObjectListBox").selectedItem.childNodes
var childnode = document.getElementById("listObjectListBox").childNodes
for(i=2;i<childnode.length;i++){
if(childnode[i].hasChildNodes){
var secondchild = childnode[i].childNodes;
if (secondchild[1].getAttribute("label") != nodelist[1].getAttribute("label")){
objcharpref += secondchild[0].getAttribute("label")+',';
objectcharpref += secondchild[1].getAttribute("label")+',';
imagecharpref += secondchild[2].getAttribute("image")+',';
}
}
}
var demo3 = objectcharpref.substring(0,objectcharpref.length-1);
var demo4 = imagecharpref.substring(0,imagecharpref.length-1);
var demo5 = objcharpref.substring(0,objcharpref.length-1);
if(document.getElementById("listObjectListBox").selectedItem){
var objectlist = getPref().getCharPref("object").split(',');
var imagelist = getPref().getCharPref("imagename").split(',');
var objlist = getPref().getCharPref("listobject").split(',');
if(objectlist.length>0){
var objectcharpref = '';
var imagecharpref = '';
var objcharpref = '';
var nodelist = document.getElementById("listObjectListBox").selectedItem.childNodes
var childnode = document.getElementById("listObjectListBox").childNodes
for(i=2;i<childnode.length;i++){
if(childnode[i].hasChildNodes){
var secondchild = childnode[i].childNodes;
if (secondchild[1].getAttribute("label") != nodelist[1].getAttribute("label")){
objcharpref += secondchild[0].getAttribute("label")+',';
objectcharpref += secondchild[1].getAttribute("label")+',';
imagecharpref += secondchild[2].getAttribute("image")+',';
}
}
}
var demo3 = objectcharpref.substring(0,objectcharpref.length-1);
var demo4 = imagecharpref.substring(0,imagecharpref.length-1);
var demo5 = objcharpref.substring(0,objcharpref.length-1);
getPref().setCharPref("listobject",demo5);
getPref().setCharPref("object",demo3);
getPref().setCharPref("imagename",demo4);
}
document.getElementById("listObjectListBox").removeItemAt(document.getElementById("listObjectListBox").selectedIndex)
}
else{
alert("Please Select Any One Document ");
}
getPref().setCharPref("listobject",demo5);
getPref().setCharPref("object",demo3);
getPref().setCharPref("imagename",demo4);
}
document.getElementById("listObjectListBox").removeItemAt(document.getElementById("listObjectListBox").selectedIndex)
}
else{
alert("Please Select Any One Document ");
}
}
//function to add the image file for the checkbox
function addFile(){
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(this, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
var res = fp.show();
if (res == nsIFilePicker.returnOK){
var thefile = fp.file;
document.getElementById("txtimagename").value = thefile.path
}
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(this, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
var res = fp.show();
if (res == nsIFilePicker.returnOK){
var thefile = fp.file;
document.getElementById("txtimagename").value = thefile.path
}
}

View File

@ -2,25 +2,29 @@
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/config_change.dtd">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml" onload="config_change_load_web()"
title="Openerp Connection" height="140" width="240">
xmlns:html="http://www.w3.org/1999/xhtml" onload="config_change_load_web()"
title="Openerp Connection" height="140" width="240">
<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>
<script type="text/javascript" src="chrome://openerp_plugin/content/loaddata.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/static.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/overlay.js"></script>
<hbox>
<label align="center" id="heading" value="&lblheading.label;" style="padding-left:38px" />
<hbox>
<label align="center" id="heading" value="&lblheading.label;" style="padding-left:38px" />
</hbox>
<groupbox id="gpData" width="200">
<hbox >
<label id="lblurl" control="txtcurl" value="&lblurl.label;" width="50"/>
<textbox id="txtcweburl" width="140" />
</hbox>
<hbox>
<label id="lblport" control="txtcport" value="&lblport.label;" width="50"/>
<textbox id="txtcwebport" width="140" />
</hbox>
<hbox >
<label id="lblurl" control="txtcurl" value="&lblurl.label;" width="50"/>
<textbox id="txtcweburl" width="140" />
</hbox>
<hbox>
<label id="lblport" control="txtcport" value="&lblport.label;" width="50"/>
<textbox id="txtcwebport" width="140" />
</hbox>
<hbox>
<checkbox id="lblssl" label="SSL (https)" checked="false"/>
</hbox>
</groupbox>
<hbox align="right">

View File

@ -612,7 +612,6 @@ function createMenuItem_db(aLabel) {
//xmlrpc request handler for getting the list of database
var listDbHandler = {
onResult: function(client, context, result) {
setconnect_server("true")
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var arrMethodList = result.QueryInterface(Components.interfaces.nsISupportsArray);
// Set the number of results
@ -625,7 +624,7 @@ var listDbHandler = {
var database = ""
if (count > 0)
{
setDBList("true")
setDBList("true");
var label = document.getElementById("database_option");
var vbox = document.createElement("vbox");
var hbox = document.createElement("hbox");
@ -658,7 +657,7 @@ var listDbHandler = {
}
else
{
setDBList("false")
setDBList("false");
}
// Loop through the results, adding items to the list
if (count)
@ -682,22 +681,18 @@ var listDbHandler = {
onFault: function (client, ctxt, fault) {
setDBList("false");
},
onError: function (client, ctxt, status, errorMsg) {
if(status == 0) {
setconnect_server("true");
setDBList("false");
}
setDBList("false");
}
};
//function to get the database list
function getDbList(argControl)
{
setDBList("false")
setconnect_server("false")
setDBList("false");
setconnect_server("true");
// Enable correct security
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
// Get the instance of the XML-RPC client
@ -1844,7 +1839,6 @@ function testConnection(){
function testConnection_web(){
var branchobj = getPref();
weburl = getWebServerURL();
// window.open(weburl, "", "chrome","resizable=yes,scrollbars=yes,status=yes");
var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance();
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
messenger.launchExternalURL(weburl);
@ -1876,6 +1870,7 @@ var listcreateLoginHandler = {
//function to check the login information
function createConnection(){
setconnect_server("true");
var branchobj = getPref();
setServerService('xmlrpc/common');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');

View File

@ -1,5 +1,7 @@
<!ENTITY lblurl.label "Server: ">
<!ENTITY lblport.label "Port: ">
<!ENTITY lblport.label "Port: ">
<!ENTITY lblssl.label "Use SLL ? ">
<!ENTITY lblheading.label "Openerp Connection">
<!ENTITY imagecancel.value "chrome://openerp_plugin/skin/Error.gif">
<!ENTITY imageok.value "chrome://openerp_plugin/skin/Success.gif">