From 071fb4198f2565f2b5151a1b56fd8ea65c5bd01f Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Thu, 7 Sep 2017 18:48:35 +0200 Subject: [PATCH] view improvements --- contract_purchase/models/account.py | 16 -------------- contract_purchase/views/contract_view.xml | 26 +++++++++++++++++------ 2 files changed, 20 insertions(+), 22 deletions(-) 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,