← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3

 

pso (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #438717 Error in account_anglo_saxon when using foreign currency
  https://bugs.launchpad.net/bugs/438717
  #539539 product - VAT definition - multicompany
  https://bugs.launchpad.net/bugs/539539
  #589256 Wrong tax calculation in point of sale (POS)
  https://bugs.launchpad.net/bugs/589256
  #617974 trunk - hr payment - rounding issue payment slip
  https://bugs.launchpad.net/bugs/617974
  #663585 [6.0rc1] suggested improvements to PO and SO form view
  https://bugs.launchpad.net/bugs/663585
  #663967 [RC1] SO -History - can delete related invoice
  https://bugs.launchpad.net/bugs/663967
  #666592 save and close crash adding product in point of sale
  https://bugs.launchpad.net/bugs/666592
  #669360 hr_timeeshet_sheet : installation fails on 1st (and probably last) date of the month.
  https://bugs.launchpad.net/bugs/669360
  #669533 [hr_timesheet] Employee timesheet reports confuse employee id and user id
  https://bugs.launchpad.net/bugs/669533
  #672684 Manual Global Tax
  https://bugs.launchpad.net/bugs/672684
  #673835 Sales, Purchase and Invoice Analysis Problem
  https://bugs.launchpad.net/bugs/673835
  #689924 [sale_margin] purchase price is wrong
  https://bugs.launchpad.net/bugs/689924
  #691810 Cannot cancel invoice BUG
  https://bugs.launchpad.net/bugs/691810
  #692456 Sale Order Reference not unique
  https://bugs.launchpad.net/bugs/692456
  #692735 [6.0] sales - canceled SO should not be black (normal)
  https://bugs.launchpad.net/bugs/692735
  #692964 in hr_recruitment, add a column "Subject" in applicants list view
  https://bugs.launchpad.net/bugs/692964
  #692976 expenses list shouldn't be editable
  https://bugs.launchpad.net/bugs/692976


Hello,

Fixed below bugs:

https://bugs.launchpad.net/openobject-addons/+bug/673835
https://bugs.launchpad.net/openobject-addons/+bug/691810
https://bugs.launchpad.net/openobject-addons/+bug/692456
https://bugs.launchpad.net/openobject-addons/+bug/692735
https://bugs.launchpad.net/openobject-addons/+bug/689924
https://bugs.launchpad.net/openobject-addons/+bug/692964
https://bugs.launchpad.net/openobject-addons/+bug/692976

And 

https://bugs.launchpad.net/openobject-addons/+bug/438717 (Done by hda sir)

Thanks,
pso (Open ERP)



-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44430
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'account/account.py'
--- account/account.py	2010-12-20 05:53:04 +0000
+++ account/account.py	2010-12-22 06:38:56 +0000
@@ -1278,6 +1278,8 @@
         return super(account_move, self).copy(cr, uid, id, default, context)
 
     def unlink(self, cr, uid, ids, context=None, check=True):
+        if context is None:
+            context = {}
         toremove = []
         obj_move_line = self.pool.get('account.move.line')
         for move in self.browse(cr, uid, ids, context=context):

=== modified file 'account/report/account_invoice_report.py'
--- account/report/account_invoice_report.py	2010-10-09 16:01:43 +0000
+++ account/report/account_invoice_report.py	2010-12-22 06:38:56 +0000
@@ -36,7 +36,7 @@
             ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
         'product_id': fields.many2one('product.product', 'Product', readonly=True),
         'product_qty':fields.float('Qty', readonly=True),
-        'uom_name': fields.char('Default UoM', size=128, readonly=True),
+        'uom_name': fields.char('Reference UoM', size=128, readonly=True),
         'payment_term': fields.many2one('account.payment.term', 'Payment Term', readonly=True),
         'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], readonly=True),
         'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True),
@@ -88,7 +88,11 @@
                     ai.partner_id as partner_id,
                     ai.payment_term as payment_term,
                     ai.period_id as period_id,
-                    u.name as uom_name,
+                    (case when u.uom_type not in ('reference') then
+                        (select name from product_uom where uom_type='reference' and category_id=u.category_id)
+                    else
+                        u.name
+                    end) as uom_name,
                     ai.currency_id as currency_id,
                     ai.journal_id as journal_id,
                     ai.fiscal_position as fiscal_position,
@@ -104,9 +108,9 @@
                     ai.account_id as account_id,
                     ai.partner_bank_id as partner_bank_id,
                     sum(case when ai.type in ('out_refund','in_invoice') then
-                         ail.quantity * u.factor * -1
+                         ail.quantity / u.factor * -1
                         else
-                         ail.quantity * u.factor
+                         ail.quantity / u.factor
                         end) as product_qty,
                     sum(case when ai.type in ('out_refund','in_invoice') then
                          ail.quantity*ail.price_unit * -1
@@ -125,9 +129,9 @@
                     else
                       sum(ail.quantity*ail.price_unit)
                     end)/(case when ai.type in ('out_refund','in_invoice') then
-                      sum(ail.quantity*u.factor*-1)
+                      sum(ail.quantity/u.factor*-1)
                     else
-                      sum(ail.quantity*u.factor)
+                      sum(ail.quantity/u.factor)
                     end) / cr.rate as price_average,
                     cr.rate as currency_rate,
                     sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2)
@@ -179,7 +183,9 @@
                     ai.account_id,
                     ai.partner_bank_id,
                     ai.residual,
-                    ai.amount_total
+                    ai.amount_total,
+                    u.uom_type,
+                    u.category_id
             )
         """)
 

=== modified file 'account_anglo_saxon/invoice.py'
--- account_anglo_saxon/invoice.py	2010-12-13 06:43:09 +0000
+++ account_anglo_saxon/invoice.py	2010-12-22 06:38:56 +0000
@@ -29,6 +29,15 @@
     def move_line_get(self, cr, uid, invoice_id, context=None):
         res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context)
         inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
+        company_currency = inv.company_id.currency_id.id
+        def get_price(cr, uid, inv, company_currency,i_line):
+            cur_obj = self.pool.get('res.currency')
+            if inv.currency_id.id != company_currency:
+                price = cur_obj.compute(cr, uid, company_currency, inv.currency_id.id, i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, context={'date': inv.date_invoice})
+            else:
+                price = i_line.product_id.product_tmpl_id.standard_price * i_line.quantity
+            return price
+
         if inv.type in ('out_invoice','out_refund'):
             for i_line in inv.invoice_line:
                 if i_line.product_id:
@@ -56,7 +65,7 @@
                             'name': i_line.name[:64],
                             'price_unit':i_line.product_id.product_tmpl_id.standard_price,
                             'quantity':i_line.quantity,
-                            'price':i_line.product_id.product_tmpl_id.standard_price * i_line.quantity,
+                            'price':get_price(cr, uid, inv, company_currency, i_line),
                             'account_id':dacc,
                             'product_id':i_line.product_id.id,
                             'uos_id':i_line.uos_id.id,
@@ -69,7 +78,7 @@
                             'name': i_line.name[:64],
                             'price_unit':i_line.product_id.product_tmpl_id.standard_price,
                             'quantity':i_line.quantity,
-                            'price': -1 * i_line.product_id.product_tmpl_id.standard_price * i_line.quantity,
+                            'price': -1 * get_price(cr, uid, inv, company_currency, i_line),
                             'account_id':cacc,
                             'product_id':i_line.product_id.id,
                             'uos_id':i_line.uos_id.id,

=== modified file 'account_anglo_saxon/product.py'
--- account_anglo_saxon/product.py	2010-02-24 10:55:29 +0000
+++ account_anglo_saxon/product.py	2010-12-22 06:38:56 +0000
@@ -30,7 +30,25 @@
             string="Price Difference Account",
             method=True,
             view_load=True,
-            help="This account will be used to value price difference between purchase price and cost price."),                
+            help="This account will be used to value price difference between purchase price and cost price."),
+
+        #Redefine fields to change help text for anglo saxon methodology.            
+        'property_account_income_categ': fields.property(
+            'account.account',
+            type='many2one',
+            relation='account.account',
+            string="Income Account",
+            method=True,
+            view_load=True,
+            help="This account will be used to value outgoing stock for the current product category using sale price"),
+        'property_account_expense_categ': fields.property(
+            'account.account',
+            type='many2one',
+            relation='account.account',
+            string="Expense Account",
+            method=True,
+            view_load=True,
+            help="This account will be used to value outgoing stock for the current product category using cost price"),                
 
     }
 product_category()
@@ -45,7 +63,25 @@
             string="Price Difference Account",
             method=True,
             view_load=True,
-            help="This account will be used to value price difference between purchase price and cost price."),                
+            help="This account will be used to value price difference between purchase price and cost price."),
+            
+        #Redefine fields to change help text for anglo saxon methodology.
+        'property_account_income': fields.property(
+            'account.account',
+            type='many2one',
+            relation='account.account',
+            string="Income Account",
+            method=True,
+            view_load=True,
+            help="This account will be used to value outgoing stock for the current product category using sale price"),
+        'property_account_expense': fields.property(
+            'account.account',
+            type='many2one',
+            relation='account.account',
+            string="Expense Account",
+            method=True,
+            view_load=True,
+            help="This account will be used to value outgoing stock for the current product category using cost price"),                
 
     }
 product_template()

=== modified file 'hr_expense/hr_expense_view.xml'
--- hr_expense/hr_expense_view.xml	2010-11-24 11:34:32 +0000
+++ hr_expense/hr_expense_view.xml	2010-12-22 06:38:56 +0000
@@ -28,11 +28,11 @@
             <field name="arch" type="xml">
                 <tree string="Expenses" colors="blue:state=='draft'">
                     <field name="employee_id"/>
+                    <field name="date"/>
                     <field name="user_id" invisible="1"/>
                     <field name="department_id" groups="base.group_extended"/>
+                    <field name="ref"/>
                     <field name="name"/>
-                    <field name="date"/>
-                    <field name="ref"/>
                     <field name="amount"/>
                     <field name="state"/>
                     <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_user,base.group_hr_manager"/>
@@ -175,6 +175,7 @@
             <field name="view_type">form</field>
             <field name="context">{"search_default_user_id":uid}</field>
             <field name="search_view_id" ref="view_hr_expense_filter"/>
+            <field name="view_id" ref="view_expenses_tree"/>
             <field name="help">The OpenERP expenses management module allows you to track the full flow. Every month, the employees record their expenses. At the end of the month, their managers validates the expenses sheets which creates costs on projects/analytic accounts. The accountant validates the proposed entries and the employee can be reimbursed. You can also reinvoice the customer at the end of the flow.</field>
         </record>
 

=== modified file 'hr_recruitment/hr_recruitment_view.xml'
--- hr_recruitment/hr_recruitment_view.xml	2010-12-08 10:23:05 +0000
+++ hr_recruitment/hr_recruitment_view.xml	2010-12-22 06:38:56 +0000
@@ -42,6 +42,7 @@
         <field name="arch" type="xml">
             <tree string="Applicants" colors="grey:state in ('cancel','done');blue:state=='pending'">
                 <field name="create_date"/>
+                <field name="name" string="Subject"/>
                 <field name="partner_name"/>
                 <field name="email_from"/>
                 <field name="partner_phone"/>

=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2010-12-21 14:17:59 +0000
+++ purchase/purchase.py	2010-12-22 06:38:56 +0000
@@ -220,6 +220,9 @@
         'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id,
         'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c),
     }
+    _sql_constraints = [
+        ('name_uniq', 'unique(name)', 'Order Reference must be unique !'),
+    ]
     _name = "purchase.order"
     _description = "Purchase Order"
     _order = "name desc"

=== modified file 'purchase/report/purchase_report.py'
--- purchase/report/purchase_report.py	2010-10-01 12:21:35 +0000
+++ purchase/report/purchase_report.py	2010-12-22 06:38:56 +0000
@@ -52,7 +52,7 @@
         'date_approve':fields.date('Date Approved', readonly=True),
         'expected_date':fields.date('Expected Date', readonly=True),
         'validator' : fields.many2one('res.users', 'Validated By', readonly=True),
-        'product_uom' : fields.many2one('product.uom', 'Product UoM', required=True),
+        'product_uom' : fields.many2one('product.uom', 'Reference UoM', required=True),
         'company_id':fields.many2one('res.company', 'Company', readonly=True),
         'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
         'delay':fields.float('Days to Validate', digits=(16,2), readonly=True),
@@ -92,16 +92,20 @@
                     s.company_id as company_id,
                     l.product_id,
                     t.categ_id as category_id,
-                    l.product_uom as product_uom,
+                    (case when u.uom_type not in ('reference') then
+                            (select id from product_uom where uom_type='reference' and category_id = 1)
+                    else
+                        u.id
+                    end) as product_uom,
                     s.location_id as location_id,
-                    sum(l.product_qty*u.factor) as quantity,
+                    sum(l.product_qty/u.factor) as quantity,
                     extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay,
                     extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass,
                     count(*) as nbr,
                     (l.price_unit*l.product_qty*u.factor)::decimal(16,2) as price_total,
                     avg(100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor))::decimal(16,2) as negociation,
                     sum(t.standard_price*l.product_qty*u.factor)::decimal(16,2) as price_standard,
-                    (sum(l.product_qty*l.price_unit)/sum(l.product_qty*u.factor))::decimal(16,2) as price_average
+                    (sum(l.product_qty*l.price_unit)/sum(l.product_qty/u.factor))::decimal(16,2) as price_average
                 from purchase_order s
                     left join purchase_order_line l on (s.id=l.order_id)
                         left join product_product p on (l.product_id=p.id)
@@ -131,7 +135,10 @@
                     to_char(s.date_order, 'MM'),
                     to_char(s.date_order, 'YYYY-MM-DD'),
                     s.state,
-                    s.warehouse_id
+                    s.warehouse_id,
+                    u.uom_type, 
+                    u.category_id,
+                    u.id
             )
         """)
 purchase_report()

=== modified file 'purchase/report/purchase_report_view.xml'
--- purchase/report/purchase_report_view.xml	2010-11-01 06:31:54 +0000
+++ purchase/report/purchase_report_view.xml	2010-12-22 06:38:56 +0000
@@ -101,7 +101,7 @@
  					<separator orientation="vertical"/>
                     <filter string="Product" name="group_product_id" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
                     <filter string="Category" name="group_category_id" icon="terp-accessories-archiver" context="{'group_by':'category_id'}"/>
-                    <filter string="Product UOM" name="group_product_uom" icon="terp-accessories-archiver" context="{'group_by':'product_uom'}"/>
+                    <filter string="Reference UOM" name="group_product_uom" icon="terp-accessories-archiver" context="{'group_by':'product_uom'}"/>
                     <filter string="Warehouse" icon="terp-go-home" context="{'group_by':'warehouse_id'}" groups="base.group_extended"/>
                     <filter string="Destination" icon="terp-gtk-jump-to-ltr" context="{'group_by':'location_id'}"/>
                     <separator orientation="vertical"/>

=== modified file 'sale/report/sale_report.py'
--- sale/report/sale_report.py	2010-11-02 05:35:59 +0000
+++ sale/report/sale_report.py	2010-12-22 06:38:56 +0000
@@ -38,7 +38,7 @@
             ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
         'day': fields.char('Day', size=128, readonly=True),
         'product_id': fields.many2one('product.product', 'Product', readonly=True),
-        'uom_name': fields.char('Default UoM', size=128, readonly=True),
+        'uom_name': fields.char('Reference UoM', size=128, readonly=True),
         'product_uom_qty': fields.float('# of Qty', readonly=True),
 
         'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
@@ -90,17 +90,21 @@
                 sale_order s,
                     (
                     select l.id as id,
-                         l.product_id as product_id,
-                         u.name as uom_name,
-                         sum(l.product_uom_qty * u.factor) as product_uom_qty,
-                         sum(l.product_uom_qty*l.price_unit) as price_total,
-                         (sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty * u.factor)*count(l.product_id))::decimal(16,2) as price_average,
-                         pt.categ_id, l.order_id
+                        l.product_id as product_id,
+                        (case when u.uom_type not in ('reference') then
+                            (select name from product_uom where uom_type='reference' and category_id=u.category_id)
+                        else
+                            u.name
+                        end) as uom_name,
+                        sum(l.product_uom_qty/u.factor) as product_uom_qty,
+                        sum(l.product_uom_qty*l.price_unit) as price_total,
+                        (sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty/u.factor)*count(l.product_id))::decimal(16,2) as price_average,
+                        pt.categ_id, l.order_id
                     from
                      sale_order_line l
                      left join product_uom u on (u.id=l.product_uom)
                      left join product_template pt on (pt.id=l.product_id)
-                    group by l.id, l.order_id, l.product_id, u.name, pt.categ_id) el
+                      group by l.id, l.order_id, l.product_id, u.name, pt.categ_id, u.uom_type, u.category_id) el
                 where s.id = el.order_id
                 group by el.id,
                     el.product_id,

=== modified file 'sale/report/sale_report_view.xml'
--- sale/report/sale_report_view.xml	2010-11-19 12:17:39 +0000
+++ sale/report/sale_report_view.xml	2010-12-22 06:38:56 +0000
@@ -100,7 +100,7 @@
                     <filter string="Partner" icon="terp-partner"  name="Customer" context="{'group_by':'partner_id'}"/>
                     <separator orientation="vertical"/>
                     <filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id','set_visible':True}"/>
-                    <filter string="Default UoM" icon="terp-mrp" context="{'group_by':'uom_name'}"/>
+                    <filter string="Reference UoM" icon="terp-mrp" context="{'group_by':'uom_name'}"/>
                     <filter string="Category of Product" icon="terp-stock_symbol-selection" name="Category" context="{'group_by':'categ_id'}"/>
                     <separator orientation="vertical" groups="analytic.group_analytic_accounting"/>
                     <filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'analytic_account_id'}" groups="analytic.group_analytic_accounting"/>

=== modified file 'sale/sale.py'
--- sale/sale.py	2010-12-20 09:47:17 +0000
+++ sale/sale.py	2010-12-22 06:38:56 +0000
@@ -185,7 +185,7 @@
         for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context):
             result[line.order_id.id] = True
         return result.keys()
-
+    
     _columns = {
         'name': fields.char('Order Reference', size=64, required=True,
             readonly=True, states={'draft': [('readonly', False)]}, select=True),
@@ -274,6 +274,9 @@
         'partner_order_id': lambda self, cr, uid, context: context.get('partner_id', False) and  self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['contact'])['contact'],
         'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'],
     }
+    _sql_constraints = [
+        ('name_uniq', 'unique(name)', 'Order Reference must be unique !'),
+    ]
     _order = 'name desc'
 
     # Form filling

=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml	2010-12-20 11:41:42 +0000
+++ sale/sale_view.xml	2010-12-22 06:38:56 +0000
@@ -81,7 +81,7 @@
             <field name="type">tree</field>
             <field name="priority">2</field>
             <field name="arch" type="xml">
-                <tree string="Sales Orders" colors="grey:state=='done'">
+                <tree string="Sales Orders" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
                     <field name="name"/>
                     <field name="date_order"/>
                     <field name="client_order_ref" groups="base.group_extended"/>

=== modified file 'sale_margin/sale_margin.py'
--- sale_margin/sale_margin.py	2010-12-17 04:37:32 +0000
+++ sale_margin/sale_margin.py	2010-12-22 06:38:56 +0000
@@ -29,9 +29,12 @@
         res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
             uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
             lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag)
+        frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
+        to_cur = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist.currency_id.id
         if product:
             purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price
-            res['value'].update({'purchase_price': purchase_price})
+            price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False)
+            res['value'].update({'purchase_price': price})
         return res
 
     def _product_margin(self, cr, uid, ids, field_name, arg, context=None):


Follow ups