Last active
December 12, 2015 03:49
Reload wizard start data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Updated, try to use the existing state if possible otherwise use the model defaults. | |
def default_start(self, fields): | |
LookupConfig = Pool().get('product_lookup.lookup.config') | |
if self.start.forecast_date: | |
defaults['forecast_date'] = self.start.forecast_date | |
else: | |
defaults['forecast_date'] = LookupConfig.default_forecast_date() | |
return defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/trytond/protocols/jsonrpc.py", line 123, in _marshaled_dispatch | |
response['result'] = dispatch_method(method, params) | |
File "/trytond/protocols/jsonrpc.py", line 156, in _dispatch | |
res = dispatch(*args) | |
File "/trytond/protocols/dispatcher.py", line 154, in dispatch | |
result = rpc.result(meth(*args, **kwargs)) | |
File "/trytond/wizard/wizard.py", line 259, in execute | |
return wizard._execute(state_name) | |
File "/trytond/wizard/wizard.py", line 271, in _execute | |
view['fields'].keys()) | |
File "/trytond/wizard/wizard.py", line 87, in get_defaults | |
defaults.update(default(fields)) | |
File "/trytond/modules/product_lookup_stock/lookup.py", line 65, in default_start | |
if self.start.forecast_date: | |
File "/trytond/model/model.py", line 629, in __getattr__ | |
% (self.__name__, name, self._values)) | |
AttributeError: 'product_lookup.lookup.config' Model has no attribute 'forecast_date': None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extends the original ModelView defined in another module. | |
class LookupConfig: | |
__name__ = 'product_lookup.lookup.config' | |
forecast_date = fields.Date( | |
'At Date', help='Compute the expected '\ | |
'stock quantities for this date.\n'\ | |
'* An empty value is an infinite date in the future.\n'\ | |
'* A date in the past will provide historical values.') | |
@staticmethod | |
def default_forecast_date(): | |
Date = Pool().get('ir.date') | |
return Date.today() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment