Hi everyone
Sorry because I'm not good at English.
I want to modify default value of "source location" and "destination location". So, my problem is the value of Location when I create a "Receive/Deliver Products -> Incoming Products" has been changed. But after that, about 1 second, It return the old value as model "stock.move" define it.
But when I create a "Receive/Deliver By Orders -> Incoming Shipments" and click "Add an items", the value of Location same the value I modify in my module
So, do you understand me?
from openerp.osv import fields, osv, orm
from openerp.tools.translate import _
from openerp import tools
from openerp.tools import float_compare, DEFAULT_SERVER_DATETIME_FORMATclass default_location(osv.osv):
_inherit = 'stock.move'
def _default_location_destination(self, cr, uid, context=None):
"""some thing here"""return location_id
def _default_location_source(self, cr, uid, context=None):
"""some thing here"""return location_id
_columns = {
'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True,states={'done': [('readonly', True)]}, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."),
'location_dest_id': fields.many2one('stock.location', 'Destination Location', required=True,states={'done': [('readonly', True)]}, select=True, help="Location where the system will stock the finished products."),
}_defaults = {
'location_id': _default_location_source,
'location_dest_id': _default_location_destination,
}default_location()
So? What is wrong?
Help me! Thank you so much
what do you mean by "they returned the last value right now, as I didn't modify them" ?? So, according to your question _defaults works fine. so what is your question? Describe the problem in detail
MSSV: 51104177