Skip to content
Xavier Brochard edited this page Oct 29, 2021 · 1 revision

Conflict:

diff --cc addons/account/account_invoice.py                                                                                                                                                   
index 8883b80,53b3136..0000000                                                                                                                                                                
--- a/addons/account/account_invoice.py                                                                                                                                                       
+++ b/addons/account/account_invoice.py                                                                                                                                                       
@@@ -1534,11 -1519,14 +1535,22 @@@ class account_invoice_line(osv.osv)                                                                                                                        
              result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})                                                                                                    
          result['name'] = res.partner_ref                                                                                                                                                    
                                                                                                                                                                                              
++<<<<<<< HEAD
 +        result['uos_id'] = uom_id or res.uom_id.id
 +        if res.description_sale and type and type.startswith('out_'):
 +            result['name'] += '\n'+res.description_sale
 +        if res.description_purchase and type and type.startswith('in_'):
 +            result['name'] += '\n'+res.description_purchase
++=======
+         result['uos_id'] = res.uom_id.id
+         if uom_id:
+             uom = product_uom_obj.browse(cr, uid, uom_id)
+             if res.uom_id.category_id.id == uom.category_id.id:
+                 result['uos_id'] = uom_id
+ 
+         if res.description:
+             result['name'] += '\n'+res.description
++>>>>>>> odoo/7.0
  
          domain = {'uos_id':[('category_id','=',res.uom_id.category_id.id)]}

Resolved as:

diff --cc addons/account/account_invoice.py
index 8883b80,53b3136..0000000
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@@ -1534,11 -1519,14 +1535,16 @@@ class account_invoice_line(osv.osv)
              result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
          result['name'] = res.partner_ref
  
-         result['uos_id'] = uom_id or res.uom_id.id
+         result['uos_id'] = res.uom_id.id
+         if uom_id:
+             uom = product_uom_obj.browse(cr, uid, uom_id)
+             if res.uom_id.category_id.id == uom.category_id.id:
+                 result['uos_id'] = uom_id
+ 
 -        if res.description:
 -            result['name'] += '\n'+res.description
 +        if res.description_sale and type and type.startswith('out_'):
 +            result['name'] += '\n'+res.description_sale
 +        if res.description_purchase and type and type.startswith('in_'):
 +            result['name'] += '\n'+res.description_purchase
  
          domain = {'uos_id':[('category_id','=',res.uom_id.category_id.id)]}

Committed as https://github.com/OCA/OCB/commit/f936caad53a01aaa8b7ebc1253cb94a4989ff6a7 by @hbrunn