本文整理汇总了Python中trytond.pool.Pool.default_get方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.default_get方法的具体用法?Python Pool.default_get怎么用?Python Pool.default_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trytond.pool.Pool
的用法示例。
在下文中一共展示了Pool.default_get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: default_addresses
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import default_get [as 别名]
def default_addresses():
if Transaction().user == 0:
return []
Address = Pool().get('party.address')
fields_names = list(x for x in Address._fields.keys()
if x not in ('id', 'create_uid', 'create_date',
'write_uid', 'write_date'))
return [Address.default_get(fields_names)]
示例2: get_defaults
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import default_get [as 别名]
def get_defaults(self, wizard, state_name, fields):
'''
Returns defaults values for the fields
'''
Model_ = Pool().get(self.model_name)
defaults = Model_.default_get(fields)
default = getattr(wizard, 'default_%s' % state_name, None)
if default:
defaults.update(default(fields))
return defaults
示例3: _get_grouped_invoice_domain
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import default_get [as 别名]
def _get_grouped_invoice_domain(self, invoice):
"Returns a domain that will find invoices that should be grouped"
Invoice = Pool().get('account.invoice')
invoice_domain = [
('lines.origin', 'like', 'sale.line,%'),
]
defaults = Invoice.default_get(self._invoice_grouping_fields,
with_rec_name=False)
for field in self._invoice_grouping_fields:
invoice_domain.append(
(field, '=', getattr(invoice, field, defaults.get(field)))
)
return invoice_domain
示例4: transition_selected
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import default_get [as 别名]
def transition_selected(self):
statename = self._make_component_state_view(self.selector.component_type)
state = self.states[statename]
ComponentModel = Pool().get(state.model_name)
encounter_id = self._component_data["active_id"]
component_data = {"encounter": encounter_id}
view = state.get_view()
field_names = view["fields"].keys()
if "id" in field_names:
del field_names[field_names.index["id"]]
component_data.update(ComponentModel.default_get(field_names))
real_component = ComponentModel(**component_data)
setattr(self, statename, real_component)
self._component_data.update(obj=real_component)
return statename