From 81cd29fff9dda5ffb03b3e931be2d853b7f2d8bb Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 9 Sep 2010 17:10:21 +0530 Subject: [PATCH 1/9] [FIX]: mail_gateway: Removed unnecessary truncation of communication history message lp bug: https://launchpad.net/bugs/628719 fixed bzr revid: rpa@tinyerp.com-20100909114021-y7w72lhlr1sl13kl --- addons/mail_gateway/mail_gateway.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index 350c9f70092..3a40aac2649 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -176,6 +176,14 @@ class mailgate_message(osv.osv): ''' Mailgateway Message ''' + def truncate_data(self, cr, uid, data, context=None): + data_list = data and data.split('\n') or [] + if len(data_list) > 3: + res = '\n\t'.join(data_list[:3]) + '...' + else: + res = '\n\t'.join(data_list) + return res + def _get_display_text(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} @@ -186,11 +194,14 @@ class mailgate_message(osv.osv): if message.history: msg_txt += (message.email_from or '/') + _(' wrote on ') + format_date_tz(message.date, tz) + ':\n\t' if message.description: - msg_txt += '\n\t'.join(message.description.split('\n')[:3]) + '...' + msg_txt += self.truncate_data(cr, uid, message.description, context=context) else: - msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t' + msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t' if message.name == _('Opportunity'): msg_txt += _("Converted to Opportunity") + elif message.name == _('Note'): + msg_txt = (message.user_id.name or '/') + _(' added note on ') + format_date_tz(message.date, tz) + ':\n\t' + msg_txt += self.truncate_data(cr, uid, message.description, context=context) else: msg_txt += _("Changed Status to: ") + message.name result[message.id] = msg_txt From f76c611d865dccbabe5295564296e8672a5cace7 Mon Sep 17 00:00:00 2001 From: "Jay (OpenERP)" Date: Thu, 9 Sep 2010 18:37:06 +0530 Subject: [PATCH 2/9] [FIX] Account : Onchanges on tax amount and base should consider the taxcode and basecode sign respectively lp bug: https://launchpad.net/bugs/524278 fixed bzr revid: jvo@tinyerp.com-20100909130706-k4kh1ojx3yoc7dc0 --- addons/account/account_invoice_view.xml | 6 +++++ addons/account/invoice.py | 35 +++++++++++++++++++------ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 0cb9165490e..9b355c1fece 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -109,6 +109,8 @@ + + @@ -194,6 +196,8 @@ + + @@ -286,6 +290,8 @@ + + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 9127d64cad3..773fa55e44d 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1471,6 +1471,24 @@ account_invoice_line() class account_invoice_tax(osv.osv): _name = "account.invoice.tax" _description = "Invoice Tax" + + def _count_factor(self, cr, uid, ids, name, args, context=None): + res = {} + for invoice_tax in self.browse(cr, uid, ids, context=context): + res[invoice_tax.id] = { + 'factor_base': 1.0, + 'factor_tax': 1.0, + } + if invoice_tax.amount <> 0.0: + factor_tax = invoice_tax.tax_amount / invoice_tax.amount + res[invoice_tax.id]['factor_tax'] = factor_tax + + if invoice_tax.base <> 0.0: + factor_base = invoice_tax.base_amount / invoice_tax.base + res[invoice_tax.id]['factor_base'] = factor_base + + return res + _columns = { 'invoice_id': fields.many2one('account.invoice', 'Invoice Line', ondelete='cascade', select=True), 'name': fields.char('Tax Description', size=64, required=True), @@ -1485,33 +1503,34 @@ class account_invoice_tax(osv.osv): 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."), 'tax_amount': fields.float('Tax Code Amount', digits_compute=dp.get_precision('Account')), 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True), + 'factor_base' : fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"), + 'factor_tax' : fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all") } def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False + factor = 1 + if ids: + factor = self.read(cr, uid, ids[0], ['factor_base'])['factor_base'] if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: - base = cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) + base = cur_obj.compute(cr, uid, currency_id, company_currency, base*factor, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'base_amount':base}} def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False - tax_sign = 1 + factor = 1 if ids: - tax_amount = self.read(cr, uid, ids[0], ['tax_amount'])['tax_amount'] - if tax_amount < 0: - tax_sign = -1 - elif tax_amount == 0: - tax_sign = 0 + factor = self.read(cr, uid, ids[0], ['factor_tax'])['factor_tax'] if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: - amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*tax_sign, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) + amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*factor, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount': amount}} _order = 'sequence' From 1c78c14c37c7d9e34f64e5d27a15b4838462db50 Mon Sep 17 00:00:00 2001 From: "DHS(OpenERP)" <> Date: Thu, 9 Sep 2010 19:36:31 +0530 Subject: [PATCH 3/9] [FIX] Account_invoice_layout : Registered xml record for missing report of invoice layout with message lp bug: https://launchpad.net/bugs/599078 fixed bzr revid: jvo@tinyerp.com-20100909140631-cn46925d5nxrblxz --- .../account_invoice_layout_report.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/account_invoice_layout/account_invoice_layout_report.xml b/addons/account_invoice_layout/account_invoice_layout_report.xml index 4b21fcd5b33..ba7f44f0661 100644 --- a/addons/account_invoice_layout/account_invoice_layout_report.xml +++ b/addons/account_invoice_layout/account_invoice_layout_report.xml @@ -8,5 +8,14 @@ name="account.invoice.layout" rml="account_invoice_layout/report/report_account_invoice_layout.rml" auto="False"/> + + + From ade81e37c498b8d5b08f0a86d58714663bc04876 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 9 Sep 2010 18:04:47 +0200 Subject: [PATCH 4/9] merge bzr revid: fp@tinyerp.com-20100909160447-a00w055sl8c2f6mt --- addons/crm/crm_lead.py | 4 ++-- addons/crm/crm_lead_view.xml | 10 +++++----- addons/crm/crm_opportunity_view.xml | 14 ++++++-------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 5d5fb5d3114..d4b08ad2b44 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -119,7 +119,7 @@ class crm_lead(crm_case, osv.osv): 'write_date': fields.datetime('Update Date' , readonly=True), # Lead fields - 'categ_id': fields.many2one('crm.case.categ', 'Lead Source', \ + 'categ_id': fields.many2one('crm.case.categ', 'Category', \ domain="[('section_id','=',section_id),\ ('object_id.model', '=', 'crm.lead')]"), 'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', \ @@ -148,7 +148,7 @@ class crm_lead(crm_case, osv.osv): \nIf the case is in progress the state is set to \'Open\'.\ \nWhen the case is over, the state is set to \'Done\'.\ \nIf the case needs to be reviewed then the state is set to \'Pending\'.'), - 'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)], readonly=True), + 'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]), 'partner_assigned_id': fields.many2one('res.partner', 'Assigned Partner', help="Partner this case has been forwarded/assigned to.", select=True), 'date_assign': fields.date('Assignation Date', help="Last date this case was forwarded/assigned to a partner"), } diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index b70174e8989..1fd8b1483d2 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -57,6 +57,9 @@ +