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 (definedon_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
Post a Comment