From 583e92b18ef2cae824a5861b3472e65ac0efb5dc Mon Sep 17 00:00:00 2001
From: Martin Trigaux <mat@odoo.com>
Date: Fri, 2 Sep 2016 10:39:14 +0200
Subject: [PATCH] [FIX] remove default attribute on computed field

Which is useless when there is no inverse method
---
 addons/account/models/account_move.py      | 10 ++++++----
 addons/hr_attendance/models/hr_employee.py |  2 +-
 addons/hr_timesheet/project_timesheet.py   |  2 +-
 addons/lunch/models/lunch.py               |  2 +-
 addons/sale/models/sale.py                 |  6 +++---
 5 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 4967d33036c1..2b82cef6c856 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -348,10 +348,12 @@ class AccountMoveLine(models.Model):
     product_id = fields.Many2one('product.product', string='Product')
     debit = fields.Monetary(default=0.0, currency_field='company_currency_id')
     credit = fields.Monetary(default=0.0, currency_field='company_currency_id')
-    balance = fields.Monetary(compute='_store_balance', store=True, currency_field='company_currency_id', default=0.0, help="Technical field holding the debit - credit in order to open meaningful graph views from reports")
-    debit_cash_basis = fields.Monetary(currency_field='company_currency_id', default=0.0, compute='_compute_cash_basis', store=True)
-    credit_cash_basis = fields.Monetary(currency_field='company_currency_id', default=0.0, compute='_compute_cash_basis', store=True)
-    balance_cash_basis = fields.Monetary(compute='_compute_cash_basis', store=True, currency_field='company_currency_id', default=0.0, help="Technical field holding the debit_cash_basis - credit_cash_basis in order to open meaningful graph views from reports")
+    balance = fields.Monetary(compute='_store_balance', store=True, currency_field='company_currency_id',
+        help="Technical field holding the debit - credit in order to open meaningful graph views from reports")
+    debit_cash_basis = fields.Monetary(currency_field='company_currency_id', compute='_compute_cash_basis', store=True)
+    credit_cash_basis = fields.Monetary(currency_field='company_currency_id', compute='_compute_cash_basis', store=True)
+    balance_cash_basis = fields.Monetary(compute='_compute_cash_basis', store=True, currency_field='company_currency_id',
+        help="Technical field holding the debit_cash_basis - credit_cash_basis in order to open meaningful graph views from reports")
     amount_currency = fields.Monetary(default=0.0, help="The amount expressed in an optional other currency if it is a multi-currency entry.")
     company_currency_id = fields.Many2one('res.currency', related='company_id.currency_id', string="Company Currency", readonly=True,
         help='Utility field to express amount currency', store=True)
diff --git a/addons/hr_attendance/models/hr_employee.py b/addons/hr_attendance/models/hr_employee.py
index 2a5a66d838fc..88b5db50ee87 100644
--- a/addons/hr_attendance/models/hr_employee.py
+++ b/addons/hr_attendance/models/hr_employee.py
@@ -27,7 +27,7 @@ class HrEmployee(models.Model):
     last_attendance_id = fields.Many2one('hr.attendance', compute='_compute_last_attendance_id')
     attendance_state = fields.Selection(string="Attendance", compute='_compute_attendance_state', selection=[('checked_out', "Checked out"), ('checked_in', "Checked in")])
     manual_attendance = fields.Boolean(string='Manual Attendance', compute='_compute_manual_attendance', inverse='_inverse_manual_attendance',
-                                       help='The employee will have access to the "My Attendances" menu to perform his check in and out from his session', default=False)
+                                       help='The employee will have access to the "My Attendances" menu to perform his check in and out from his session')
 
     _sql_constraints = [('barcode_uniq', 'unique (barcode)', "The Badge ID must be unique, this one is already assigned to another employee.")]
 
diff --git a/addons/hr_timesheet/project_timesheet.py b/addons/hr_timesheet/project_timesheet.py
index b3b50b32d513..f82ca0cb1f3e 100644
--- a/addons/hr_timesheet/project_timesheet.py
+++ b/addons/hr_timesheet/project_timesheet.py
@@ -48,7 +48,7 @@ class Task(models.Model):
     effective_hours = fields.Float(compute='_hours_get', store=True, string='Hours Spent', help="Computed using the sum of the task work done.")
     total_hours = fields.Float(compute='_hours_get', store=True, string='Total', help="Computed as: Time Spent + Remaining Time.")
     total_hours_spent = fields.Float(compute='_hours_get', store=True, string='Total Hours', help="Computed as: Time Spent + Sub-tasks Hours.")
-    progress = fields.Float(compute='_hours_get', store=True, string='Working Time Recorded', group_operator="avg", default=0.0)
+    progress = fields.Float(compute='_hours_get', store=True, string='Working Time Recorded', group_operator="avg")
     delay_hours = fields.Float(compute='_hours_get', store=True, string='Delay Hours', help="Computed as difference between planned hours by the project manager and the total hours of the task.")
     children_hours = fields.Float(compute='_hours_get', store=True, string='Sub-tasks Hours', help="Sum of the planned hours of all sub-tasks (when a sub-task is closed or its spent hours exceed its planned hours, spent hours are counted instead)")
     timesheet_ids = fields.One2many('account.analytic.line', 'task_id', 'Timesheets')
diff --git a/addons/lunch/models/lunch.py b/addons/lunch/models/lunch.py
index 7cc750fb349a..87524b3872d1 100644
--- a/addons/lunch/models/lunch.py
+++ b/addons/lunch/models/lunch.py
@@ -39,7 +39,7 @@ class LunchOrder(models.Model):
     state = fields.Selection([('new', 'New'),
                               ('confirmed', 'Received'),
                               ('cancelled', 'Cancelled')],
-                             'Status', readonly=True, index=True, copy=False, default='new',
+                             'Status', readonly=True, index=True, copy=False,
                              compute='_compute_order_state', store=True)
     alerts = fields.Text(compute='_compute_alerts_get', string="Alerts")
     previous_order_ids = fields.Many2many('lunch.order.line', compute='_compute_previous_order_ids',
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py
index a26b64eae665..b9da002bff1e 100644
--- a/addons/sale/models/sale.py
+++ b/addons/sale/models/sale.py
@@ -134,7 +134,7 @@ class SaleOrder(models.Model):
         ('invoiced', 'Fully Invoiced'),
         ('to invoice', 'To Invoice'),
         ('no', 'Nothing to Invoice')
-        ], string='Invoice Status', compute='_get_invoiced', store=True, readonly=True, default='no')
+        ], string='Invoice Status', compute='_get_invoiced', store=True, readonly=True)
 
     note = fields.Text('Terms and conditions', default=_default_note)
 
@@ -741,10 +741,10 @@ class SaleOrderLine(models.Model):
     qty_delivered = fields.Float(string='Delivered', copy=False, digits=dp.get_precision('Product Unit of Measure'), default=0.0)
     qty_to_invoice = fields.Float(
         compute='_get_to_invoice_qty', string='To Invoice', store=True, readonly=True,
-        digits=dp.get_precision('Product Unit of Measure'), default=0.0)
+        digits=dp.get_precision('Product Unit of Measure'))
     qty_invoiced = fields.Float(
         compute='_get_invoice_qty', string='Invoiced', store=True, readonly=True,
-        digits=dp.get_precision('Product Unit of Measure'), default=0.0)
+        digits=dp.get_precision('Product Unit of Measure'))
 
     salesman_id = fields.Many2one(related='order_id.user_id', store=True, string='Salesperson', readonly=True)
     currency_id = fields.Many2one(related='order_id.currency_id', store=True, string='Currency', readonly=True)
-- 
GitLab