Merge lp:~openerp-commiter/openobject-addons/bug_760813 into lp:openobject-addons/6.0
- bug_760813
- Merge into 6.0
Status: | Needs review |
---|---|
Proposed branch: | lp:~openerp-commiter/openobject-addons/bug_760813 |
Merge into: | lp:openobject-addons/6.0 |
Diff against target: |
52 lines (+9/-5) 1 file modified
sale/sale.py (+9/-5) |
To merge this branch: | bzr merge lp:~openerp-commiter/openobject-addons/bug_760813 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lorenzo Battistini (community) | Needs Fixing | ||
Jay Vora (Serpent Consulting Services) (community) | Needs Fixing | ||
Leonardo Pistone (community) | Approve | ||
OpenERP Core Team | Pending | ||
Review via email: mp+59499@code.launchpad.net |
Commit message
Description of the change
This fixes bug https:/
for 6.0 series
- 4550. By Olivier Dony (Odoo)
-
[MERGE] report_webkit: fixes (mainly UTF8 issues), courtesy of Nicolas Bessi, C2C
- 4551. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4552. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4553. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4554. By xrg
-
[MERGE] base_crypt: missing import and better check for active users
- 4555. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Dhruti's branch for the fix on decimal accuracy
- 4556. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Marco's branch for the fix of lp:718609
- 4557. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4558. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4559. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4560. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4561. By Jay Vora (Serpent Consulting Services)
-
[FIX] l10n_fr : Corrected Template definitions (Ref: Case 5481)
- 4562. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Anup's branch for the fix of task created from Procurement
- 4563. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Jagdish' branch for the fix of bug lp:767058
- 4564. By Jay Vora (Serpent Consulting Services)
-
[FIX] Account : default_get() corrected in order to be compatible with web client
- 4565. By Jay Vora (Serpent Consulting Services)
-
[FIX] Account : Corrected _sum() of account.tax.code()
- 4566. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Dhruti's branch for the fix of lp:741457
- 4567. By Jay Vora (Serpent Consulting Services)
-
[FIX] Fixed warnings and test failures suggested by Buildbot
- 4568. By Jay Vora (Serpent Consulting Services)
-
[Merge]
- 4569. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4570. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4571. By Jay Vora (Serpent Consulting Services)
-
[FIX] Account_voucher : Added missing context to onchange_date() of voucher
- 4572. By Olivier Dony (Odoo)
-
[I18N] all: updated translation templates
- 4573. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4574. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4575. By Olivier Laurent (Open ERP)
-
[FIX] document: when updating attachment file size, exclude attachments having NULL db_datas (otherwise len() raises an exception)
- 4576. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Amit Dodiya's branch for the fix of account_followup rules issue
- 4577. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4578. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged the branch for the fix of lp:763439
- 4579. By Anup(SerpentCS)
-
[FIX] account : Move lines take the Journal and Period from the Move itself(Maintenance Case 5598)
- 4580. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4581. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4582. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4583. By Tristan Hill (credativ)
-
[MERGE] Merged Tristan Hill (credativ)'s branch for the fix of bug lp:733799
- 4584. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4585. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Rifakat's branch for the fix of onchange call
- 4586. By Jay Vora (Serpent Consulting Services)
-
[FIX] Purchase_
requisition : Corrections and removed the unnecessary dependency of mrp - 4587. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4588. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Valencia's branch for the fix of __compute method on account correctiosn when account is set to inActive
Jay Vora (Serpent Consulting Services) (jayvora) wrote : | # |
Lorenzo Battistini (elbati) wrote : | # |
Hello Jay,
did you read this bug? https:/
it was rightly fixed this way: http://
Also, why should the line's name be displayed in customer's language?
User could be unable to understand it.
Customer's language should be used in report only
- 4589. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Dhruti's branch for the fix of the problem when base_contact disturbs the thunderbird
- 4590. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4591. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Anup's branch for the fix of invoice creation from repairs
- 4592. By Jay Vora (Serpent Consulting Services)
-
[REF] Stock : Improvements
- 4593. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Rifakat's branch which contains the fix of invoice progressbar which was showing wrong value by not considering the residual amount(It could have failed when the invoice is partially paid)
- 4594. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4595. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4596. By Jay Vora (Serpent Consulting Services)
-
Merged Tejas' branch for the fix of wrong reporting of product margin(Thanks to Rifakat for review)
- 4597. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Somesh' branch for the fix of domain correction for Sale Order's 'Invoice On' Policy
- 4598. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged Amit Dodiya's branch for the fix of fields_view_get() failing on list view display of account.voucher
- 4599. By Anup(SerpentCS)
-
[MERGE] Merged RGO's branch for Query fix in Sale Manager Analysis Report(Case:5689)
- 4600. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4601. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4602. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4603. By Conexus.at
-
[ADD] l10n_at: added localization module for austria. Thanks Conexus.at
- 4604. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4605. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4606. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4607. By Priyesh (OpenERP)
-
[MERGE] Merge SKH's branch to remove duplicates on name_search (case:5861) branch: lp:~openerp-dev/openobject-addons/6.0-opw-5861-skh
- 4608. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4609. By Anup(SerpentCS)
-
[MERGE] purchase : Merged Ravi's Branch for the purchase report query fix. (Case:5943)
- 4610. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4611. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4612. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4613. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged ADO's branch for the fix of partial picking getting failed while product has no company configured
- 4614. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 4615. By Jay Vora (Serpent Consulting Services)
-
[FIX] Corrected the context for the act_window of Phonecall from Partner
- 4616. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged RGO's branch for the fix of wrong _defaults on stock module
- 4617. By Jay Vora (Serpent Consulting Services)
-
[FIX] Successive fix over the bug lp:777347
- 4618. By Jay Vora (Serpent Consulting Services)
-
[FIX] CRM/Project_
planning : Corrected Yml tests,thanks to buildbot - 4619. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
Leonardo Pistone (lepistone) wrote : | # |
Agreed with Lorenzo.
On Wednesday 01 June 2011, you wrote:
> Review: Approve
> Agreed with Lorenzo.
Review: Disapprove
The 'context_lang' of res.users is never used directly. It only means to fill
the context of the client and then pushed back to the functions to use.
The proper solution would be to add 'context' to the arguments of that
function and update the view xml to pass that.
It is important to keep the same coding convention in all cases, rather than
having different hacks each time we need to chose the language or so.
--
Say NO to spam and viruses. Stop using Microsoft Windows!
Lorenzo Battistini (elbati) wrote : | # |
Hello xrg,
I just copied the bug solution committed here
http://
that should fix the bug for the trunk series.
So, I guess we need a different solution for trunk too.
Do you have any example of this coding convention?
Thanks
Jay Vora (Serpent Consulting Services) (jayvora) wrote : | # |
Excuse me,
I have rechecked the whole scenario.
There are 2 things to note about:
1. Warning which is being shown to OpenERP User.
- Warning is currently appearing in Partner's language. I admit I was wrong and Lorenzo seems right that warning should be readable to User. So, it should be in User's language.
- Make sure ONLY THE WARNING MESSAGE should be translated to user's language. NOT THE WHOLE context should be used for further functions.
- If this context is used globally, the descriptions,
- As a part of the solution, follow what XRG says: add context in parameters.
2. Report being shown to User's Customer.
- This is being handled well over the reports by the use of setLang(customer's lang).
- 4620. By Jay Vora (Serpent Consulting Services)
-
[FIX] HR_Payroll/
Hr_recruitment/ Membership/ Point_of_ sale/Project_ timesheet : Corrected Yml tests,thanks to buildbot - 4621. By Jay Vora (Serpent Consulting Services)
-
[FIX] HR_Payroll/
Hr_recruitment/ Membership/ Point_of_ sale/Project_ timesheet : Corrected Yml tests,thanks to buildbot
Lorenzo Battistini (elbati) wrote : | # |
xrg, Jay
I got the point. I'll update the context passed as parameter
Jay Vora (Serpent Consulting Services) (jayvora) wrote : | # |
Thanks.
- 4622. By Jay Vora (Serpent Consulting Services)
-
[FIX] Product_
visible_ discount : Correction in the __openerp__.py for the dependency module and fix the onchange methods for sale order line and invoice line(Ref : Case 5998) - 4623. By Jay Vora (Serpent Consulting Services)
-
[MERGE] Merged RGO's branch for the fix of Stock : Corrected _defaults for date/time fields
- 4624. By Jay Vora (Serpent Consulting Services)
-
[FIX] Project_
scrum/Purchase_ requisition : Corrected _defaults for date/datetime values - 4625. By Jay Vora (Serpent Consulting Services)
-
[FIX/REF] Minor but Important fixes
- 4626. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
digitalsatori(Shine IT) (digitalsatori) wrote : | # |
> - Make sure ONLY THE WARNING MESSAGE should be translated to user's
> language. NOT THE WHOLE context should be used for further functions.
> - If this context is used globally, the descriptions,
> fields will be translated to user's language,which is plain wrong.
Goods name and descriptions, etc textual fields in user's language is NOT wrong, user should understand the goods he/she ordered for the customer. Can you imagine you have to choose a product that is showing in Chinese (assumed you don't read Chinese) if the customer is from China.
the pdf report in customer's language is correct, as it probably will send to the customer.
Lorenzo Battistini (elbati) wrote : | # |
Hi all,
I updated the code.
Please review
Anup(SerpentCS) (anup-serpent) wrote : | # |
Hello Lorenzo,
Removing the partner language in context removes the facility to translate the data in partner format when sent to a partner. Partner lang is kept in sale order so that whenever a report is sent to partner it should be sent in the partner's language. IMHO We have made it convenient for the partners and we should not remove this.
I have found a solution by which both the things are cleared out. The information would come in the partner's lang whereas the warning message will come in user's lang.
Hope this clears the issue.
@jay
Can you please check it and share your views regarding the fix?
Thanks.
- 4627. By Anup(SerpentCS)
-
[FIX] sale : Wrong context being passed for translation in the method when raising a warning,fixed(Case :6046)
Lorenzo Battistini (elbati) wrote : | # |
Hello Anup,
your changes fix the problem as well.
Still I can't understand why partner's language should be kept in context.
Where is it needed?
Within the reports, language is set by 'setLang(
Anup(SerpentCS) (anup-serpent) wrote : | # |
Hello Lorenzo,
I know we can have the translations in report using the setLang().
But here there is another issue that in the report a product is not being displayed. It's the Description that is being translated. This field is not a translatable field and it's translations are not available always.
So to see the Description in Partner Lang we are keeping the partner lang in the method.
Hope this clears the issue.
Thanks.
Lorenzo Battistini (elbati) wrote : | # |
Hello Anup,
could you kindly show me a piece of code where the partner's language is being used to translate the description?
I just want to be sure I understood
Thanks
Anup(SerpentCS) (anup-serpent) wrote : | # |
Hello Lorenzo,
I would surely show you. Kindly follow the below steps.
1. Select a customer language(Other than english).
2. Create a sale order and select the customer that has a different langauge.
3. Create a new sale order line.
4. Select a product and you'll see that the field "Description" comes translated.
5. View the sale order report and you'll see the same translated field on the report.
6. The Description field is sent to the report not the product that's why the partner lang is there in the on_change method.
Hope this clears the issue.
Thanks.
Lorenzo Battistini (elbati) wrote : | # |
So, system user will see the list of order lines without understanding what they mean.
I don't think this is very usable.
Maybe better if we make the description of sale.order.line translatable?
Anup(SerpentCS) (anup-serpent) wrote : | # |
Hello Lorenzo,
It is not feasible to do so as the description is coming from the product itself and it's merged from product's name and reference. If we keep the field translatable it would have duplicate translations for the same src. Hope you can understand.
Thanks.
Olivier Dony (Odoo) (odo-openerp) wrote : | # |
Note: a similar patch has landed in trunk at revision 5028 revid:<email address hidden>, you might want to look at it.
Unmerged revisions
- 4627. By Anup(SerpentCS)
-
[FIX] sale : Wrong context being passed for translation in the method when raising a warning,fixed(Case :6046)
Preview Diff
1 | === modified file 'sale/sale.py' |
2 | --- sale/sale.py 2011-05-17 11:44:45 +0000 |
3 | +++ sale/sale.py 2011-06-03 06:53:46 +0000 |
4 | @@ -1009,16 +1009,20 @@ |
5 | |
6 | def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, |
7 | uom=False, qty_uos=0, uos=False, name='', partner_id=False, |
8 | - lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): |
9 | + lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None): |
10 | + if context is None: |
11 | + context = {} |
12 | + context['lang'] = lang or 'en_US' |
13 | if not partner_id: |
14 | raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.')) |
15 | warning = {} |
16 | product_uom_obj = self.pool.get('product.uom') |
17 | partner_obj = self.pool.get('res.partner') |
18 | product_obj = self.pool.get('product.product') |
19 | + ctx = context.copy() |
20 | if partner_id: |
21 | lang = partner_obj.browse(cr, uid, partner_id).lang |
22 | - context = {'lang': lang, 'partner_id': partner_id} |
23 | + ctx.update({'lang': lang, 'partner_id': partner_id}) |
24 | |
25 | if not product: |
26 | return {'value': {'th_weight': 0, 'product_packaging': False, |
27 | @@ -1028,14 +1032,14 @@ |
28 | date_order = time.strftime('%Y-%m-%d') |
29 | |
30 | result = {} |
31 | - product_obj = product_obj.browse(cr, uid, product, context=context) |
32 | + product_obj = product_obj.browse(cr, uid, product, context=ctx) |
33 | if not packaging and product_obj.packaging: |
34 | packaging = product_obj.packaging[0].id |
35 | result['product_packaging'] = packaging |
36 | |
37 | if packaging: |
38 | default_uom = product_obj.uom_id and product_obj.uom_id.id |
39 | - pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context=context) |
40 | + pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context=ctx) |
41 | q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom) |
42 | # qty = qty - qty % q + q |
43 | if qty and (q and not (qty % q) == 0): |
44 | @@ -1074,7 +1078,7 @@ |
45 | result.update({'type': product_obj.procure_method}) |
46 | |
47 | if not flag: |
48 | - result['name'] = self.pool.get('product.product').name_get(cr, uid, [product_obj.id], context=context)[0][1] |
49 | + result['name'] = self.pool.get('product.product').name_get(cr, uid, [product_obj.id], context=ctx)[0][1] |
50 | domain = {} |
51 | if (not uom) and (not uos): |
52 | result['product_uom'] = product_obj.uom_id.id |
Lorenzo,
It is not advisable to use the User's language here instead of Customer's.
The Partner's language has been set because the name of the sale order line(description) should be shown in customer's language.
Thanks.