From ecbc6996e7428c7f570cb3c06ef5ee85bdd05965 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 22 Feb 2012 18:36:38 +0530 Subject: [PATCH 0001/1064] [IMP]hr_holidays: Improved button name and state and redonly in confirm and draft bzr revid: mma@tinyerp.com-20120222130638-buhl4qhdto4gpm3j --- addons/hr_holidays/hr_holidays.py | 18 +++++++++--------- addons/hr_holidays/hr_holidays_view.xml | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 3bb7a8e4982..3dc8ae0467c 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -111,25 +111,25 @@ class hr_holidays(osv.osv): _columns = { 'name': fields.char('Description', required=True, size=64), - 'state': fields.selection([('draft', 'New'), ('confirm', 'Waiting Approval'), ('refuse', 'Refused'), - ('validate1', 'Waiting Second Approval'), ('validate', 'Approved'), ('cancel', 'Cancelled')], + 'state': fields.selection([('draft', 'New'), ('confirm', 'To Approve'), ('refuse', 'Refused'), + ('validate1', 'Second Approval'), ('validate', 'Approved'), ('cancel', 'Cancelled')], 'State', readonly=True, help='The state is set to \'Draft\', when a holiday request is created.\ \nThe state is \'Waiting Approval\', when holiday request is confirmed by user.\ \nThe state is \'Refused\', when holiday request is refused by manager.\ \nThe state is \'Approved\', when holiday request is approved by manager.'), 'user_id':fields.related('employee_id', 'user_id', type='many2one', relation='res.users', string='User', store=True), - 'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}, select=True), - 'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}), - 'holiday_status_id': fields.many2one("hr.holidays.status", "Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}), - 'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'), + 'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, select=True), + 'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), + 'holiday_status_id': fields.many2one("hr.holidays.status", "Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), + 'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'), #'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automatically filled by the user who validate the leave'), #'notes': fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}), 'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True, help='This area is automatically filled by the user who validate the leave'), - 'notes': fields.text('Reasons',readonly=True, states={'draft':[('readonly',False)]}), - 'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}), + 'notes': fields.text('Reasons',readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), + 'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), 'number_of_days': fields.function(_compute_number_of_days, string='Number of Days', store=True), 'case_id': fields.many2one('crm.meeting', 'Meeting'), - 'type': fields.selection([('remove','Leave Request'),('add','Allocation Request')], 'Request Type', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="Choose 'Leave Request' if someone wants to take an off-day. \nChoose 'Allocation Request' if you want to increase the number of leaves available for someone", select=True), + 'type': fields.selection([('remove','Leave Request'),('add','Allocation Request')], 'Request Type', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help="Choose 'Leave Request' if someone wants to take an off-day. \nChoose 'Allocation Request' if you want to increase the number of leaves available for someone", select=True), 'parent_id': fields.many2one('hr.holidays', 'Parent'), 'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',), 'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True), diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 22d4d6e567d..302ca4fe6ee 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -65,9 +65,9 @@
- + - + @@ -89,11 +89,11 @@ - diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index 53fdaef8c1f..c0061f15cd3 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -103,9 +103,9 @@ + + + + From eaf646c9e226c6bb729f5fdbdfdb291bf902631a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 10:19:29 +0100 Subject: [PATCH 0018/1064] [imp] view bzr revid: rlo@openerp.com-20120227091929-pvcmtg5kes25pxid --- addons/google_docs/res_gdocs.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/google_docs/res_gdocs.xml b/addons/google_docs/res_gdocs.xml index b1a54fdc63e..660252de986 100644 --- a/addons/google_docs/res_gdocs.xml +++ b/addons/google_docs/res_gdocs.xml @@ -7,7 +7,7 @@ - + From cea3437f596f73558e23f1e67d61029daccf8d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 11:56:36 +0100 Subject: [PATCH 0019/1064] [imp] view bzr revid: rlo@openerp.com-20120227105636-czaw0ghb4jl6if1j --- addons/google_docs/{res_gdocs.xml => google_docs.xml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename addons/google_docs/{res_gdocs.xml => google_docs.xml} (91%) diff --git a/addons/google_docs/res_gdocs.xml b/addons/google_docs/google_docs.xml similarity index 91% rename from addons/google_docs/res_gdocs.xml rename to addons/google_docs/google_docs.xml index 660252de986..d0e842b566e 100644 --- a/addons/google_docs/res_gdocs.xml +++ b/addons/google_docs/google_docs.xml @@ -8,7 +8,7 @@ - + From 37ed7a1d9f1819fd39cbf0eb0679ae17e1afd91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 13:38:34 +0100 Subject: [PATCH 0020/1064] [imp] view bzr revid: rlo@openerp.com-20120227123834-todar214ngca7pu0 --- addons/google_docs/google_docs.py | 3 +-- addons/google_docs/static/src/js/gdocs.js | 20 ++++++++++---------- addons/google_docs/static/src/xml/gdocs.xml | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 90edb15b104..def1f3097e1 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -74,12 +74,11 @@ class google_docs(osv.osv): edit_url_template = 'https://docs.google.com/Edit?docid=%s' prefix_gdoc_id_res = DOCUMENT_LABEL + ':' - def copy_gdoc(self, cr, uid, model, folder=None, context=None): + def copy_gdoc(self, cr, uid, model, context=None): '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity. @param cr: the current row from the database cursor. @param uid: the current user ID, for security checks. @param model: the current model name. - @param folder: folder in which to store the copy. @param context: a standard dictionary for contextual values. @return the url of the copy itself. @return -1 if the template hasn't been assigned yet. diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index e605577d45a..30edffaad7f 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -4,22 +4,22 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte on_attachments_loaded: function(attachments) { this._super(attachments); var self = this; - var $padbtn = self.$element.find('button.gdocs'); - var is_pad = function(a) { + var $gdocbtn = self.$element.find('button.gdocs'); + var is_gdoc = function(a) { return a.type == 'url' && a.name == 'GDocs'; }; - if (_.any(attachments, is_pad)) { - $padbtn.hide(); + if (_.any(attachments, is_gdoc)) { + $gdocbtn.hide(); } else { - $padbtn.show().click(self.on_add_pad); + $gdocbtn.show().click(self.on_add_gdoc); } }, - on_add_pad: function() { + on_add_gdoc: function() { var self = this; - var $padbtn = this.$element.find('button.gdocs'); - $padbtn.attr('disabled', 'true').find('img, span').toggle(); - this.view.dataset.call_button('pad_get', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { - $padbtn.hide(); + var $gdocbtn = this.$element.find('button.gdocs');alert($gdocbtn); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + $gdocbtn.hide(); self.do_update(); self.do_action(r.result); }); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 52decbfdbc1..bc7a56842ba 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -4,7 +4,7 @@ - From 7f74731083ea8e3f6fbcec5aa7d3edef5803b1d7 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 27 Feb 2012 18:45:57 +0530 Subject: [PATCH 0021/1064] [IMP]purchase: Fix Error of email template, added send button in workflow, change some state label name and its button position bzr revid: mma@tinyerp.com-20120227131557-dl1ut04uypafpzwf --- addons/email_template/email_template.py | 2 ++ addons/purchase/purchase.py | 23 +++++++++++++++++++++-- addons/purchase/purchase_view.xml | 13 +++++++------ addons/purchase/purchase_workflow.xml | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 6c1571c5630..a6a2f9f2c82 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -56,6 +56,8 @@ class email_template(osv.osv): :param str model: model name of the document record this mail is related to. :param int res_id: id of the document record this mail is related to. """ + if context is None: + context = {} if not template: return u"" try: template = tools.ustr(template) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 3d909c1085e..d342b7b1169 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -142,10 +142,11 @@ class purchase_order(osv.osv): return res STATE_SELECTION = [ - ('draft', 'Request for Quotation'), + ('draft', 'Draft PO'), ('wait', 'Waiting'), + ('send', 'RFQ Sent'), ('confirmed', 'Waiting Approval'), - ('approved', 'Approved'), + ('approved', 'Purchase Order'), ('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), @@ -277,6 +278,24 @@ class purchase_order(osv.osv): self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(self,cr,uid,context=context)}) return True + def wkf_send_rfq(self, cr, uid, ids, context=None): + + mod_obj = self.pool.get('ir.model.data') + template_id = self.pool.get('email.template').search(cr, uid, [('model_id', '=', 'purchase.order')]) + model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','email_compose_message_wizard_form')]) + resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] + self.write(cr, uid, ids, {'state' : 'send'}) + + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'mail.compose.message', + 'views': [(resource_id,'form')], + 'view_id': resource_id, + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context': {'active_model': 'purchase.order', 'mail.compose.message.mode':'mass_mail', 'mail.compose.template_id' :template_id}, + } #TODO: implement messages system def wkf_confirm_order(self, cr, uid, ids, context=None): todo = [] diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 1c936055aff..ccdc9858125 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -194,17 +194,18 @@ From 087c191730d611058b0303cf38d10989d868a7f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 14:57:51 +0100 Subject: [PATCH 0023/1064] [imp] view bzr revid: rlo@openerp.com-20120227135751-33nd5qduv2jp58cu --- addons/google_docs/google_docs.py | 56 ------------------------------- 1 file changed, 56 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 59101ba5b09..2f2c4919271 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -4,62 +4,6 @@ import gdata.docs.client from gdata.client import RequestError from gdata.docs.service import DOCUMENT_LABEL -# _columns = { -# 'id': fields.integer('ID', readonly=True), -# 'model': fields.many2one('ir.model', 'Model'), -# 'multiple': fields.boolean('Multiple'), -# 'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False) -# -# } -# -## edit_url_template = 'https://docs.google.com/Edit?docid=%s' -## prefix_gdoc_id_res = 'document:' -# -# def google_docs_get(self, cr, uid, model, id): -# attachment = self.search(cr, uid, [('res_model', '=', model), ('res_id', '=', id), ('type', '=', 'url'), ('url', 'like', 'https://docs.oogle.com')]) -# if attachment: -# return self.read(cr, uid, attachment)[0]['url'] -# else: -# url = self.pad_generate_url(cr, uid, model, id) -# self.create(cr, uid, { -# 'res_model' : model, -# 'res_id' : id, -# 'type' : 'url', -# 'name' : 'Pad', -# 'url' : url, -# }) -# return url -# -# def generate_name(self, cr, uid, model, id): -# template_vars = { -# 'db' : cr.dbname, -# 'model' : model, -# 'id' : id, -# 'salt' : salt, -# 'name' : self.pool.get(model).name_get(cr,uid,[id])[0], -# } -# return pad_url_template % template_vars -# -# -# def button_add_google_docs_google_docs_add_doc(self, cr, uid, model, id): -# #pad_url_template = self.pool.get('res.users').browse(cr,uid,[uid])[0].company_id.pad_url_template -# #s = string.ascii_uppercase + string.digits -# #salt = ''.join([s[random.randint(0, len(s) - 1)] for i in range(8)]) -# -# # i lookup in the table google_docs.templates to check the policy -# -# # if multiple: 1 -# -# # if i find a template i will duplicate the template -# -# # else empty 'word' text -# -# # else -# # if no document exists do like 1 -^ -# # else -# # jumpt to the existing document -# - class google_docs(osv.osv): _name = 'google.docs' From 3568bed68046537878e7386597abfb7978de3cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 16:13:11 +0100 Subject: [PATCH 0024/1064] [imp] view bzr revid: rlo@openerp.com-20120227151311-38go1bn2ihs1n5jq --- addons/google_docs/static/src/js/gdocs.js | 10 ++++++++-- addons/google_docs/static/src/xml/gdocs.xml | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 579414ee74a..14996da46a5 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -2,7 +2,6 @@ openerp.gdocs = function(instance) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ on_attachments_loaded: function(attachments) { - alert('gdocs.js.on_attachments_loaded()'); this._super(attachments); var self = this; var $gdocbtn = self.$element.find('button.gdocs'); @@ -17,7 +16,7 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }, on_add_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('button.gdocs');alert($gdocbtn); + var $gdocbtn = this.$element.find('button.gdocs'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { $gdocbtn.hide(); @@ -28,3 +27,10 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }); }; + +$(function() { + console.log($('#gd-button')); + $('#gd-button').click(function(){alert('click');}); + alert('binded'); +} +); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 9f78a91c28f..61c169fe531 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -4,7 +4,14 @@ - From f0a9682a6aa6814817cca4e31fe9561bed60d126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 17:12:00 +0100 Subject: [PATCH 0025/1064] [imp] js things bzr revid: rlo@openerp.com-20120227161200-toovqcewybgxsitg --- addons/google_docs/static/src/js/gdocs.js | 28 ++++++--------------- addons/google_docs/static/src/xml/gdocs.xml | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 14996da46a5..11690f70e2a 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,22 +1,16 @@ -openerp.gdocs = function(instance) { +console.log('fegegegwnw') +openerp.google_docs = function(instance) { +console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ - on_attachments_loaded: function(attachments) { - this._super(attachments); - var self = this; - var $gdocbtn = self.$element.find('button.gdocs'); - var is_gdoc = function(a) { - return a.type == 'url' && a.name == 'GDocs'; - }; - if (_.any(attachments, is_gdoc)) { - $gdocbtn.hide(); - } else { - $gdocbtn.show().click(self.on_add_gdoc); - } + init: function() { + this._super.apply(this, arguments); + this.$element.delegate('.oe_google_docs_button', 'click', self.on_add_gdoc); }, on_add_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('button.gdocs'); +console.log('--------'); + var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { $gdocbtn.hide(); @@ -28,9 +22,3 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }; -$(function() { - console.log($('#gd-button')); - $('#gd-button').click(function(){alert('click');}); - alert('binded'); -} -); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 61c169fe531..7ee2297c545 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -11,7 +11,7 @@


- From af04b6860cfe10259a63a44cd6b4a4f8234eed8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 17:14:13 +0100 Subject: [PATCH 0026/1064] [imp] js things bzr revid: rlo@openerp.com-20120227161413-ie6cn7rwoezhht6v --- addons/google_docs/static/src/js/gdocs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 11690f70e2a..6ef889e3fa0 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -5,7 +5,7 @@ console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', self.on_add_gdoc); + this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); }, on_add_gdoc: function() { var self = this; From ec2ceb5d6bf9c9a12102de64b2eded66cc7c7062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 28 Feb 2012 09:22:26 +0100 Subject: [PATCH 0027/1064] [imp] js is calling the module bzr revid: rlo@openerp.com-20120228082226-su74ddghivymtp09 --- addons/google_docs/static/src/js/gdocs.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6ef889e3fa0..32a57e18c0c 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,18 +1,15 @@ -console.log('fegegegwnw') -openerp.google_docs = function(instance) { +openerp.google_docs = function(instance, session) { -console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); + this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); }, on_add_gdoc: function() { var self = this; -console.log('--------'); var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + new openerp.sessions.session0.web.DataSet(this, 'google.docs').call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { $gdocbtn.hide(); self.do_update(); self.do_action(r.result); From 3e9fbd83ca03bc76ba62ca9a2fc3cc4888152ccc Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 28 Feb 2012 17:29:49 +0530 Subject: [PATCH 0028/1064] [IMP]purchase: Added a button receive invoice & receive product, improve view and related code, change label done to paid bzr revid: mma@tinyerp.com-20120228115949-03tbq9mqcr0bwrt2 --- addons/purchase/purchase.py | 63 +++++++++++++++++++++++++++---- addons/purchase/purchase_view.xml | 7 ++-- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index d342b7b1169..b3bd23b392d 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -149,7 +149,7 @@ class purchase_order(osv.osv): ('approved', 'Purchase Order'), ('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), - ('done', 'Done'), + ('done', 'Paid'), ('cancel', 'Cancelled') ] @@ -274,28 +274,77 @@ class purchase_order(osv.osv): fiscal_position = supplier.property_account_position and supplier.property_account_position.id or False return {'value':{'partner_address_id': supplier_address['default'], 'pricelist_id': pricelist, 'fiscal_position': fiscal_position}} + def view_invoice(self, cr, uid, ids, context=None): + mod_obj = self.pool.get('ir.model.data') + inv_ids = [] + for po in self.browse(cr, uid, ids, context=context): + if po.invoice_method == 'manual': + if not po.invoice_ids: + raise osv.except_osv(_('Warring !'), + _('You have configure Invoice Control is: "%s", You must first Create all invoices related to this purchase order: "%s"') % (self._columns['invoice_method'].selection[0][1], po.name)) + inv_ids+= [invoice.id for invoice in po.invoice_ids] + + res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form') + res_id = res and res[1] or False + + return { + 'name': _('Supplier Invoices'), + 'view_type': 'form', + 'view_mode': 'form', + 'view_id': [res_id], + 'res_model': 'account.invoice', + 'context': "{'type':'in_invoice', 'journal_type': 'purchase'}", + 'type': 'ir.actions.act_window', + 'nodestroy': True, + 'target': 'current', + 'res_id': inv_ids and inv_ids[0] or False, + } + + def view_picking(self, cr, uid, ids, context=None): + mod_obj = self.pool.get('ir.model.data') + pick_ids = [] + for po in self.browse(cr, uid, ids, context=context): + pick_ids += [picking.id for picking in po.picking_ids] + + res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_in_form') + res_id = res and res[1] or False + + return { + 'name': _('Receptions'), + 'view_type': 'form', + 'view_mode': 'form', + 'view_id': [res_id], + 'res_model': 'stock.picking', + 'context': "{'contact_display': 'partner'}", + 'type': 'ir.actions.act_window', + 'nodestroy': True, + 'target': 'current', + 'res_id': pick_ids and pick_ids[0] or False, + } + def wkf_approve_order(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(self,cr,uid,context=context)}) return True def wkf_send_rfq(self, cr, uid, ids, context=None): - mod_obj = self.pool.get('ir.model.data') template_id = self.pool.get('email.template').search(cr, uid, [('model_id', '=', 'purchase.order')]) - model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','email_compose_message_wizard_form')]) - resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] self.write(cr, uid, ids, {'state' : 'send'}) + res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form') + res_id = res and res[1] or False + return { 'view_type': 'form', 'view_mode': 'form', 'res_model': 'mail.compose.message', - 'views': [(resource_id,'form')], - 'view_id': resource_id, + 'views': [(res_id,'form')], + 'view_id': res_id, 'type': 'ir.actions.act_window', 'target': 'new', - 'context': {'active_model': 'purchase.order', 'mail.compose.message.mode':'mass_mail', 'mail.compose.template_id' :template_id}, + 'context': {'active_model': 'purchase.order','mail.compose.template_id' :template_id}, } + #TODO: implement messages system def wkf_confirm_order(self, cr, uid, ids, context=None): todo = [] diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index ccdc9858125..be0b8d17eed 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -194,16 +194,17 @@ diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py index b108bc14fe3..006a622e25f 100644 --- a/addons/account_voucher/invoice.py +++ b/addons/account_voucher/invoice.py @@ -36,7 +36,7 @@ class invoice(osv.osv): 'res_model': 'account.voucher', 'type': 'ir.actions.act_window', 'nodestroy': True, - 'target': 'current', + 'target': 'new', 'domain': '[]', 'context': { 'default_partner_id': inv.partner_id.id, diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 241bd23d5bb..43e316d1091 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -403,10 +403,10 @@ + + +
From 663a525f76ccf263dbb37b451a9c7f2898217a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 16:25:30 +0100 Subject: [PATCH 0054/1064] [imp] integrate frontend - middleware bzr revid: rlo@openerp.com-20120301152530-2ldz1w96y4pu2x9w --- addons/google_docs/google_docs.py | 47 +++++++++---------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 3e6c398b155..040dce932ea 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -22,32 +22,26 @@ class google_docs_ir_attachment(osv.osv): return client - def create_empty_google_doc(self, cr, uid, model, id, context=None): + def create_empty_google_doc(self, cr, uid, model, id, type_doc): #import pdb; pdb.set_trace() '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity. @param cr: the current row from the database cursor. @param uid: the current user ID, for security checks. @param model: the current model name. - @param context: a standard dictionary for contextual values. + @param type_doc: text, spreadsheet or slide. @return the document object. @return -2 if the google_base_account hasn't been configured yet. ''' - if context is None: - context={} - # authenticate client = self._auth(cr, uid) if client == -2: return -2 - if 'type' not in context: - context['type'] = 'text' - # create the document in google docs - if context['type']=='slide': + if type_doc=='slide': local_resource = gdata.docs.data.Resource(gdata.docs.data.PRESENTATION_LABEL) - elif context['type']=='spreadsheet': + elif type_doc=='spreadsheet': local_resource = gdata.docs.data.Resource(gdata.docs.data.SPREADSHEET_LABEL) else: local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) @@ -55,8 +49,8 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': context['active_model'], #model, - 'res_id': context['active_id'], + 'model': model, + 'res_id': ids[0], 'type': 'url', #'name': TODO pending from the working config 'url': gdocs_resource.get_alternate_link().href @@ -64,7 +58,7 @@ class google_docs_ir_attachment(osv.osv): return gdocs_resource - def copy_gdoc(self, cr, uid, model, gdocs_resource_id, context=None): + def copy_gdoc(self, cr, uid, model, id): if context is None: context={} @@ -78,8 +72,8 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': context['active_model'], - 'res_id': context['active_id'], + 'model': model, + 'res_id': id[0], 'type': 'url', #'name': TODO pending from the working config 'url': copy_resource.get_alternate_link().href @@ -87,16 +81,6 @@ class google_docs_ir_attachment(osv.osv): return copy_resource - def gdoc_get(self, cr, uid, model, context=None): - google_docs_config_ref = self.pool.get('google.docs.config') - google_template_ids = google_docs_config_ref.search(cr, uid, [('model', '=', model)]) - if not google_template_ids: - # there isn't any template. Create an empty doc. - return self.create_gdoc(cr, uid, model, context) - - # otherwise, copy document from existing template - return self.copy_gdoc(cr, uid, model, google_template_ids[0].gdocs_resource_id) - class google_docs_config(osv.osv): _name = 'google.docs.config' @@ -117,21 +101,18 @@ class google_docs_config(osv.osv): class google_docs(osv.osv): _name = 'google.docs' - def doc_get(self, cr, uid, model, ids, context=None):# TODO fix logic here + def doc_get(self, cr, uid, model, id, type_doc):# TODO fix logic here google_docs_config_ref = self.pool.get('google.docs.config') ir_attachment_ref = self.pool.get('ir.attachment') google_docs_config = google_docs_config_ref.search(cr, uid, [('model_id', '=', model)]) - + if not google_docs_config: - google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, ids, context) - #else: - + google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, ids, type_doc) + else: + google_document = ir_attachment_ref.copy_gdoc(cr, uid, model, id) print google_docs_config if not google_docs_config: return -1 - - - return 0 From 65d257d4e9fd9bee1c6ab82e63f4f122aa2ffe41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 16:28:05 +0100 Subject: [PATCH 0055/1064] [imp] bzr revid: rlo@openerp.com-20120301152805-p7wosq6x4johbosj --- addons/google_docs/google_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 040dce932ea..34b4e5a16ed 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -107,7 +107,7 @@ class google_docs(osv.osv): google_docs_config = google_docs_config_ref.search(cr, uid, [('model_id', '=', model)]) if not google_docs_config: - google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, ids, type_doc) + google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc) else: google_document = ir_attachment_ref.copy_gdoc(cr, uid, model, id) From 2b774dddfb3bd5cfd43fccade36f6ac362ab25d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 09:15:13 +0100 Subject: [PATCH 0056/1064] [imp] js bzr revid: rlo@openerp.com-20120302081513-mzexq3vw6ftzw45s --- addons/google_docs/static/src/js/gdocs.js | 77 ++++++++++++----------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 9723aac2723..825bd577b66 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,40 +1,47 @@ openerp.google_docs = function(instance, session) { -instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ - init: function() { - this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); - this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc); - this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); - }, - on_add_text_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { - self.do_update(); - }); - }, - on_add_spreadsheet_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord, id], 'spreadsheet'], function(r) { - self.do_update(); - }); - }, - on_add_slide_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord,id], 'slide'], function(r) { - self.do_update(); - }); - } -}); + instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ + init: function() { + this._super.apply(this, arguments); + this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); + this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc); + this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); + }, + on_add_text_gdoc: function() { + console.log('on_add_text_gdoc:'); + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { + console.log('on_add_text_gdoc: return'); + self.do_update(); + }); + }, + on_add_spreadsheet_gdoc: function() { + console.log('on_add_spreadsheet_gdoc:'); + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + console.log('on_add_spreadsheet_gdoc:'); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) { + console.log('on_add_spreadsheet_gdoc: return'); + self.do_update(); + }); + }, + on_add_slide_gdoc: function() { + console.log ('on_add_slide_gdoc:'); + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'slide'], function(r) { + console.log('on_add_slide_gdoc: return'); + self.do_update(); + }); + } + }); }; From 9afb5cfe64b8f67e4ccfe6e048046fb6937aeef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 09:30:13 +0100 Subject: [PATCH 0057/1064] [imp] py bzr revid: rlo@openerp.com-20120302083013-4pvtkjma36ovlzhy --- addons/google_docs/google_docs.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 34b4e5a16ed..5e1f30e38fa 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -22,8 +22,8 @@ class google_docs_ir_attachment(osv.osv): return client - def create_empty_google_doc(self, cr, uid, model, id, type_doc): - #import pdb; pdb.set_trace() + def create_empty_google_doc(self, cr, uid, model, ids, type_doc): + import pdb; pdb.set_trace() '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity. @param cr: the current row from the database cursor. @param uid: the current user ID, for security checks. @@ -49,16 +49,16 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': model, + 'res_model': model, 'res_id': ids[0], 'type': 'url', - #'name': TODO pending from the working config + 'name': 'new_foo', # TODO pending from the working config 'url': gdocs_resource.get_alternate_link().href }) return gdocs_resource - def copy_gdoc(self, cr, uid, model, id): + def copy_gdoc(self, cr, uid, model, ids): if context is None: context={} @@ -72,10 +72,10 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': model, - 'res_id': id[0], + 'res_model': model, + 'res_id': ids[0], 'type': 'url', - #'name': TODO pending from the working config + 'name': 'copy_foo', # TODO pending from the working config 'url': copy_resource.get_alternate_link().href }) From f0775d762e80c2fdd48b689b253bb02db14e569a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 09:40:06 +0100 Subject: [PATCH 0058/1064] [imp] kind of working, just the configuration is missing bzr revid: rlo@openerp.com-20120302084006-m3qx6zfypl6g57r8 --- addons/google_docs/google_docs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 5e1f30e38fa..3f544c983bc 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -23,7 +23,6 @@ class google_docs_ir_attachment(osv.osv): return client def create_empty_google_doc(self, cr, uid, model, ids, type_doc): - import pdb; pdb.set_trace() '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity. @param cr: the current row from the database cursor. @param uid: the current user ID, for security checks. @@ -52,7 +51,7 @@ class google_docs_ir_attachment(osv.osv): 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': 'new_foo', # TODO pending from the working config + 'name': 'new_foo %s' % (type_doc,) , # TODO pending from the working config 'url': gdocs_resource.get_alternate_link().href }) @@ -75,7 +74,7 @@ class google_docs_ir_attachment(osv.osv): 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': 'copy_foo', # TODO pending from the working config + 'name': 'copy_foo %s' (type_doc,) , # TODO pending from the working config 'url': copy_resource.get_alternate_link().href }) From ff1fc1a7e9476f33e8a580c0c1f8942e5004bf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 11:35:05 +0100 Subject: [PATCH 0059/1064] [imp] bzr revid: rlo@openerp.com-20120302103505-em22nbb5chumfzuf --- addons/google_docs/__openerp__.py | 3 +- addons/google_docs/google_docs.py | 43 +++++++++++++++++------ addons/google_docs/static/src/js/gdocs.js | 18 ++++++---- 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py index 309ca13edc0..be8eb85d21e 100644 --- a/addons/google_docs/__openerp__.py +++ b/addons/google_docs/__openerp__.py @@ -1,8 +1,9 @@ { 'name': 'Google Docs', - 'version': '0.1', + 'version': '0.2', 'author': 'OpenERP SA', 'website': 'http://openerp.com', + 'category': 'Tools', 'data': [ 'google_docs.xml' ], diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 3f544c983bc..a63043e65ba 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -1,8 +1,31 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2012 OpenERP SA (). +# +# 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 . +# +############################################################################## + from osv import osv, fields -import gdata.docs.data -import gdata.docs.client -from gdata.client import RequestError -from gdata.docs.service import DOCUMENT_LABEL +try: + import gdata.docs.data + import gdata.docs.client + from gdata.client import RequestError + from gdata.docs.service import DOCUMENT_LABEL +except ImportError: + raise osv.except_osv(_('Google Docs Error!'), _('Please install gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list')) class google_docs_ir_attachment(osv.osv): _inherit = 'ir.attachment' @@ -12,7 +35,7 @@ class google_docs_ir_attachment(osv.osv): users_obj = self.pool.get('res.users') user = users_obj.browse(cr, uid, [uid])[0] if not user.gmail_user or not user.gmail_password: - return -2 + return False # login client = gdata.docs.client.DocsClient(source='openerp.com') @@ -29,13 +52,13 @@ class google_docs_ir_attachment(osv.osv): @param model: the current model name. @param type_doc: text, spreadsheet or slide. @return the document object. - @return -2 if the google_base_account hasn't been configured yet. + @return False if the google_base_account hasn't been configured yet. ''' # authenticate client = self._auth(cr, uid) - if client == -2: - return -2 + if client == False: + return False # create the document in google docs if type_doc=='slide': @@ -62,8 +85,8 @@ class google_docs_ir_attachment(osv.osv): context={} client = self._auth(cr, uid) - if client == -2: - return -2 + if client == False: + return False # fetch and copy the original document original_resource = client.get_resource_by_id(gdocs_resource_id) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 825bd577b66..63978868901 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -9,36 +9,40 @@ openerp.google_docs = function(instance, session) { this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); }, on_add_text_gdoc: function() { - console.log('on_add_text_gdoc:'); var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { - console.log('on_add_text_gdoc: return'); + console.log(r); + if (r == 'False') { + var params = { + error: response, + message: "The user google credentials are not set yet. Contact your administrator for help." + } + $(openerp.web.qweb.render("DialogWarning", params)).dialog({ + title: "User Google credentials are not yet set.", + modal: true, + }); + } self.do_update(); }); }, on_add_spreadsheet_gdoc: function() { - console.log('on_add_spreadsheet_gdoc:'); var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - console.log('on_add_spreadsheet_gdoc:'); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) { - console.log('on_add_spreadsheet_gdoc: return'); self.do_update(); }); }, on_add_slide_gdoc: function() { - console.log ('on_add_slide_gdoc:'); var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'slide'], function(r) { - console.log('on_add_slide_gdoc: return'); self.do_update(); }); } From b4688cd91ba74dd4317539e63db82c5a8a787632 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 5 Mar 2012 10:41:17 +0530 Subject: [PATCH 0060/1064] [IMP]: Purchase: Changed string for invoiced field bzr revid: mma@tinyerp.com-20120305051117-hmgatham6qkl3z76 --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index eaf3e39ae3c..3b832cca7aa 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -180,7 +180,7 @@ class purchase_order(osv.osv): 'picking_ids': fields.one2many('stock.picking', 'purchase_id', 'Picking List', readonly=True, help="This is the list of picking list that have been generated for this purchase"), 'shipped':fields.boolean('Received', readonly=True, select=True, help="It indicates that a picking has been done"), 'shipped_rate': fields.function(_shipped_rate, string='Received', type='float'), - 'invoiced': fields.function(_invoiced, string='Invoiced & Paid', type='boolean', help="It indicates that an invoice has been paid"), + 'invoiced': fields.function(_invoiced, string='Invoice Received', type='boolean', help="It indicates that an invoice has been paid"), 'invoiced_rate': fields.function(_invoiced_rate, string='Invoiced', type='float'), 'invoice_method': fields.selection([('manual','Based on Purchase Order lines'),('order','Based on generated draft invoice'),('picking','Based on receptions')], 'Invoicing Control', required=True, help="Based on Purchase Order lines: place individual lines in 'Invoice Control > Based on P.O. lines' from where you can selectively create an invoice.\n" \ From 34d47a13ea5c3af61eb21501d495c1db74b6bcb2 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 5 Mar 2012 10:49:52 +0530 Subject: [PATCH 0061/1064] [REM]: Purchase: Removed print button [IMP]: purchase: renamed Receive product button name bzr revid: mma@tinyerp.com-20120305051952-46lj68covxrod54s --- addons/purchase/purchase.py | 20 -------------------- addons/purchase/purchase_view.xml | 3 +-- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 3b832cca7aa..647b744e1c4 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -322,26 +322,6 @@ class purchase_order(osv.osv): 'res_id': pick_ids and pick_ids[0] or False, } - def view_report(self, cr, uid, ids, context=None): - wf_service = netsvc.LocalService("workflow") - if context is None: - context = {} - for id in ids: - wf_service.trg_validate(uid, 'purchase.order', id, 'send_rfq', cr) - - data = self.read(cr, uid, ids, [], context=context)[0] - datas = { - 'ids': [], - 'model': 'purchase.order', - 'form': data - } - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'purchase.quotation', - 'nodestroy': True, - 'datas': datas, - } - def wkf_approve_order(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(self,cr,uid,context=context)}) return True diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index ad064bab696..6dbdcfeeb0c 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -197,7 +197,6 @@ +
From f77cecb90c39041267455b05b23764f85e6783a5 Mon Sep 17 00:00:00 2001 From: MVA Date: Tue, 20 Mar 2012 17:03:20 +0100 Subject: [PATCH 0095/1064] [IMP] add oauth bzr revid: mva@openerp.com-20120320160320-tykxuosgpq1r28ag --- addons/google_docs/google_docs.py | 52 +++++++++++++++------ addons/google_docs/res_config_user_view.xml | 2 - addons/google_docs/static/src/js/gdocs.js | 1 - addons/google_docs/static/src/xml/gdocs.xml | 7 ++- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index d37f28eb349..09bb1879bdd 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -24,6 +24,9 @@ try: import gdata.docs.client from gdata.client import RequestError from gdata.docs.service import DOCUMENT_LABEL + import gdata.auth + import gdata.docs.service + import webbrowser except ImportError: raise osv.except_osv(_('Google Docs Error!'), _('Please install gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list')) @@ -56,11 +59,15 @@ class google_docs_ir_attachment(osv.osv): ''' # authenticate + + ''' client = self._auth(cr, uid) if client == False: - return False #return an error - - + return False + ''' + client = self.pool.get('google.oauth') + client.login(cr,uid,ids,context=context) + # create the document in google docs if type_doc=='slide': local_resource = gdata.docs.data.Resource(gdata.docs.data.PRESENTATION_LABEL) @@ -68,8 +75,9 @@ class google_docs_ir_attachment(osv.osv): local_resource = gdata.docs.data.Resource(gdata.docs.data.SPREADSHEET_LABEL) else: local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) - - gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/') + + #create a new doc in Google Docs + gdocs_resource = client.Post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/') # register into the db self.create(cr, uid, { @@ -117,14 +125,13 @@ class google_docs(osv.osv): return -1 - class config(osv.osv): _name = 'google.docs.config' _description = "Google Docs templates config" _columns = { 'context_model_id': fields.many2one('ir.model', 'Model'), - 'context_gdocs_resource_id': fields.char('Google resource ID', size=64), + 'context_gdocs_resource_id': fields.char('Google resource ID', size=64,help='This is the id of the template document you kind find it in the URL'), 'context_name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'), 'context_name': fields.char('Name', size=64, help='This is the attachment\'s name. As well, it appears on the panel.'), 'context_multiple': fields.boolean('Multiple documents') @@ -135,16 +142,35 @@ class config(osv.osv): 'context_name': 'pr_%(name)', 'context_multiple': False, } - def has_config_set(self, cr, uid, model,context=None): - print model - import pdb - pdb.set_trace() - def get_config(self, cr, uid, model): domain = [('context_model_id', '=', model)] if self.search_count(cr, uid, domain) != 0: return False else: return self.search(cr, uid, domain) - config() + + + +class oauth (osv.osv): + _name = 'google.oauth' + def login(self,cr,uid,ids,context=None): + consumer_key = '751376579939.apps.googleusercontent.com' + consumer_secret = '_KGpgyO8DZIseyG3N-j-h8gN' + gd_client = gdata.docs.service.DocsService() + #Set OAuth input parameters + gd_client.SetOAuthInputParameters(gdata.auth.OAuthSignatureMethod.HMAC_SHA1,consumer_key, consumer_secret=consumer_secret) + #Fetch OAuth Request token + request_token = gd_client.FetchOAuthRequestToken() + #Set the fetched OAuth token + gd_client.SetOAuthToken(request_token) + #Generate OAuth authorization URL + auth_url = gd_client.GenerateOAuthAuthorizationURL() + webbrowser.open(auth_url) + print gd_client.SetOAuthToken(request_token) + consumer_key = raw_input('Please enter consumer key: ') + + #Upgrade to an OAuth access token + gd_client.UpgradeToOAuthAccessToken() + #Access Token + gd_client.token_store.find_token(request_token.scopes[0]) diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml index 09fa3ae4dda..9920cc6965b 100644 --- a/addons/google_docs/res_config_user_view.xml +++ b/addons/google_docs/res_config_user_view.xml @@ -29,8 +29,6 @@
- - Models configuration google.docs.config diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index c6bc1caa5ed..c32dc4c8829 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -12,7 +12,6 @@ openerp.google_docs = function(instance, session) { // if the configuration isn't set, the buttons should be hidden. if (r==false) { $('.oe_google_docs_text_button').css('display', 'none'); - return; } diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 1182e9f8421..927b35f115d 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -5,14 +5,13 @@ - - From 2f1baf8f40908b54db0950f596fbe98e35d7cf9a Mon Sep 17 00:00:00 2001 From: MVA Date: Wed, 28 Mar 2012 11:34:56 +0200 Subject: [PATCH 0107/1064] [IMP] replace the static name in the document name bzr revid: mva@openerp.com-20120328093456-7wgnnvizvg0r747i --- addons/google_docs/google_docs.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index bba8524023a..8c882a3422a 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -61,13 +61,13 @@ class google_docs_ir_attachment(osv.osv): local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) #create a new doc in Google Docs gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/') - name = gdocs_resource.title + # register into the db self.create(cr, uid, { 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': name, + 'name': ('new_%s' % gdocs_resource.title.text), 'url': gdocs_resource.get_alternate_link().href, },context=context) @@ -86,8 +86,7 @@ class google_docs_ir_attachment(osv.osv): 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': 'file_name', - 'name': 'copy_foo' , #TODO pending from the working config + 'name': 'copy_%s' % gdocs_resource.title.text, 'url': copy_resource.get_alternate_link().href },context=context) From c46481f1deb9e692058cd1ed42f9b96127ad6556 Mon Sep 17 00:00:00 2001 From: MVA Date: Wed, 28 Mar 2012 11:47:18 +0200 Subject: [PATCH 0108/1064] [IMP] add a raise error to check if configuration is ok bzr revid: mva@openerp.com-20120328094718-xk5brbglmeo49cid --- addons/google_docs/google_docs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 8c882a3422a..13d9634dcf8 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -43,7 +43,8 @@ class google_docs_ir_attachment(osv.osv): user_config = google_pool.default_get( cr, uid, {'user' : '' , 'password' : ''},context=context) #login gmail account client = google_pool.google_login( user_config['user'], user_config['password'], type='docs_client', context=context) - + if not client: + raise osv.except_osv(('Google Docs Error!'),("Check your google configuration in users/synchronization") ) return client def create_empty_google_doc(self, cr, uid, model, ids, type_doc,context=None): From 774aa481c2f60df74d8b01f03b00cad002d8e105 Mon Sep 17 00:00:00 2001 From: MVA Date: Wed, 28 Mar 2012 12:10:15 +0200 Subject: [PATCH 0109/1064] [IMP] correct the copy with the good document title bzr revid: mva@openerp.com-20120328101015-4v1fit8z3cno9y91 --- addons/google_docs/google_docs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 13d9634dcf8..1e6071cd716 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -78,16 +78,17 @@ class google_docs_ir_attachment(osv.osv): def copy_gdoc(self, cr, uid, model, google_res_id, ids,context=None): client = self._auth(cr, uid) # fetch and copy the original document + print 'test' original_resource = client.get_resource_by_id(google_res_id) - #copy the document you choose in the configuration - copy_resource = client.copy_resource(original_resource,'copy_foo') + #copy the document you choose in the configuration + copy_resource = client.copy_resource(original_resource,'copy_%s' % original_resource.title.text) # register into the db self.create(cr, uid, { 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': 'copy_%s' % gdocs_resource.title.text, + 'name': 'copy_%s' % original_resource.title.text, 'url': copy_resource.get_alternate_link().href },context=context) From 95a86ec57dfb22569ed9b1bd8ea36ae44f9e6856 Mon Sep 17 00:00:00 2001 From: MVA Date: Wed, 28 Mar 2012 13:41:13 +0200 Subject: [PATCH 0110/1064] [IMP] add some comment and add a raise if the google resource is not correct bzr revid: mva@openerp.com-20120328114113-vspkkbvpdfnt3mho --- addons/google_docs/google_docs.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 1e6071cd716..6e91ee64658 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -76,13 +76,18 @@ class google_docs_ir_attachment(osv.osv): return 1 def copy_gdoc(self, cr, uid, model, google_res_id, ids,context=None): + ''' + copy an existing document in google docs + ''' + client = self._auth(cr, uid) # fetch and copy the original document - print 'test' - original_resource = client.get_resource_by_id(google_res_id) - #copy the document you choose in the configuration - copy_resource = client.copy_resource(original_resource,'copy_%s' % original_resource.title.text) - + try: + original_resource = client.get_resource_by_id(google_res_id) + #copy the document you choose in the configuration + copy_resource = client.copy_resource(original_resource,'copy_%s' % original_resource.title.text) + except: + raise osv.except_osv(('Google Docs Error!'),("Your ressource id is not correct. You can find the id in the google docs URL") ) # register into the db self.create(cr, uid, { 'res_model': model, @@ -126,6 +131,10 @@ class config(osv.osv): 'context_name': 'pr_%(name)', } def get_config(self, cr, uid, model): + ''' + Method use with the js to hidde or show the add google doc button + @return : list of configuration ids or false + ''' domain = [('context_model_id', '=', model)] if self.search_count(cr, uid, domain) != 0: return False From d4152e970378881f82373d4e09c8d23eea1d2535 Mon Sep 17 00:00:00 2001 From: MVA Date: Fri, 30 Mar 2012 16:51:49 +0200 Subject: [PATCH 0111/1064] [IMP] change js remove unusfull code and the file name configuration bzr revid: mva@openerp.com-20120330145149-04gqj8lvleb9pa53 --- addons/google_docs/google_docs.py | 39 ++++++++++++--------- addons/google_docs/res_config_user_view.xml | 11 +++--- addons/google_docs/static/src/js/gdocs.js | 20 ++++------- addons/google_docs/static/src/xml/gdocs.xml | 3 +- 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 6e91ee64658..3045cbab279 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -47,7 +47,7 @@ class google_docs_ir_attachment(osv.osv): raise osv.except_osv(('Google Docs Error!'),("Check your google configuration in users/synchronization") ) return client - def create_empty_google_doc(self, cr, uid, model, ids, type_doc,context=None): + def create_empty_google_doc(self, cr, uid, name_gdocs, model, ids, type_doc,context=None): '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity. @param cr: the current row from the database cursor. @param uid: the current user ID, for security checks. @@ -62,24 +62,22 @@ class google_docs_ir_attachment(osv.osv): local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) #create a new doc in Google Docs gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/') - # register into the db self.create(cr, uid, { 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': ('new_%s' % gdocs_resource.title.text), + 'name': 'Google Doc', 'url': gdocs_resource.get_alternate_link().href, },context=context) return 1 - def copy_gdoc(self, cr, uid, model, google_res_id, ids,context=None): + def copy_gdoc(self, cr, uid, name_gdocs, model, google_res_id, ids,context=None): ''' copy an existing document in google docs ''' - client = self._auth(cr, uid) # fetch and copy the original document try: @@ -93,7 +91,7 @@ class google_docs_ir_attachment(osv.osv): 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': 'copy_%s' % original_resource.title.text, + 'name': name_gdocs, 'url': copy_resource.get_alternate_link().href },context=context) @@ -104,14 +102,20 @@ class google_docs(osv.osv): def doc_get(self, cr, uid, model, id, type_doc,context=None): ir_attachment_ref = self.pool.get('ir.attachment') - google_docs_config = self.pool.get('google.docs.config').search(cr, uid, [('context_model_id', '=', model)]) + pool_gdoc_config = self.pool.get('google.docs.config') + google_docs_config = pool_gdoc_config.search(cr, uid, [('model_id', '=', model)]) + name_gdocs='' + if google_docs_config: + name_gdocs = pool_gdoc_config.browse(cr,uid,google_docs_config,context=context)[0].name_template + print name_gdocs + # check if a model is configurate with a template if google_docs_config: for google_config in self.pool.get('google.docs.config').browse(cr,uid,google_docs_config,context=context): - google_res_id = google_config.context_gdocs_resource_id - google_document = ir_attachment_ref.copy_gdoc(cr, uid, model,google_res_id, id) + google_res_id = google_config.gdocs_resource_id + google_document = ir_attachment_ref.copy_gdoc(cr, uid,name_gdocs ,model,google_res_id, id) else: - google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc) + google_document = ir_attachment_ref.create_empty_google_doc(cr, uid,name_gdocs, model, id, type_doc) return -1 @@ -120,24 +124,25 @@ class config(osv.osv): _description = "Google Docs templates config" _columns = { - 'context_model_id': fields.many2one('ir.model', 'Model'), - 'context_gdocs_resource_id': fields.char('Google resource ID', size=64,help='This is the id of the template document you kind find it in the URL'), - 'context_name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'), - 'context_name': fields.char('Name', size=64, help='This is the attachment\'s name. As well, it appears on the panel.'), + 'model_id': fields.many2one('ir.model', 'Model'), + 'gdocs_resource_id': fields.char('Google resource ID', size=64,help='This is the id of the template document you kind find it in the URL'), + 'name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'), } _defaults = { - 'context_name_template': 'Google Document', - 'context_name': 'pr_%(name)', + 'name_template': 'pr_%(name)', } def get_config(self, cr, uid, model): ''' Method use with the js to hidde or show the add google doc button @return : list of configuration ids or false ''' - domain = [('context_model_id', '=', model)] + domain = [('model_id', '=', model)] if self.search_count(cr, uid, domain) != 0: return False + # attached only one document to a model + if self.pool.get('ir.attachment').search_count(cr,uid,[('url','like','https://docs.google.com/document%')]) !=0: + return False else: return self.search(cr, uid, domain) diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml index be56f324d2d..46abe5b2d80 100644 --- a/addons/google_docs/res_config_user_view.xml +++ b/addons/google_docs/res_config_user_view.xml @@ -10,7 +10,7 @@ tree - + @@ -21,10 +21,9 @@ form - - - - + + + @@ -34,7 +33,7 @@ google.docs.config ir.actions.act_window form - + diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index c32dc4c8829..9dc4f5c88d3 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -8,36 +8,28 @@ openerp.google_docs = function(instance, session) { var self = this; var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) { - console.log(r); // if the configuration isn't set, the buttons should be hidden. if (r==false) { - $('.oe_google_docs_text_button').css('display', 'none'); + $('.oe_google_docs_text_button',this.$element).hide(); return; } var attachment = new instance.web.DataSet(this, 'ir.attachment', self.view.dataset.get_context()); attachment.call('copy_gdoc', [self.view.dataset.model, [self.view.datarecord.id]], function(res) { - console.log(res); }); }); }, + start: function() { + this._super(); + console.log($('.oe_google_docs_text_button',this.$element)) + $('.oe_google_docs_text_button',this.$element) + }, on_add_text_gdoc: function() { var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { - console.log(r); - if (r == 'False') { - var params = { - error: response, - message: "The user google credentials are not set yet. Contact your administrator for help." - } - $(openerp.web.qweb.render("DialogWarning", params)).dialog({ - title: "User Google credentials are not yet set.", - modal: true, - }); - } self.do_update(); }); }, diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index acb352bf9b0..2de7efcbd43 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -5,7 +5,8 @@ From 368ea54a148c2808a71fcbf3fb0656dfdb685c02 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Mon, 2 Apr 2012 11:22:26 +0530 Subject: [PATCH 0112/1064] [IMP] Marketing: remove newline and set the group cols and colspan bzr revid: jap@tinyerp.com-20120402055226-93t79bgr1ucd7dpa --- addons/marketing/res_config_view.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/addons/marketing/res_config_view.xml b/addons/marketing/res_config_view.xml index c87969ca3f6..c3497a689a8 100644 --- a/addons/marketing/res_config_view.xml +++ b/addons/marketing/res_config_view.xml @@ -8,14 +8,9 @@
- + - - - - - From 162092e8b0abd856894146aa2fce38c18b8dad11 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Mon, 2 Apr 2012 11:34:18 +0530 Subject: [PATCH 0113/1064] [IMP] base_setup: add new fields bzr revid: jap@tinyerp.com-20120402060418-hpdzd73eal67qtgs --- addons/base_setup/res_config.py | 6 ++++++ addons/base_setup/res_config_view.xml | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/addons/base_setup/res_config.py b/addons/base_setup/res_config.py index 8829d8ef156..a0396f3f169 100644 --- a/addons/base_setup/res_config.py +++ b/addons/base_setup/res_config.py @@ -33,6 +33,12 @@ class general_configuration(osv.osv_memory): help ="""It installs the portal module."""), 'module_share': fields.boolean('Share', help ="""It installs the share module."""), + 'module_base_report_designer': fields.boolean('Customise your OpenERP Report with OpenOffice', + help ="""It installs the base_report_designer module."""), + 'module_report_webkit': fields.boolean('Design OpenERP report in HTML', + help ="""It installs the report_webkit module."""), + 'module_report_webkit_sample': fields.boolean('Samples of HTML report design', + help ="""It installs the report_webkit_sample module."""), } general_configuration() diff --git a/addons/base_setup/res_config_view.xml b/addons/base_setup/res_config_view.xml index ede184b9aaa..7456b64d2f6 100644 --- a/addons/base_setup/res_config_view.xml +++ b/addons/base_setup/res_config_view.xml @@ -8,16 +8,18 @@
- -