class Configuration(ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Sale Configuration' __name__ = 'sale.configuration' sale_sequence = fields.MultiValue( fields.Many2One('ir.sequence', "Sale Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'sale.sale'), ])) sale_invoice_method = fields.MultiValue(sale_invoice_method) get_sale_invoice_methods = get_sale_methods('invoice_method') sale_shipment_method = fields.MultiValue(sale_shipment_method) get_sale_shipment_methods = get_sale_methods('shipment_method') sale_process_after = fields.TimeDelta( "Process Sale after", help="The grace period during which confirmed sale " "can still be reset to draft.\n" "Applied if a worker queue is activated.") @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'sale_invoice_method', 'sale_shipment_method'}: return pool.get('sale.configuration.sale_method') if field == 'sale_sequence': return pool.get('sale.configuration.sequence') return super(Configuration, cls).multivalue_model(field) default_sale_sequence = default_func('sale_sequence') default_sale_invoice_method = default_func('sale_invoice_method') default_sale_shipment_method = default_func('sale_shipment_method')
class Configuration(ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Cashier Configuration' __name__ = 'cashier.configuration' party_sale = fields.MultiValue(fields.Many2One('party.party', "Party Sale")) close_seq = fields.MultiValue( fields.Many2One('ir.sequence', "Close Sequence", domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'cashier.close'), ])) diff_account = fields.MultiValue( fields.Many2One('account.account', 'Diff Account', domain=[ ('company', '=', Eval('context', {}).get('company', -1)), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'close_seq'}: return pool.get('cashier.configuration.sequences') if field in {'party_sale'}: return pool.get('cashier.configuration.parties') elif field == 'diff_account': return pool.get('cashier.configuration.accounts') return super(Configuration, cls).multivalue_model(field)
class Configuration(_SyntaxMixin, metaclass=PoolMeta): __name__ = 'account.configuration' _states = { 'required': Bool(Eval('chorus_login')), } _depends = ['chorus_login'] chorus_login = fields.MultiValue(fields.Char("Chorus Login")) chorus_password = fields.MultiValue( fields.Char("Chorus Password", states=_states, depends=_depends)) chorus_service = fields.MultiValue( fields.Selection([ (None, ""), ('service-qualif', "Qualification"), ('service', "Production"), ], "Chorus Service", states=_states, depends=_depends)) chorus_syntax = fields.Selection('get_syntaxes', "Chorus Syntax", states=_states, depends=_depends) del _states, _depends @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'chorus_login', 'chorus_password', 'chorus_service'}: return pool.get('account.credential.chorus') return super(Configuration, cls).multivalue_model(field)
class GnuHealthSequences(ModelSingleton, ModelSQL, ModelView): "GNU Health Sequences" __name__ = "gnuhealth.sequences" imaging_request_sequence = fields.MultiValue( fields.Many2One('ir.sequence', 'Imaging Request Sequence', domain=[('code', '=', 'gnuhealth.imaging.test.request') ], required=True)) imaging_sequence = fields.MultiValue( fields.Many2One('ir.sequence', 'Imaging Sequence', domain=[('code', '=', 'gnuhealth.imaging.test.result') ], required=True)) @classmethod def multivalue_model(cls, field): pool = Pool() if field in sequences: return pool.get('gnuhealth.sequence.setup') return super(GnuHealthSequences, cls).multivalue_model(field) @classmethod def default_imaging_request_sequence(cls): return cls.multivalue_model( 'imaging_request_sequence').default_imaging_request_sequence() @classmethod def default_imaging_sequence(cls): return cls.multivalue_model( 'imaging_sequence').default_imaging_sequence()
class Configuration( ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Sale Configuration' __name__ = 'sale.configuration' sale_sequence = fields.MultiValue(fields.Many2One( 'ir.sequence', "Sale Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'sale.sale'), ])) sale_invoice_method = fields.MultiValue(sale_invoice_method) get_sale_invoice_methods = get_sale_methods('invoice_method') sale_shipment_method = fields.MultiValue(sale_shipment_method) get_sale_shipment_methods = get_sale_methods('shipment_method') @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'sale_invoice_method', 'sale_shipment_method'}: return pool.get('sale.configuration.sale_method') if field == 'sale_sequence': return pool.get('sale.configuration.sequence') return super(Configuration, cls).multivalue_model(field) default_sale_sequence = default_func('sale_sequence') default_sale_invoice_method = default_func('sale_invoice_method') default_sale_shipment_method = default_func('sale_shipment_method')
class GnuHealthSequences(ModelSingleton, ModelSQL, ModelView): "Standard Sequences for GNU Health" __name__ = "gnuhealth.sequences" lab_sequence = fields.MultiValue(fields.Many2One('ir.sequence', 'Lab Sequence', domain=[('code', '=', 'gnuhealth.lab')], required=True)) lab_request_sequence = fields.MultiValue(fields.Many2One('ir.sequence', 'Patient Lab Request Sequence', required=True, domain=[('code', '=', 'gnuhealth.patient.lab.test')])) @classmethod def multivalue_model(cls, field): pool = Pool() if field in sequences: return pool.get('gnuhealth.sequence.setup') return super(GnuHealthSequences, cls).multivalue_model(field) @classmethod def default_lab_request_sequence(cls): return cls.multivalue_model( 'lab_request_sequence').default_lab_request_sequence() @classmethod def default_lab_sequence(cls): return cls.multivalue_model( 'lab_sequence').default_lab_sequence()
class Configuration(metaclass=PoolMeta): __name__ = 'account.configuration' asset_sequence = fields.MultiValue( fields.Many2One('ir.sequence', "Asset Reference Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'account.asset'), ])) asset_bymonthday = fields.MultiValue(asset_bymonthday) asset_bymonth = fields.MultiValue(asset_bymonth) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'asset_bymonthday', 'asset_bymonth'}: return pool.get('account.configuration.asset_date') return super(Configuration, cls).multivalue_model(field) @classmethod def default_asset_sequence(cls, **pattern): return cls.multivalue_model('asset_sequence').default_asset_sequence() @classmethod def default_asset_bymonthday(cls, **pattern): return cls.multivalue_model( 'asset_bymonthday').default_asset_bymonthday() @classmethod def default_asset_bymonth(cls, **pattern): return cls.multivalue_model('asset_bymonth').default_asset_bymonth()
class Configuration(metaclass=PoolMeta): __name__ = 'cash_bank.configuration' default_collected_in_advanced_account = fields.MultiValue( fields.Many2One('account.account', 'Default Collected in Advanced Account', required=True, domain=[ ('company', '=', Eval('context', {}).get('company', -1)), ('type', '!=', None), ('closed', '!=', True), ('reconcile', '=', True), ('party_required', '=', True), ])) default_paid_in_advanced_account = fields.MultiValue( fields.Many2One('account.account', 'Default Paid in Advanced Account', required=True, domain=[ ('company', '=', Eval('context', {}).get('company', -1)), ('type', '!=', None), ('closed', '!=', True), ('reconcile', '=', True), ('party_required', '=', True), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field in \ {'default_collected_in_advanced_account', 'default_paid_in_advanced_account'}: return pool.get('cash_bank.configuration.account') return super(Configuration, cls).multivalue_model(field)
class Configuration(metaclass=PoolMeta): __name__ = 'account.configuration' default_category_account_expense = fields.MultiValue( fields.Many2One('account.account', 'Default Account Expense', domain=[ ('kind', '=', 'expense'), ('company', '=', Eval('context', {}).get('company', -1)), ])) default_category_account_revenue = fields.MultiValue( fields.Many2One('account.account', 'Default Account Revenue', domain=[ ('kind', '=', 'revenue'), ('company', '=', Eval('context', {}).get('company', -1)), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field in { 'default_category_account_expense', 'default_category_account_revenue' }: return pool.get('account.configuration.default_account') return super(Configuration, cls).multivalue_model(field)
class Configuration(ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Account Configuration' __name__ = 'account.configuration' default_account_receivable = fields.MultiValue( fields.Many2One('account.account', "Default Account Receivable", domain=[ ('kind', '=', 'receivable'), ('party_required', '=', True), ('company', '=', Eval('context', {}).get('company', -1)), ])) default_account_payable = fields.MultiValue( fields.Many2One('account.account', "Default Account Payable", domain=[ ('kind', '=', 'payable'), ('party_required', '=', True), ('company', '=', Eval('context', {}).get('company', -1)), ])) tax_rounding = fields.MultiValue( fields.Selection(tax_roundings, "Tax Rounding")) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'default_account_receivable', 'default_account_payable'}: return pool.get('account.configuration.default_account') return super(Configuration, cls).multivalue_model(field) @classmethod def default_tax_rounding(cls, **pattern): return cls.multivalue_model('tax_rounding').default_tax_rounding()
class Configuration( ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Contract Configuration' __name__ = 'contract.configuration' contract_sequence = fields.MultiValue(fields.Many2One( 'ir.sequence', "Contract Reference Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'contract'), ])) journal = fields.MultiValue(fields.Many2One( 'account.journal', "Journal", required=True, domain=[ ('type', '=', 'revenue'), ])) default_months_renewal = fields.Integer('Review Months Renewal') default_review_limit_date = fields.TimeDelta('Limit Date', help="The deadline date on which the actions should be performed.") default_review_alarm = fields.TimeDelta('Alarm Date', help="The date when actions related to reviews should start to be managed.") @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'contract_sequence': return pool.get('contract.configuration.sequence') elif field == 'journal': return pool.get('contract.configuration.account') return super(Configuration, cls).multivalue_model(field) @classmethod def default_contract_sequence(cls, **pattern): return cls.multivalue_model( 'contract_sequence').default_contract_sequence()
class Party(ModelSQL, ModelView): __name__ = 'party.party' customer_payment_term = fields.MultiValue(customer_payment_term) supplier_payment_term = fields.MultiValue(supplier_payment_term) payment_terms = fields.One2Many('party.party.payment_term', 'party', "Payment Terms") @classmethod def __register__(cls, module_name): ModelField = Pool().get('ir.model.field') # Migration from 2.2: property field payment_term renamed # to customer_payment_term fields = ModelField.search([('name', '=', 'payment_term'), ('model.model', '=', 'party.party')]) if fields: ModelField.write(fields, { 'name': 'customer_payment_term', }) super(Party, cls).__register__(module_name) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'customer_payment_term', 'supplier_payment_term'}: return pool.get('party.party.payment_term') return super(Party, cls).multivalue_model(field)
class Configuration( ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Cash / Bank Configuration' __name__ = 'cash_bank.configuration' account_transfer = fields.MultiValue(fields.Many2One('account.account', 'Account Transfer', domain=[ ('company', '=', Eval('context', {}).get('company', -1)), ('type', '!=', None), ('closed', '!=', True), ])) convertion_seq = fields.MultiValue(fields.Many2One( 'ir.sequence', "Cash and Bank Convertion Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'cash_bank.convertion'), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'account_transfer',}: return pool.get('cash_bank.configuration.account') if field == 'convertion_seq': return pool.get('cash_bank.configuration.sequences') return super(Configuration, cls).multivalue_model(field)
class GnuHealthSequences(ModelSingleton, ModelSQL, ModelView): "Standard Sequences for GNU Health" __name__ = "gnuhealth.sequences" ambulatory_care_sequence = fields.MultiValue( fields.Many2One('ir.sequence', 'Health Ambulatory Care', domain=[('code', '=', 'gnuhealth.ambulatory_care')])) patient_rounding_sequence = fields.MultiValue( fields.Many2One('ir.sequence', 'Health Rounding', domain=[('code', '=', 'gnuhealth.patient.rounding')])) @classmethod def multivalue_model(cls, field): pool = Pool() if field in sequences: return pool.get('gnuhealth.sequence.setup') return super(GnuHealthSequences, cls).multivalue_model(field) @classmethod def default_patient_rounding_sequence(cls): return cls.multivalue_model( 'patient_rounding_sequence').default_patient_rounding_sequence() @classmethod def default_ambulatory_care_sequence(cls): return cls.multivalue_model( 'ambulatory_care_sequence').default_ambulatory_care_sequence()
class Configuration(ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Purchase Configuration' __name__ = 'purchase.configuration' purchase_sequence = fields.MultiValue( fields.Many2One('ir.sequence', "Purchase Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'purchase.purchase'), ])) purchase_invoice_method = fields.MultiValue(purchase_invoice_method) get_purchase_invoice_method = get_purchase_methods('invoice_method') @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'purchase_invoice_method': return pool.get('purchase.configuration.purchase_method') if field == 'purchase_sequence': return pool.get('purchase.configuration.sequence') return super(Configuration, cls).multivalue_model(field) @classmethod def default_purchase_sequence(cls, **pattern): return cls.multivalue_model( 'purchase_sequence').default_purchase_sequence() @classmethod def default_purchase_invoice_method(cls, **pattern): return cls.multivalue_model( 'purchase_invoice_method').default_purchase_invoice_method()
class Configuration(ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Account Configuration' __name__ = 'account.configuration' default_account_receivable = fields.MultiValue( fields.Many2One('account.account', "Default Account Receivable", domain=[ ('type.receivable', '=', True), ('party_required', '=', True), ('company', '=', Eval('context', {}).get('company', -1)), ])) default_account_payable = fields.MultiValue( fields.Many2One('account.account', "Default Account Payable", domain=[ ('type.payable', '=', True), ('party_required', '=', True), ('company', '=', Eval('context', {}).get('company', -1)), ])) default_customer_tax_rule = fields.MultiValue( fields.Many2One('account.tax.rule', "Default Customer Tax Rule", domain=[ ('company', '=', Eval('context', {}).get('company', -1)), ('kind', 'in', ['sale', 'both']), ], help="Default customer tax rule for new parties.")) default_supplier_tax_rule = fields.MultiValue( fields.Many2One('account.tax.rule', "Default Supplier Tax Rule", domain=[ ('company', '=', Eval('context', {}).get('company', -1)), ('kind', 'in', ['purchase', 'both']), ], help="Default supplier tax rule for new parties.")) tax_rounding = fields.MultiValue( fields.Selection(tax_roundings, "Tax Rounding")) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'default_account_receivable', 'default_account_payable'}: return pool.get('account.configuration.default_account') if field in {'default_customer_tax_rule', 'default_supplier_tax_rule'}: return pool.get('account.configuration.default_tax_rule') return super(Configuration, cls).multivalue_model(field) @classmethod def default_tax_rounding(cls, **pattern): return cls.multivalue_model('tax_rounding').default_tax_rounding()
class Category(metaclass=PoolMeta): __name__ = 'product.category' account_depreciation = fields.MultiValue( fields.Many2One('account.account', 'Account Depreciation', domain=[ ('type.fixed_asset', '=', True), ('company', '=', Eval('context', {}).get('company', -1)), ], states={ 'invisible': (~Eval('context', {}).get('company') | Eval('account_parent') | ~Eval('accounting', False)), })) account_asset = fields.MultiValue( fields.Many2One('account.account', 'Account Asset', domain=[ ('type.fixed_asset', '=', True), ('company', '=', Eval('context', {}).get('company', -1)), ], states={ 'invisible': (~Eval('context', {}).get('company') | Eval('account_parent') | ~Eval('accounting', False)), })) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'account_depreciation', 'account_asset'}: return pool.get('product.category.account') return super(Category, cls).multivalue_model(field) @property @account_used('account_depreciation') def account_depreciation_used(self): pass @property @account_used('account_asset') def account_asset_used(self): pass @fields.depends('accounting', 'account_depreciation', 'account_asset') def on_change_accounting(self): super().on_change_accounting() if not self.accounting: self.account_depreciation = None self.account_asset = None
class Party(ModelSQL, ModelView): __name__ = 'party.party' customer_payment_term = fields.MultiValue(customer_payment_term) supplier_payment_term = fields.MultiValue(supplier_payment_term) payment_terms = fields.One2Many('party.party.payment_term', 'party', "Payment Terms") @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'customer_payment_term', 'supplier_payment_term'}: return pool.get('party.party.payment_term') return super(Party, cls).multivalue_model(field)
class Configuration(metaclass=PoolMeta): __name__ = 'payment_collect.configuration' payment_method_mipago = fields.MultiValue(fields.Many2One( 'account.invoice.payment.method', "MiPago Payment Method")) mipago_company_code = fields.MultiValue(fields.Char('MiPago Company code')) @classmethod def multivalue_model(cls, field): pool = Pool() if field in ['payment_method_mipago', 'mipago_company_code']: return pool.get('payment_collect.configuration.mipago') return super().multivalue_model(field)
class Product(CompanyMultiValueMixin, metaclass=PoolMeta): __name__ = "product.product" quantity_min = fields.MultiValue(fields.Float('Min quantity limit')) quantity_max = fields.MultiValue(fields.Float('Max quantity limit')) quantities = fields.One2Many('product.product.min_max', 'product', "Quantities") @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'quantity_min', 'quantity_max'}: return pool.get('product.product.min_max') return super(Product, cls).multivalue_model(field)
class Configuration(metaclass=PoolMeta): __name__ = 'payment_collect.configuration' payment_method_cabal = fields.MultiValue(fields.Many2One( 'account.invoice.payment.method', "Payment Method CABAL", required=True)) cabal_company_code = fields.MultiValue(fields.Char('Comany code CABAL')) @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'cabal_company_code': return pool.get('payment_collect.configuration.cabal') elif field == 'payment_method_cabal': return pool.get('payment_collect.configuration.cabal') return super(Configuration, cls).multivalue_model(field)
class Configuration(ModelSingleton, ModelSQL, ModelView, MultiValueMixin): 'Party Configuration' __name__ = 'party.configuration' party_sequence = fields.MultiValue(party_sequence) party_lang = fields.MultiValue(party_lang) @classmethod def default_party_sequence(cls, **pattern): pool = Pool() ModelData = pool.get('ir.model.data') try: return ModelData.get_id('party', 'sequence_party') except KeyError: return None
class Configuration: __metaclass__ = PoolMeta __name__ = 'account.configuration' stock_journal = fields.MultiValue(stock_journal) cost_price_counterpart_account = fields.MultiValue( fields.Many2One('account.account', "Cost Price Counterpart Account", domain=[ ('company', 'in', [Get(Eval('context', {}), 'company'), None]), ])) @classmethod def default_stock_journal(cls, **pattern): return cls.multivalue_model('stock_journal').default_stock_journal()
class Category: __metaclass__ = PoolMeta __name__ = 'product.category' account_depreciation = fields.MultiValue( fields.Many2One('account.account', 'Account Depreciation', domain=[ ('kind', '=', 'other'), ('company', '=', Eval('context', {}).get('company', -1)), ], states={ 'invisible': (~Eval('context', {}).get('company') | Eval('account_parent') | ~Eval('accounting', False)), }, depends=['account_parent', 'accounting'])) account_asset = fields.MultiValue( fields.Many2One('account.account', 'Account Asset', domain=[ ('kind', '=', 'expense'), ('company', '=', Eval('context', {}).get('company', -1)), ], states={ 'invisible': (~Eval('context', {}).get('company') | Eval('account_parent') | ~Eval('accounting', False)), }, depends=['account_parent', 'accounting'])) @classmethod def multivalue_model(cls, field): pool = Pool() if field in {'account_depreciation', 'account_asset'}: return pool.get('product.category.account') return super(Category, cls).multivalue_model(field) @property @account_used('account_depreciation') def account_depreciation_used(self): pass @property @account_used('account_asset') def account_asset_used(self): pass
class Template: __metaclass__ = PoolMeta __name__ = 'product.template' account_cogs = fields.MultiValue(fields.Many2One('account.account', 'Account Cost of Goods Sold', domain=[ ('kind', '!=', 'view'), ('company', '=', Eval('context', {}).get('company', -1)), ], states={ 'invisible': ((~Eval('context', {}).get('company')) | Eval('account_category') | (Eval('type') != 'goods')), }, help='This account will be used instead of the one defined ' 'on the category.', depends=['account_category', 'type'])) @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'account_cogs': return pool.get('product.template.account') return super(Template, cls).multivalue_model(field) @property @account_used('account_cogs') def account_cogs_used(self): pass
class Category: __metaclass__ = PoolMeta __name__ = 'product.category' account_cogs = fields.MultiValue(fields.Many2One('account.account', 'Account Cost of Goods Sold', domain=[ ('kind', '!=', 'view'), ('company', '=', Eval('context', {}).get('company', -1)), ], states={ 'invisible': (~Eval('context', {}, ).get('company') | Eval('account_parent') | ~Eval('accounting', False)), }, depends=['account_parent', 'accounting'])) @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'account_cogs': return pool.get('product.category.account') return super(Category, cls).multivalue_model(field) @property @account_used('account_cogs') def account_cogs_used(self): pass
class Configuration(metaclass=PoolMeta): 'Sale Configuration' __name__ = 'sale.configuration' iesa_expense_sequence = fields.MultiValue( fields.Many2One('ir.sequence', "Expense IESA Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'account.iesa.expense'), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'iesa_expense_sequence': return pool.get('sale.configuration.sequence') return super(Configuration, cls).multivalue_model(field) @classmethod def default_iesa_expense_sequence(cls, **pattern): return cls.multivalue_model( 'iesa_expense_sequence').default_iesa_expense_sequence()
class Configuration(metaclass=PoolMeta): __name__ = 'sale.configuration' complaint_sequence = fields.MultiValue( fields.Many2One('ir.sequence', "Complaint Sequence", required=True, domain=[ ('sequence_type', '=', Id('sale_complaint', 'sequence_type_complaint')), ('company', 'in', [Eval('context', {}).get('company', -1), None]), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'complaint_sequence': return pool.get('sale.configuration.sequence') return super(Configuration, cls).multivalue_model(field) @classmethod def default_complaint_sequence(cls, **pattern): return cls.multivalue_model( 'complaint_sequence').default_complaint_sequence()
class Configuration(ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin): 'Activity Configuration' __name__ = 'activity.configuration' activity_sequence = fields.MultiValue( fields.Many2One('ir.sequence', 'Activity Sequence', required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'activity.activity'), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'activity_sequence': return pool.get('activity.configuration.sequence') return super(Configuration, cls).multivalue_model(field) @classmethod def default_activity_sequence(cls, **pattern): field_name = 'activity_sequence' return getattr(cls.multivalue_model(field_name), 'default_%s' % field_name, lambda: None)()
class Configuration: __metaclass__ = PoolMeta __name__ = 'stock.configuration' shipment_drop_sequence = fields.MultiValue( fields.Many2One('ir.sequence', "Drop Shipment Sequence", required=True, domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), ('code', '=', 'stock.shipment.drop'), ])) @classmethod def multivalue_model(cls, field): pool = Pool() if field == 'shipment_drop_sequence': return pool.get('stock.configuration.sequence') return super(Configuration, cls).multivalue_model(field) @classmethod def default_shipment_drop_sequence(cls, **pattern): return cls.multivalue_model( 'shipment_drop_sequence').default_shipment_drop_sequence()