Divyesh Makwana(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-invoice_line_editable_list-mdi into 
lp:~openerp-dev/openobject-addons/trunk-editable_list.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-invoice_line_editable_list-mdi/+merge/120716

Hello Sir,

I have convert invoice line to editable list and call the on-change method to 
set all the information.

Thanks,
Divyesh
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-invoice_line_editable_list-mdi/+merge/120716
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openobject-addons/trunk-invoice_line_editable_list-mdi into 
lp:~openerp-dev/openobject-addons/trunk-editable_list.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2012-08-14 14:10:40 +0000
+++ account/account_invoice.py	2012-08-22 07:32:56 +0000
@@ -1361,10 +1361,16 @@
         'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),
         'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True)
     }
+
+    def _default_account_id(self, cr, uid, ids, context=None):
+        prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
+        return prop and prop.id or False
+
     _defaults = {
         'quantity': 1,
         'discount': 0.0,
         'price_unit': _price_unit_default,
+        'account_id': _default_account_id,
     }
 
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
@@ -1473,10 +1479,11 @@
             prod = self.pool.get('product.product').browse(cr, uid, product, context=context)
             prod_uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context)
             if prod.uom_id.category_id.id != prod_uom.category_id.id:
-                 warning = {
+                warning = {
                     'title': _('Warning!'),
                     'message': _('The selected unit of measure is not compatible with the unit of measure of the product.')
-            }
+                }
+                res['value'].update({'uos_id': prod.uom_id.id})
             return {'value': res['value'], 'warning': warning}
         return res
 

=== modified file 'account/account_invoice_view.xml'
--- account/account_invoice_view.xml	2012-08-15 22:30:38 +0000
+++ account/account_invoice_view.xml	2012-08-22 07:32:56 +0000
@@ -343,7 +343,7 @@
                             <field name="invoice_line" nolabel="1" widget="one2many_list" context="{'type': type}">
                                 <tree string="Invoice Lines" editable="bottom">
                                     <field name="invoice_line_tax_id" invisible="1"/>
-                                    <field name="product_id" />
+                                    <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
                                     <field name="name"/>
                                     <field name="account_id" groups="account.group_account_user"
                                         domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]"

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to