From 9c0e8f10e0268c26cea1b991b0156f425a3c3e1a Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Mon, 13 Oct 2014 17:07:13 +0200 Subject: [PATCH 1/8] [FIX] sale: translate advance message on advance invoice --- addons/sale/wizard/sale_make_invoice_advance.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 9c3160cb46a..c4798cc44d4 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -58,6 +58,9 @@ class sale_advance_payment_inv(osv.osv_memory): 'product_id': _get_advance_product, } + def _translate_advance(self, cr, uid, percentage=False, context=None): + return _("Advance of %s %%") if percentage else _("Advance of %s %s") + def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None): if advance_payment_method == 'percentage': return {'value': {'amount':0, 'product_id':False }} @@ -104,16 +107,17 @@ class sale_advance_payment_inv(osv.osv_memory): if wizard.advance_payment_method == 'percentage': inv_amount = sale.amount_total * wizard.amount / 100 if not res.get('name'): - res['name'] = _("Advance of %s %%") % (wizard.amount) + res['name'] = self._translate_advance(cr, uid, percentage=True, context=dict(context, lang=sale.partner_id.lang)) % (wizard.amount) else: inv_amount = wizard.amount if not res.get('name'): #TODO: should find a way to call formatLang() from rml_parse symbol = sale.pricelist_id.currency_id.symbol if sale.pricelist_id.currency_id.position == 'after': - res['name'] = _("Advance of %s %s") % (inv_amount, symbol) + symbol_order = (inv_amount, symbol) else: - res['name'] = _("Advance of %s %s") % (symbol, inv_amount) + symbol_order = (symbol, inv_amount) + res['name'] = self._translate_advance(cr, uid, context=dict(context, lang=sale.partner_id.lang)) % symbol_order # determine taxes if res.get('invoice_line_tax_id'): @@ -159,7 +163,6 @@ class sale_advance_payment_inv(osv.osv_memory): sale_obj.write(cr, uid, sale_id, {'invoice_ids': [(4, inv_id)]}, context=context) return inv_id - def create_invoices(self, cr, uid, ids, context=None): """ create invoices for the active sales orders """ sale_obj = self.pool.get('sale.order') From 1d57a09112e4def7c7ed9cc010f9d683c18ac1ea Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 16 Oct 2014 14:07:38 +0200 Subject: [PATCH 2/8] [FIX] mail: set the parent_id to the first message of type email And fallback of any type if there is none of type email This fix allow the communication between two mail thread from two different Odoo servers having message creation subtypes, like project issue or crm lead --- addons/mail/mail_thread.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index ee039533af6..e82ed94c43b 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -1166,7 +1166,9 @@ class mail_thread(osv.AbstractModel): # _mail_flat_thread: automatically set free messages to the first posted message if self._mail_flat_thread and not parent_id and thread_id: - message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1) + message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model), ('type', '=', 'email')], context=context, order="id ASC", limit=1) + if not message_ids: + message_ids = message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1) parent_id = message_ids and message_ids[0] or False # we want to set a parent: force to set the parent_id to the oldest ancestor, to avoid having more than 1 level of thread elif parent_id: From 7cc3e65b33ca33eaeedb4c2dc8f3076cc963e414 Mon Sep 17 00:00:00 2001 From: dhr-odoo Date: Tue, 14 Oct 2014 12:32:34 +0530 Subject: [PATCH 3/8] [FIX] account_followup: do no duplicate partner's account.move.line Duplicating a partner should not duplicate the content of the unreconciled_aml_ids field. --- addons/account_followup/account_followup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index f05d6fc2ab5..9cedbebf974 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -293,6 +293,13 @@ class res_partner(osv.osv): model = 'res.partner', res_id = part.id, partner_ids = [responsible_partner_id]) return super(res_partner, self).write(cr, uid, ids, vals, context=context) + + def copy(self, cr, uid, record_id, default=None, context=None): + if default is None: + default = {} + + default.update({'unreconciled_aml_ids': []}) + return super(res_partner, self).copy(cr, uid, record_id, default, context) def action_done(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'payment_next_action_date': False, 'payment_next_action':'', 'payment_responsible_id': False}, context=context) From 69c133376629a5d3fb6d07c79f87d248ea49c1d1 Mon Sep 17 00:00:00 2001 From: rmu-odoo Date: Thu, 16 Oct 2014 00:23:03 +0530 Subject: [PATCH 4/8] [FIX] l10n_fr_hr_payroll: report "Fiche de paye" Avoids getting False for the field end_date (Sortie) in case of no end date specified on the contract. opw 614624 --- addons/l10n_fr_hr_payroll/report/fiche_paye.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml index 2d1a6bff8b2..801d445b275 100644 --- a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml +++ b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml @@ -244,7 +244,7 @@ [[o.contract_id.qualif or '_']] [[o.contract_id.niveau or '_']] [[o.contract_id.coef or '_']] - [[o.contract_id.date_start or '_']] Sortie : [[o.contract_id.date_end or '']] + [[ formatLang(o.contract_id.date_end, date=True) or '_']] Sortie : [[ formatLang(o.contract_id.date_end, date=True) or '_']] From b7d22d375cedf13e24ad6f1a2d4b3f852045ad8d Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 20 Oct 2014 10:48:19 +0200 Subject: [PATCH 5/8] [FIX] l10n_fr_hr_payroll: bad copy-paste in 69c1333 --- addons/l10n_fr_hr_payroll/report/fiche_paye.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml index 801d445b275..3cd5059770a 100644 --- a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml +++ b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml @@ -244,7 +244,7 @@ [[o.contract_id.qualif or '_']] [[o.contract_id.niveau or '_']] [[o.contract_id.coef or '_']] - [[ formatLang(o.contract_id.date_end, date=True) or '_']] Sortie : [[ formatLang(o.contract_id.date_end, date=True) or '_']] + [[ formatLang(o.contract_id.date_start, date=True) or '_']] Sortie : [[ formatLang(o.contract_id.date_end, date=True) or '_']] From b00122ad995c1f0b80bf30dcd46580bef2422743 Mon Sep 17 00:00:00 2001 From: Julien Legros Date: Mon, 20 Oct 2014 15:41:52 +0200 Subject: [PATCH 6/8] [FIX] res_partner: add parent_name related field In some cases (e.g. with record rules), the name_get might not have access to the parent name. Therefore a parent_name related field solves the issue (as it read with as superuser). --- openerp/addons/base/res/res_partner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index 2d52b980780..22cd4a8d66a 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -218,6 +218,7 @@ class res_partner(osv.osv, format_address): 'date': fields.date('Date', select=1), 'title': fields.many2one('res.partner.title', 'Title'), 'parent_id': fields.many2one('res.partner', 'Related Company', select=True), + 'parent_name': fields.related('parent_id', 'name', type='char', readonly=True, string='Parent name'), 'child_ids': fields.one2many('res.partner', 'parent_id', 'Contacts', domain=[('active','=',True)]), # force "active_test" domain to bypass _search() override 'ref': fields.char('Reference', size=64, select=1), 'lang': fields.selection(_lang_get, 'Language', @@ -561,7 +562,7 @@ class res_partner(osv.osv, format_address): for record in self.browse(cr, uid, ids, context=context): name = record.name if record.parent_id and not record.is_company: - name = "%s, %s" % (record.parent_id.name, name) + name = "%s, %s" % (record.parent_name, name) if context.get('show_address'): name = name + "\n" + self._display_address(cr, uid, record, without_company=True, context=context) name = name.replace('\n\n','\n') @@ -776,7 +777,7 @@ class res_partner(osv.osv, format_address): 'state_name': address.state_id and address.state_id.name or '', 'country_code': address.country_id and address.country_id.code or '', 'country_name': address.country_id and address.country_id.name or '', - 'company_name': address.parent_id and address.parent_id.name or '', + 'company_name': address.parent_id and address.parent_name or '', } for field in self._address_fields(cr, uid, context=context): args[field] = getattr(address, field) or '' From edc4b0b9bb87aeae2e923a5a0d93e12ee171906d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 20 Oct 2014 20:14:36 +0200 Subject: [PATCH 7/8] [FIX] {web,point_of_sale}: allow cross-origin access to company logo --- addons/point_of_sale/static/src/js/models.js | 5 +++-- addons/web/controllers/main.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 66b9d67eeaa..17eb0f69bd5 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -276,18 +276,19 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal c.height = height var ctx = c.getContext('2d'); ctx.drawImage(self.company_logo,0,0, width, height); - + self.company_logo_base64 = c.toDataURL(); logo_loaded.resolve(); }; self.company_logo.onerror = function(){ logo_loaded.reject(); }; + self.company_logo.crossOrigin = "anonymous"; self.company_logo.src = '/web/binary/company_logo'+'?_'+Math.random(); return logo_loaded; }); - + return loaded; }, diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index b59e01b6c39..295783dd384 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1471,7 +1471,7 @@ class Binary(http.Controller): '/web/binary/company_logo', '/logo', '/logo.png', - ], type='http', auth="none") + ], type='http', auth="none", cors="*") def company_logo(self, dbname=None, **kw): # TODO add etag, refactor to use /image code for etag uid = None From 78a29b3738c14ccc8b042de1d95f502e4bc282ef Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 21 Oct 2014 10:13:44 +0200 Subject: [PATCH 8/8] [FIX] point_of_sale: no need to specify numeric digits In the report pos order, average_price was set as a numeric(16,2), therefore, if the amount was too big, it led to a psql crash: A field with precision 16, scale 2 must round to an absolute value less than 10^14. --- addons/point_of_sale/report/pos_order_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/report/pos_order_report.py b/addons/point_of_sale/report/pos_order_report.py index f0b9c1e56c6..1f053a052c3 100644 --- a/addons/point_of_sale/report/pos_order_report.py +++ b/addons/point_of_sale/report/pos_order_report.py @@ -61,7 +61,7 @@ class pos_order_report(osv.osv): sum(l.qty * u.factor) as product_qty, sum(l.qty * l.price_unit) as price_total, sum((l.qty * l.price_unit) * (l.discount / 100)) as total_discount, - (sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal(16,2) as average_price, + (sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal as average_price, sum(cast(to_char(date_trunc('day',s.date_order) - date_trunc('day',s.create_date),'DD') as int)) as delay_validation, to_char(s.date_order, 'YYYY') as year, to_char(s.date_order, 'MM') as month,