[IMP] addons: add _depends on models backed up by an sql view and used by other models
authorRaphael Collet <rco@openerp.com>
Tue, 8 Jul 2014 13:32:38 +0000 (15:32 +0200)
committerRaphael Collet <rco@openerp.com>
Tue, 8 Jul 2014 13:32:38 +0000 (15:32 +0200)
addons/account/report/account_invoice_report.py
addons/account_analytic_analysis/account_analytic_analysis.py
addons/account_followup/wizard/account_followup_print.py
addons/hr_evaluation/report/hr_evaluation_report.py
addons/hr_timesheet_sheet/hr_timesheet_sheet.py
addons/sale/report/invoice_report.py

index 8fecf85..7a5ce9c 100644 (file)
@@ -98,6 +98,24 @@ class account_invoice_report(osv.osv):
     }
     _order = 'date desc'
 
+    _depends = {
+        'account.invoice': [
+            'account_id', 'amount_total', 'commercial_partner_id', 'company_id',
+            'currency_id', 'date_due', 'date_invoice', 'fiscal_position',
+            'journal_id', 'partner_bank_id', 'partner_id', 'payment_term',
+            'period_id', 'residual', 'state', 'type', 'user_id',
+        ],
+        'account.invoice.line': [
+            'account_id', 'invoice_id', 'price_subtotal', 'product_id',
+            'quantity', 'uos_id',
+        ],
+        'product.product': ['product_tmpl_id'],
+        'product.template': ['categ_id'],
+        'product.uom': ['category_id', 'factor', 'name', 'uom_type'],
+        'res.currency.rate': ['currency_id', 'name'],
+        'res.partner': ['country_id'],
+    }
+
     def _select(self):
         select_str = """
             SELECT sub.id, sub.date, sub.product_id, sub.partner_id, sub.country_id,
index 3b58199..d1647f7 100644 (file)
@@ -804,6 +804,12 @@ class account_analytic_account_summary_user(osv.osv):
         'user': fields.many2one('res.users', 'User'),
     }
 
+    _depends = {
+        'res.users': ['id'],
+        'account.analytic.line': ['account_id', 'journal_id', 'unit_amount', 'user_id'],
+        'account.analytic.journal': ['type'],
+    }
+
     def init(self, cr):
         openerp.tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_user')
         cr.execute('''CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (
@@ -837,6 +843,11 @@ class account_analytic_account_summary_month(osv.osv):
         'month': fields.char('Month', size=32, readonly=True),
     }
 
+    _depends = {
+        'account.analytic.line': ['account_id', 'date', 'journal_id', 'month', 'unit_amount'],
+        'account.analytic.journal': ['type'],
+    }
+
     def init(self, cr):
         openerp.tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_month')
         cr.execute('CREATE VIEW account_analytic_analysis_summary_month AS (' \
index 8310072..550ca75 100644 (file)
@@ -42,6 +42,14 @@ class account_followup_stat_by_partner(osv.osv):
         'company_id': fields.many2one('res.company', 'Company', readonly=True),
     }
 
+    _depends = {
+        'account.move.line': [
+            'account_id', 'company_id', 'credit', 'date', 'debit',
+            'followup_date', 'followup_line_id', 'partner_id', 'reconcile_id',
+        ],
+        'account.account': ['active', 'type'],
+    }
+
     def init(self, cr):
         tools.drop_view_if_exists(cr, 'account_followup_stat_by_partner')
         # Here we don't have other choice but to create a virtual ID based on the concatenation
index ce6f381..32ec3f4 100644 (file)
@@ -59,6 +59,14 @@ class hr_evaluation_report(osv.Model):
     }
     _order = 'create_date desc'
 
+    _depends = {
+        'hr.evaluation.interview': ['evaluation_id', 'id', 'request_id'],
+        'hr_evaluation.evaluation': [
+            'create_date', 'date', 'date_close', 'employee_id', 'plan_id',
+            'rating', 'state',
+        ],
+    }
+
     def init(self, cr):
         tools.drop_view_if_exists(cr, 'hr_evaluation_report')
         cr.execute("""
index 7bbcda2..96be836 100644 (file)
@@ -533,9 +533,9 @@ class hr_timesheet_sheet_sheet_day(osv.osv):
         'total_difference': fields.float('Difference', readonly=True),
     }
     _depends = {
-        'hr.analytic.timesheet': ['line_id', 'sheet_id'],
         'account.analytic.line': ['date', 'unit_amount'],
-        'hr.attendance': ['name', 'action', 'sheet_id'],
+        'hr.analytic.timesheet': ['line_id', 'sheet_id'],
+        'hr.attendance': ['action', 'name', 'sheet_id'],
     }
 
     def init(self, cr):
@@ -607,6 +607,12 @@ class hr_timesheet_sheet_sheet_account(osv.osv):
         'invoice_rate': fields.many2one('hr_timesheet_invoice.factor', 'Invoice rate', readonly=True),
         }
 
+    _depends = {
+        'account.analytic.line': ['account_id', 'date', 'to_invoice', 'unit_amount', 'user_id'],
+        'hr.analytic.timesheet': ['line_id'],
+        'hr_timesheet_sheet.sheet': ['date_from', 'date_to', 'user_id'],
+    }
+
     def init(self, cr):
         cr.execute("""create or replace view hr_timesheet_sheet_sheet_account as (
             select
index c12db9b..e66dadd 100644 (file)
@@ -25,6 +25,9 @@ class account_invoice_report(osv.osv):
     _columns = {
         'section_id': fields.many2one('crm.case.section', 'Sales Team'),
     }
+    _depends = {
+        'account.invoice': ['section_id'],
+    }
 
     def _select(self):
         return  super(account_invoice_report, self)._select() + ", sub.section_id as section_id"