[IMP] removed warning in account

bzr revid: fp@tinyerp.com-20130630142927-juf7c4pa70lw7l6q
This commit is contained in:
Fabien Pinckaers 2013-06-30 16:29:27 +02:00
parent 77ceb83f69
commit e58748609a
2 changed files with 15 additions and 13 deletions

View File

@ -16,7 +16,6 @@
</record> </record>
<record id="account_payment_term_line_immediate" model="account.payment.term.line"> <record id="account_payment_term_line_immediate" model="account.payment.term.line">
<field name="name">Immediate Payment</field>
<field name="value">balance</field> <field name="value">balance</field>
<field eval="0" name="days"/> <field eval="0" name="days"/>
<field eval="0" name="days2"/> <field eval="0" name="days2"/>
@ -52,7 +51,7 @@
<field eval="0" name="days2"/> <field eval="0" name="days2"/>
<field eval="account_payment_term_net" name="payment_id"/> <field eval="account_payment_term_net" name="payment_id"/>
</record> </record>
<!-- <!--
Account Journal Sequences Account Journal Sequences
--> -->

View File

@ -105,9 +105,8 @@ class stock_location(osv.osv):
\n* Production: Virtual counterpart location for production operations: this location consumes the raw material and produces finished products \n* Production: Virtual counterpart location for production operations: this location consumes the raw material and produces finished products
""", select = True), """, select = True),
'complete_name': fields.function(_complete_name, type='char', size=256, string="Location Name", 'complete_name': fields.function(_complete_name, type='char', string="Location Name",
store={'stock.location': (_get_sublocations, ['name', 'location_id'], 10)}), store={'stock.location': (_get_sublocations, ['name', 'location_id'], 10)}),
'location_id': fields.many2one('stock.location', 'Parent Location', select=True, ondelete='cascade'), 'location_id': fields.many2one('stock.location', 'Parent Location', select=True, ondelete='cascade'),
'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'), 'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'),
@ -145,12 +144,14 @@ class stock_location(osv.osv):
} }
def get_removal_strategy(self, cr, uid, location, product, context=None): def get_removal_strategy(self, cr, uid, location, product, context=None):
categ = product.categ_id categ = product.categ_id
print product and product.name or 'no prod'
print categ and categ.name or 'NO'
while (not categ.removal_strategy_id) and categ.parent_id: while (not categ.removal_strategy_id) and categ.parent_id:
categ = categ.parent_id categ = categ.parent_id
return categ and categ.removal_strategy_id or None return categ and categ.removal_strategy_id or None
#----------------------------------------------------------
# Quants
#----------------------------------------------------------
class stock_quant(osv.osv): class stock_quant(osv.osv):
""" """
Quants are the smallest unit of stock physical instances Quants are the smallest unit of stock physical instances
@ -158,7 +159,7 @@ class stock_quant(osv.osv):
_name = "stock.quant" _name = "stock.quant"
_description = "Quants" _description = "Quants"
_columns = { _columns = {
'name': fields.char('Identifier', help='serial... '), # TODO improve me 'name': fields.char('Identifier'),
'product_id': fields.many2one('product.product', 'Product', required=True), 'product_id': fields.many2one('product.product', 'Product', required=True),
'location_id': fields.many2one('stock.location', 'Location', required=True), 'location_id': fields.many2one('stock.location', 'Location', required=True),
'qty': fields.float('Quantity', required=True, help="Quantity of products in this quant, in the default unit of measure of the product"), 'qty': fields.float('Quantity', required=True, help="Quantity of products in this quant, in the default unit of measure of the product"),
@ -555,10 +556,10 @@ class stock_quant(osv.osv):
# return res # return res
#---------------------------------------------------------- #----------------------------------------------------------
# Stock Picking # Stock Picking
#---------------------------------------------------------- #----------------------------------------------------------
class stock_picking(osv.osv): class stock_picking(osv.osv):
_name = "stock.picking" _name = "stock.picking"
_inherit = ['mail.thread'] _inherit = ['mail.thread']
@ -1588,7 +1589,8 @@ class stock_move(osv.osv):
'date_expected': fields.datetime('Scheduled Date', states={'done': [('readonly', True)]},required=True, select=True, help="Scheduled date for the processing of this move"), 'date_expected': fields.datetime('Scheduled Date', states={'done': [('readonly', True)]},required=True, select=True, help="Scheduled date for the processing of this move"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')],states={'done': [('readonly', True)]}), 'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')],states={'done': [('readonly', True)]}),
'product_qty': fields.function(_quantity_normalize, type='float', store=True, string='Quantity', 'product_qty': fields.function(_quantity_normalize, type='float', store=True, string='Quantity',
digits_compute=dp.get_precision('Product Unit of Measure'), 'Quantity in the default UoM of the product'), digits_compute=dp.get_precision('Product Unit of Measure'),
help='Quantity in the default UoM of the product'),
'product_uom_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), 'product_uom_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'),
required=True,states={'done': [('readonly', True)]}, required=True,states={'done': [('readonly', True)]},
help="This is the quantity of products from an inventory " help="This is the quantity of products from an inventory "
@ -2507,19 +2509,20 @@ class stock_inventory_line(osv.osv):
'location_id': _default_stock_location 'location_id': _default_stock_location
} }
def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False, to_date=False): def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False, to_date=False, context=None):
""" Changes UoM and name if product_id changes. """ Changes UoM and name if product_id changes.
@param location_id: Location id @param location_id: Location id
@param product: Changed product_id @param product: Changed product_id
@param uom: UoM product @param uom: UoM product
@return: Dictionary of changed values @return: Dictionary of changed values
""" """
context=context or {}
if not product: if not product:
return {'value': {'product_qty': 0.0, 'product_uom': False}} return {'value': {'product_qty': 0.0, 'product_uom': False}}
obj_product = self.pool.get('product.product').browse(cr, uid, product) context['location'] = location_id
obj_product = self.pool.get('product.product').browse(cr, uid, product, context=context)
uom = uom or obj_product.uom_id.id uom = uom or obj_product.uom_id.id
# FP Note: read quantity on product amount = obj_product.qty_available
amount = 0
result = {'product_qty': amount, 'product_uom': uom} result = {'product_qty': amount, 'product_uom': uom}
return {'value': result} return {'value': result}