From 20d9f75193f197ea8ff2a5c1d16cfaac21a85891 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 11 Oct 2012 12:31:28 +0530 Subject: [PATCH 01/11] [FIX] sale_stock : Traceback when paying invoice by percentage in SO, after installing sale_stock. bzr revid: mdi@tinyerp.com-20121011070128-z81rzss16d2no59i --- addons/sale_stock/sale_stock.py | 84 ++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index ce6894318c4..e17ddba146b 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -635,34 +635,64 @@ class sale_order_line(osv.osv): class sale_advance_payment_inv(osv.osv_memory): _inherit = "sale.advance.payment.inv" - def _create_invoices(self, cr, uid, inv_values, sale_id, context=None): - result = super(sale_advance_payment_inv, self)._create_invoices(cr, uid, inv_values, sale_id, context=context) + def create_invoices(self, cr, uid, ids, context=None): + """ create invoices for the active sale orders """ sale_obj = self.pool.get('sale.order') - sale_line_obj = self.pool.get('sale.order.line') + act_window = self.pool.get('ir.actions.act_window') wizard = self.browse(cr, uid, ids[0], context) - sale = sale_obj.browse(cr, uid, sale_id, context=context) - if sale.order_policy == 'postpaid': - raise osv.except_osv( - _('Error!'), - _("You cannot make an advance on a sales order \ - that is defined as 'Automatic Invoice after delivery'.")) + sale_ids = context.get('active_ids', []) + if wizard.advance_payment_method == 'all': + # create the final invoices of the active sale orders + res = sale_obj.manual_invoice(cr, uid, sale_ids, context) + if context.get('open_invoices', False): + return res + return {'type': 'ir.actions.act_window_close'} - # If invoice on picking: add the cost on the SO - # If not, the advance will be deduced when generating the final invoice - line_name = inv_values.get('invoice_line') and inv_values.get('invoice_line')[2].get('name') or '' - line_tax = inv_values.get('invoice_line') and inv_values.get('invoice_line')[2].get('invoice_line_tax_id') or False - if sale.order_policy == 'picking': - vals = { - 'order_id': sale.id, - 'name': line_name, - 'price_unit': -inv_amount, - 'product_uom_qty': wizard.qtty or 1.0, - 'product_uos_qty': wizard.qtty or 1.0, - 'product_uos': res.get('uos_id', False), - 'product_uom': res.get('uom_id', False), - 'product_id': wizard.product_id.id or False, - 'discount': False, - 'tax_id': line_tax, + if wizard.advance_payment_method == 'lines': + # open the list view of sale order lines to invoice + res = act_window.for_xml_id(cr, uid, 'sale', 'action_order_line_tree2', context) + res['context'] = { + 'search_default_uninvoiced': 1, + 'search_default_order_id': sale_ids and sale_ids[0] or False, } - sale_line_obj.create(cr, uid, vals, context=context) - return result + return res + assert wizard.advance_payment_method in ('fixed', 'percentage') + + inv_ids = [] + for sale_id, inv_values in self._prepare_advance_invoice_vals(cr, uid, ids, context=context): + + sale_obj = self.pool.get('sale.order') + sale_line_obj = self.pool.get('sale.order.line') + sale = sale_obj.browse(cr, uid, sale_id, context=context) + if sale.order_policy == 'postpaid': + raise osv.except_osv( + _('Error!'), + _("You cannot make an advance on a sales order \ + that is defined as 'Automatic Invoice after delivery'.")) + + # If invoice on picking: add the cost on the SO + # If not, the advance will be deduced when generating the final invoice + line_name = inv_values.get('invoice_line') and inv_values.get('invoice_line')[0][2].get('name') or '' + line_tax = inv_values.get('invoice_line') and inv_values.get('invoice_line')[0][2].get('invoice_line_tax_id') or False + if sale.order_policy == 'picking': + vals = { + 'order_id': sale.id, + 'name': line_name, + 'price_unit': -inv_amount, + 'product_uom_qty': wizard.qtty or 1.0, + 'product_uos_qty': wizard.qtty or 1.0, + 'product_uos': res.get('uos_id', False), + 'product_uom': res.get('uom_id', False), + 'product_id': wizard.product_id.id or False, + 'discount': False, + 'tax_id': line_tax, + } + sale_line_obj.create(cr, uid, vals, context=context) + + inv_ids.append(self._create_invoices(cr, uid, inv_values, sale_id, context=context)) + + if context.get('open_invoices', False): + return self.open_invoices( cr, uid, ids, inv_ids, context=context) + return {'type': 'ir.actions.act_window_close'} + res = super(sale_advance_payment_inv, self).create_invoices(self, cr, uid, ids, context=context) + return res \ No newline at end of file From dd95ec66de42af9368b33e80d56525eafcecff7d Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Fri, 12 Oct 2012 11:56:42 +0530 Subject: [PATCH 02/11] [IMP] crm : In the kanban view of products, rename 'Available' to 'Future Quantity' to be coherent with the tree+form view. bzr revid: mdi@tinyerp.com-20121012062642-x09qndcdz7ksxyqp --- addons/stock/product_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 9c44b18cee4..209da1507c2 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -219,7 +219,7 @@ From 9024355b3d6e6290153b1c81b2d262481ed22c8d Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Fri, 12 Oct 2012 12:00:31 +0530 Subject: [PATCH 03/11] [IMP] crm : Added a tooltip for 'date_deadline'. bzr revid: mdi@tinyerp.com-20121012063031-dt8kamlt4k4d6i5f --- addons/crm/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 48c6491a7c3..75a37b3f4cd 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -236,7 +236,7 @@ class crm_lead(base_stage, format_address, osv.osv): 'ref': fields.reference('Reference', selection=crm._links_get, size=128), 'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128), 'phone': fields.char("Phone", size=64), - 'date_deadline': fields.date('Expected Closing'), + 'date_deadline': fields.date('Expected Closing', help="Estimate of the date on which the opportunity will be completed."), 'date_action': fields.date('Next Action Date', select=True), 'title_action': fields.char('Next Action', size=64), 'color': fields.integer('Color Index'), From f21d41e7b5bdb93241cbf5783962b17e8e335375 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Fri, 12 Oct 2012 12:07:57 +0530 Subject: [PATCH 04/11] [IMP] account : Overdue payment report 'There is nothing due with this customer' is looking weird without fullstop. bzr revid: mdi@tinyerp.com-20121012063757-z9r295gdu25maugn --- addons/account/report/account_print_overdue.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 2d4238823da..02f9854fd0e 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -282,7 +282,7 @@
- [[ getLines(o) and removeParentNode('section')]]There is nothing due with this customer + [[ getLines(o) and removeParentNode('section')]]There is nothing due with this customer.
From 3942d75ac2da0d11e95870264abb1b0e927947bf Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 15 Oct 2012 15:33:03 +0530 Subject: [PATCH 05/11] [FIX] sale_stock : Traceback when paying invoice by percentage in SO, after installing sale_stock. bzr revid: mdi@tinyerp.com-20121015100303-cxbttr1wbdir3h8r --- addons/sale_stock/sale_stock.py | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index e17ddba146b..6d143245177 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -638,31 +638,10 @@ class sale_advance_payment_inv(osv.osv_memory): def create_invoices(self, cr, uid, ids, context=None): """ create invoices for the active sale orders """ sale_obj = self.pool.get('sale.order') - act_window = self.pool.get('ir.actions.act_window') + sale_line_obj = self.pool.get('sale.order.line') wizard = self.browse(cr, uid, ids[0], context) - sale_ids = context.get('active_ids', []) - if wizard.advance_payment_method == 'all': - # create the final invoices of the active sale orders - res = sale_obj.manual_invoice(cr, uid, sale_ids, context) - if context.get('open_invoices', False): - return res - return {'type': 'ir.actions.act_window_close'} - if wizard.advance_payment_method == 'lines': - # open the list view of sale order lines to invoice - res = act_window.for_xml_id(cr, uid, 'sale', 'action_order_line_tree2', context) - res['context'] = { - 'search_default_uninvoiced': 1, - 'search_default_order_id': sale_ids and sale_ids[0] or False, - } - return res - assert wizard.advance_payment_method in ('fixed', 'percentage') - - inv_ids = [] for sale_id, inv_values in self._prepare_advance_invoice_vals(cr, uid, ids, context=context): - - sale_obj = self.pool.get('sale.order') - sale_line_obj = self.pool.get('sale.order.line') sale = sale_obj.browse(cr, uid, sale_id, context=context) if sale.order_policy == 'postpaid': raise osv.except_osv( @@ -688,11 +667,4 @@ class sale_advance_payment_inv(osv.osv_memory): 'tax_id': line_tax, } sale_line_obj.create(cr, uid, vals, context=context) - - inv_ids.append(self._create_invoices(cr, uid, inv_values, sale_id, context=context)) - - if context.get('open_invoices', False): - return self.open_invoices( cr, uid, ids, inv_ids, context=context) - return {'type': 'ir.actions.act_window_close'} - res = super(sale_advance_payment_inv, self).create_invoices(self, cr, uid, ids, context=context) - return res \ No newline at end of file + return super(sale_advance_payment_inv, self).create_invoices(cr, uid, ids, context=context) From fd2deaa1ce99ef63fa343301456c011e160b41ea Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Mon, 22 Oct 2012 17:52:03 +0530 Subject: [PATCH 06/11] [IMP] sale_stock: improve the code bzr revid: psi@tinyerp.com-20121022122203-4hv479pf3bbq1kwz --- addons/sale_stock/sale_stock.py | 58 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 6d143245177..dc3f1bbfeaf 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -635,36 +635,34 @@ class sale_order_line(osv.osv): class sale_advance_payment_inv(osv.osv_memory): _inherit = "sale.advance.payment.inv" - def create_invoices(self, cr, uid, ids, context=None): - """ create invoices for the active sale orders """ + def _create_invoices(self, cr, uid, inv_values, sale_id, context=None): + result = super(sale_advance_payment_inv, self)._create_invoices(cr, uid, inv_values, sale_id, context=context) sale_obj = self.pool.get('sale.order') sale_line_obj = self.pool.get('sale.order.line') - wizard = self.browse(cr, uid, ids[0], context) + wizard = self.browse(cr, uid, [result], context) + sale = sale_obj.browse(cr, uid, sale_id, context=context) + if sale.order_policy == 'postpaid': + raise osv.except_osv( + _('Error!'), + _("You cannot make an advance on a sales order \ + that is defined as 'Automatic Invoice after delivery'.")) - for sale_id, inv_values in self._prepare_advance_invoice_vals(cr, uid, ids, context=context): - sale = sale_obj.browse(cr, uid, sale_id, context=context) - if sale.order_policy == 'postpaid': - raise osv.except_osv( - _('Error!'), - _("You cannot make an advance on a sales order \ - that is defined as 'Automatic Invoice after delivery'.")) - - # If invoice on picking: add the cost on the SO - # If not, the advance will be deduced when generating the final invoice - line_name = inv_values.get('invoice_line') and inv_values.get('invoice_line')[0][2].get('name') or '' - line_tax = inv_values.get('invoice_line') and inv_values.get('invoice_line')[0][2].get('invoice_line_tax_id') or False - if sale.order_policy == 'picking': - vals = { - 'order_id': sale.id, - 'name': line_name, - 'price_unit': -inv_amount, - 'product_uom_qty': wizard.qtty or 1.0, - 'product_uos_qty': wizard.qtty or 1.0, - 'product_uos': res.get('uos_id', False), - 'product_uom': res.get('uom_id', False), - 'product_id': wizard.product_id.id or False, - 'discount': False, - 'tax_id': line_tax, - } - sale_line_obj.create(cr, uid, vals, context=context) - return super(sale_advance_payment_inv, self).create_invoices(cr, uid, ids, context=context) + # If invoice on picking: add the cost on the SO + # If not, the advance will be deduced when generating the final invoice + line_name = inv_values.get('invoice_line') and inv_values.get('invoice_line')[0][2].get('name') or '' + line_tax = inv_values.get('invoice_line') and inv_values.get('invoice_line')[0][2].get('invoice_line_tax_id') or False + if sale.order_policy == 'picking': + vals = { + 'order_id': sale.id, + 'name': line_name, + 'price_unit': -inv_amount, + 'product_uom_qty': wizard.qtty or 1.0, + 'product_uos_qty': wizard.qtty or 1.0, + 'product_uos': res.get('uos_id', False), + 'product_uom': res.get('uom_id', False), + 'product_id': wizard.product_id.id or False, + 'discount': False, + 'tax_id': line_tax, + } + sale_line_obj.create(cr, uid, vals, context=context) + return result From b287ead46d76d7e5c6c14e7e2e9ee36012913a76 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Thu, 25 Oct 2012 16:57:30 +0530 Subject: [PATCH 07/11] [IMP] event: changed domain for field 'log_ids' bzr revid: cha@tinyerp.com-20121025112730-r9i812f5twmszh22 --- addons/event/event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/event/event.py b/addons/event/event.py index 0cff38fc9f8..b79d86ea35e 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -338,7 +338,7 @@ class event_registration(osv.osv): 'date_closed': fields.datetime('Attended Date', readonly=True), 'date_open': fields.datetime('Registration Date', readonly=True), 'reply_to': fields.related('event_id','reply_to',string='Reply-to Email', type='char', size=128, readonly=True,), - 'log_ids': fields.one2many('mail.message', 'res_id', 'Logs', domain=[('email_from', '=', False),('model','=',_name)]), + 'log_ids': fields.one2many('mail.message', 'res_id', 'Logs', domain=[('model','=',_name)]), 'event_end_date': fields.related('event_id','date_end', type='datetime', string="Event End Date", readonly=True), 'event_begin_date': fields.related('event_id', 'date_begin', type='datetime', string="Event Start Date", readonly=True), 'user_id': fields.many2one('res.users', 'User', states={'done': [('readonly', True)]}), From 435a1bd673e724dd18acfb5af8d32cc5aac6fcd0 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Thu, 25 Oct 2012 18:20:37 +0530 Subject: [PATCH 08/11] [FIX] pad: solved the issue of getting traceback on duplication of task bzr revid: cha@tinyerp.com-20121025125037-kulp10g5kx5m1d0f --- addons/pad/pad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/pad/pad.py b/addons/pad/pad.py index 0cbb6107979..dbdc393e043 100644 --- a/addons/pad/pad.py +++ b/addons/pad/pad.py @@ -86,7 +86,7 @@ class pad_common(osv.osv_memory): def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} - for k,v in self._all_columns: + for k,v in self._all_columns.items(): field = v.column if hasattr(field,'pad_content_field'): pad = self.pad_generate_url(cr, uid, context) From 4229bb14f8c87d93efb6ae2a1f47bdfab6fc6777 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Mon, 29 Oct 2012 11:57:23 +0530 Subject: [PATCH 09/11] [IMP] pad: revert my change bzr revid: cha@tinyerp.com-20121029062723-b0om6b3a5b35gh0z --- addons/pad/pad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/pad/pad.py b/addons/pad/pad.py index dbdc393e043..c7641540a0a 100644 --- a/addons/pad/pad.py +++ b/addons/pad/pad.py @@ -86,7 +86,7 @@ class pad_common(osv.osv_memory): def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} - for k,v in self._all_columns.items(): + for k, v in self._all_columns.iteritems(): field = v.column if hasattr(field,'pad_content_field'): pad = self.pad_generate_url(cr, uid, context) From fa6b3067a8b78f7a0c79e13ec05bf41fa0accc35 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 29 Oct 2012 18:49:38 +0530 Subject: [PATCH 10/11] [IMP]pad : fix the pad issue bzr revid: mma@tinyerp.com-20121029131938-0k92cijgqorcnjnh --- addons/pad/pad.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/pad/pad.py b/addons/pad/pad.py index c7641540a0a..d2b9b6cd27e 100644 --- a/addons/pad/pad.py +++ b/addons/pad/pad.py @@ -8,6 +8,8 @@ from tools.translate import _ from openerp.tools.misc import html2plaintext from py_etherpad import EtherpadLiteClient +_logger = logging.getLogger(__name__) + class pad_common(osv.osv_memory): _name = 'pad.common' @@ -59,10 +61,13 @@ class pad_common(osv.osv_memory): def pad_get_content(self, cr, uid, url, context=None): content = '' if url: - page = urllib2.urlopen('%s/export/html'%url).read() - mo = re.search('(.*)',page) - if mo: - content = mo.group(1) + try: + page = urllib2.urlopen('%s/export/html'%url).read() + mo = re.search('(.*)',page) + if mo: + content = mo.group(1) + except: + _logger.warning("No url found '%s'.", url) return content # TODO From faa216451a7b01c900d65d85d99f47166c7799c1 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 29 Oct 2012 18:55:27 +0530 Subject: [PATCH 11/11] [IMP]pad : fix pad issue bzr revid: mma@tinyerp.com-20121029132527-bqw1y2hzikncxrpy --- addons/pad/pad.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/pad/pad.py b/addons/pad/pad.py index d2b9b6cd27e..e5b36e5f64c 100644 --- a/addons/pad/pad.py +++ b/addons/pad/pad.py @@ -4,6 +4,7 @@ import random import re import string import urllib2 +import logging from tools.translate import _ from openerp.tools.misc import html2plaintext from py_etherpad import EtherpadLiteClient