python - Odoo: Get default field values that will be in the form beforehand -


i have form views similar account.voucher.receipt.dialog.form (odoo/addons/account_voucher/voucher_payment_receipt_view.xml).

  • some field tags default values defined in model,

  • some field tags default values on change methods (defined on_change attributes).

i want bypass these form views , automate process, need know beforehand these default field values. in way, need add additional field values if needed, call create method on model. (i'm using odoo v8). how can achieve that?

if want print in log default values of model can this:

from inspect import isfunction  @api.multi def get_default_fields(self):     key, value in self._fields.iteritems():         if value.name not in models.magic_columns:             if self._defaults.get(value.name, false):                 if isfunction(self._defaults[value.name]):                     _logger.debug(self._defaults[value.name](                         self, self.env.cr, self.env.uid, none                     ))                 else:                     _logger.debug(self._defaults[value.name]) 

i think can adapt code needs.

and if want value of 1 field assigned onchange method maybe have run method manually


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -