bzr revid: mra@mra-laptop-20100706115632-ar3g22cjjqfo331i
This commit is contained in:
Mustufa Rangwala 2010-07-06 17:26:32 +05:30
parent 11284af16d
commit c47792af54
3 changed files with 56 additions and 53 deletions

View File

@ -26,4 +26,3 @@ import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -23,7 +23,6 @@ from osv import fields, osv
import ir
class res_partner(osv.osv):
_name = 'res.partner'
_inherit = 'res.partner'
_columns = {
'property_stock_customer': fields.property(
@ -34,6 +33,7 @@ class res_partner(osv.osv):
method=True,
view_load=True,
help="This stock location will be used, instead of the default one, as the destination location for goods you send to this partner"),
'property_stock_supplier': fields.property(
'stock.location',
type='many2one',
@ -43,9 +43,7 @@ class res_partner(osv.osv):
view_load=True,
help="This stock location will be used, instead of the default one, as the source location for goods you receive from the current partner"),
}
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -22,7 +22,6 @@
from osv import fields, osv
from tools.translate import _
class product_product(osv.osv):
_inherit = "product.product"
@ -31,7 +30,9 @@ class product_product(osv.osv):
@param product_id: product id
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
"""
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, context)
if context is None:
context = {}
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False
if not stock_input_acc:
@ -164,7 +165,9 @@ class product_product(osv.osv):
return move_ids
def view_header_get(self, cr, user, view_id, view_type, context):
def view_header_get(self, cr, user, view_id, view_type, context=None):
if context is None:
context = {}
res = super(product_product, self).view_header_get(cr, user, view_id, view_type, context)
if res: return res
if (context.get('location', False)):
@ -280,12 +283,14 @@ class product_product(osv.osv):
res[prod_id] -= amount
return res
def _product_available(self, cr, uid, ids, field_names=None, arg=False, context={}):
def _product_available(self, cr, uid, ids, field_names=None, arg=False, context=None):
""" Finds the incoming and outgoing quantity of product.
@return: Dictionary of values
"""
if not field_names:
field_names = []
if context is None:
context = {}
res = {}
for id in ids:
res[id] = {}.fromkeys(field_names, 0.0)
@ -323,7 +328,7 @@ class product_product(osv.osv):
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(product_product,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
if context == None:
if context is None:
context = {}
if ('location' in context) and context['location']:
location_info = self.pool.get('stock.location').browse(cr, uid, context['location'])
@ -362,10 +367,9 @@ class product_product(osv.osv):
res['fields']['virtual_available']['string'] = _('Future Productions')
if fields.get('qty_available'):
res['fields']['qty_available']['string'] = _('Produced Qty')
return res
product_product()
product_product()
class product_template(osv.osv):
_name = 'product.template'
@ -407,10 +411,12 @@ class product_template(osv.osv):
string='Stock Output Account', method=True, view_load=True,
help='This account will be used, instead of the default one, to value output stock'),
}
product_template()
class product_category(osv.osv):
_inherit = 'product.category'
_columns = {
'property_stock_journal': fields.property('account.journal',
@ -432,7 +438,7 @@ class product_category(osv.osv):
method=True, view_load=True,
help="This account will be used in product when valuation type is real-time valuation ",),
}
product_category()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: