← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/ron-dev-addons2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons2

 

ron(openerp) has proposed merging lp:~openerp-dev/openobject-addons/ron-dev-addons2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons2.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #606325 EAN code validation fails
  https://bugs.launchpad.net/bugs/606325
  #663890 Creating invoices and grouping multiplies services
  https://bugs.launchpad.net/bugs/663890
  #666362 [6.0RC1] sale Invoice Control "Not from Picking" is bad wording
  https://bugs.launchpad.net/bugs/666362
  #667246 Wrong Journals when creating an invoice from picking
  https://bugs.launchpad.net/bugs/667246
  #667324 invoicing control in purchase orders
  https://bugs.launchpad.net/bugs/667324
  #669210 [trunk][mrp] stock_move.action_consume raises exception
  https://bugs.launchpad.net/bugs/669210
  #670056 [6.0RC1] stock moves - missing search field "Reference"
  https://bugs.launchpad.net/bugs/670056
  #670652 Demo data of purchase order is not relevant in terms of supplier address
  https://bugs.launchpad.net/bugs/670652
  #670921 Purchase module : problems in group by in seach view
  https://bugs.launchpad.net/bugs/670921
  #671386 PO Line description doesn't take Supplier Product Name or Code in Product's Suppliers Tab
  https://bugs.launchpad.net/bugs/671386
  #677429 [6.0RC1][purchase]Invoice journal(s) not loaded properly
  https://bugs.launchpad.net/bugs/677429


YML Testing of Purchase Module
https://bugs.launchpad.net/openobject-addons/+bug/677429
TASK ID:-1852
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/ron-dev-addons2/+merge/41826
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/ron-dev-addons2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons2.
=== modified file 'account/account_invoice_view.xml'
--- account/account_invoice_view.xml	2010-11-12 12:54:47 +0000
+++ account/account_invoice_view.xml	2010-11-25 06:09:29 +0000
@@ -149,7 +149,7 @@
             <field name="arch" type="xml">
                 <form string="Supplier Invoice">
                     <group col="8" colspan="4">
-                        <field name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection"/>
+                        <field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=', 'purchase')]"/>
                         <field name="number" readonly="1"/>
                         <field name="type" invisible="1"/>
                         <field name="currency_id" width="50"/>

=== modified file 'purchase/purchase_view.xml'
--- purchase/purchase_view.xml	2010-11-10 06:51:47 +0000
+++ purchase/purchase_view.xml	2010-11-25 06:09:29 +0000
@@ -6,6 +6,18 @@
        <menuitem id="menu_procurement_management" name="Purchase Management"
             parent="base.menu_purchase_root" sequence="1" />
 
+        <menuitem id="menu_purhase_config_purchase" name="Configuration"
+            parent="base.menu_purchase_root" sequence="100"/>
+
+        <menuitem
+            action="product.product_pricelist_action" id="menu_product_pricelist_action_purhase"
+            parent="menu_purhase_config_purchase" sequence="2"/>
+
+        <menuitem
+            action="product.product_pricelist_action2" id="menu_product_pricelist_action2_purchase"
+            parent="menu_purhase_config_purchase" sequence="1"/>
+
+
         <!--supplier addresses action-->
         <record id="action_supplier_address_form" model="ir.actions.act_window">
             <field name="name">Addresses</field>
@@ -160,7 +172,7 @@
                             <group colspan="2" col="2">
                                 <separator string="Invoice Control" colspan="2"/>
                                 <field name="invoice_method"/>
-                                <field name="invoice_id" readonly="1" groups="base.group_extended"/>
+                                <field name="invoice_id" readonly="1" groups="base.group_extended" />
                                 <field name="fiscal_position" widget="selection"/>
                             </group>
                             <newline/>
@@ -310,12 +322,12 @@
                     <field name="product_id"/>
                     <field name="price_unit"/>
                     <field name="product_qty"/>
-                    <field name="product_uom"/>                    
+                    <field name="product_uom"/>
                     <field name="price_subtotal"/>
                     <field name="date_planned"  widget="date" width="135"/>
-                    
-                   
-                    
+
+
+
                     <field name="state" invisible="1"/>
                     <field name="invoiced" invisible="1"/>
                 </tree>
@@ -373,7 +385,7 @@
                         <field name="order_id"/>
                         <field name="product_id"/>
                         <field name="partner_id"  string="Supplier"/>
-                        </group> 
+                        </group>
                         <newline/>
                         <group expand="0" string="Group By...">
                         <filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by' : 'partner_id'}" />

=== modified file 'purchase/wizard/purchase_line_invoice.py'
--- purchase/wizard/purchase_line_invoice.py	2010-10-27 09:08:45 +0000
+++ purchase/wizard/purchase_line_invoice.py	2010-11-25 06:09:29 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #
@@ -15,7 +15,7 @@
 #    GNU Affero General Public License for more details.
 #
 #    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
@@ -26,26 +26,26 @@
 
 
 class purchase_line_invoice(osv.osv_memory):
-    
+
     """ To create invoice for purchase order line"""
-    
+
     _name = 'purchase.order.line_invoice'
     _description = 'Purchase Order Line Make Invoice'
-    
+
     def makeInvoices(self, cr, uid, ids, context=None):
-        
-        """ 
+
+        """
              To get Purchase Order line and create Invoice
              @param self: The object pointer.
              @param cr: A database cursor
              @param uid: ID of the user currently logged in
-             @param context: A standard dictionary 
+             @param context: A standard dictionary
              @return : retrun view of Invoice
         """
-        
+
         if context is None:
             context={}
-                            
+
         record_ids =  context.get('active_ids',[])
         if record_ids:
             res = False
@@ -55,28 +55,28 @@
             property_obj=self.pool.get('ir.property')
             account_fiscal_obj=self.pool.get('account.fiscal.position')
             invoice_line_obj=self.pool.get('account.invoice.line')
-            
-            
+            account_jrnl_obj=self.pool.get('account.journal')
+
             def multiple_order_invoice_name(orders):
                 name = "PO";
                 for order in orders:
                     name += "-%d" % order.id
                 return name
-                
+
             def multiple_order_invoice_reference(partner, orders):
                 reference = "P%dPO" % partner.id
-                for order in orders: 
+                for order in orders:
                     reference += "-%d" % order.id
                 return reference
-                
+
             def multiple_order_invoice_notes(orders):
                 notes = ""
                 for order in orders:
                     notes += "%s \n" % order.notes
                 return notes
-                
-                
-                
+
+
+
             def make_invoice_by_partner(partner, orders, lines_ids):
                 """
                     create a new invoice for one supplier
@@ -84,23 +84,24 @@
                     @param orders : The set of orders to add in the invoice
                     @param lines : The list of line's id
                 """
-             
+                journal_id_get = account_jrnl_obj.search(cr,uid,[('type','=','purchase')],context=None)[0]
                 a = partner.property_account_payable.id
                 if partner and partner.property_payment_term.id:
                     pay_term = partner.property_payment_term.id
                 else:
                     pay_term = False
                 inv = {
-                    'name': multiple_order_invoice_name(orders),  
-                    'origin': multiple_order_invoice_name(orders),  
+                    'name': multiple_order_invoice_name(orders),
+                    'origin': multiple_order_invoice_name(orders),
                     'type': 'in_invoice',
+                    'journal_id':journal_id_get,
                     'reference': multiple_order_invoice_reference(partner, orders),
                     'account_id': a,
                     'partner_id': partner.id,
                     'address_invoice_id': orders[0].partner_address_id.id,
                     'address_contact_id': orders[0].partner_address_id.id,
                     'invoice_line': [(6,0,lines_ids)],
-                    'currency_id' : orders[0].pricelist_id.currency_id.id, 
+                    'currency_id' : orders[0].pricelist_id.currency_id.id,
                     'comment': multiple_order_invoice_notes(orders),
                     'payment_term': pay_term,
                     'fiscal_position': partner.property_account_position.id
@@ -136,7 +137,7 @@
                         'uos_id': line.product_uom.id,
                         'product_id': line.product_id.id or False,
                         'invoice_line_tax_id': [(6, 0, [x.id for x in line.taxes_id])],
-                        'note': line.notes, 
+                        'note': line.notes,
                         'account_analytic_id': line.account_analytic_id and line.account_analytic_id.id or False,
                     })
                     cr.execute('insert into purchase_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id))
@@ -147,7 +148,7 @@
             for result in invoices.values():
                 il = map(lambda x: x[1], result)
                 orders = list(set(map(lambda x : x[0].order_id, result)))
-               
+
                 res.append(make_invoice_by_partner(orders[0].partner_id, orders, il))
 
         return {

=== modified file 'stock/stock.py'
--- stock/stock.py	2010-11-24 17:21:57 +0000
+++ stock/stock.py	2010-11-25 06:09:29 +0000
@@ -110,6 +110,7 @@
         @param field_names: Name of field
         @return: Dictionary of values
         """
+        prod_id = context and context.get('product_id', False)
 
         product_product_obj = self.pool.get('product.product')
 
@@ -125,6 +126,8 @@
         currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
         currency_obj.round(cr, uid, currency, 300)
         for loc_id, product_ids in products_by_location.items():
+            if prod_id:
+                product_ids = [prod_id]
             c = (context or {}).copy()
             c['location'] = loc_id
             for prod in product_product_obj.browse(cr, uid, product_ids, context=c):


Follow ups