diff --git a/contract_purchase/models/account.py b/contract_purchase/models/account.py index b7c60132..b3e3e8a1 100644 --- a/contract_purchase/models/account.py +++ b/contract_purchase/models/account.py @@ -39,22 +39,6 @@ class AccountAnalyticAccount(models.Model): return res - def fields_get( - self, cr, user, allfields=None, context=None, write_access=True, - attributes=None - ): - if not context: - context = {} - - res = super(AccountAnalyticAccount, self).fields_get( - cr, user, allfields, context, write_access, attributes) - if all(( - 'partner_id' in res, - context.get('default_type') == 'contract_purchase' - )): - res['partner_id']['string'] = _("Vendor") - return res - @api.onchange('type') def onchange_type(self): if self.type == 'purchase': diff --git a/contract_purchase/views/contract_view.xml b/contract_purchase/views/contract_view.xml index 1f05aac5..860787d2 100644 --- a/contract_purchase/views/contract_view.xml +++ b/contract_purchase/views/contract_view.xml @@ -1,14 +1,24 @@ - - account.analytic.account.type + + account.analytic.account.purchase.form account.analytic.account - + + primary + - - - + + Vendor + [('supplier', '=', True)] + { + 'default_customer': False, + 'default_supplier': True + } + + + [('purchase_ok', '=', True)] + @@ -17,6 +27,10 @@ account.analytic.account form tree,form + [('type', '=', 'purchase')] { 'search_default_active':1,