diff --git a/addons/account/models/account_analytic_line.py b/addons/account/models/account_analytic_line.py
index 5b8faf5a428..c340ad0b532 100644
--- a/addons/account/models/account_analytic_line.py
+++ b/addons/account/models/account_analytic_line.py
@@ -11,7 +11,8 @@ class AccountAnalyticLine(models.Model):
product_uom_id = fields.Many2one('product.uom', string='Unit of Measure')
product_id = fields.Many2one('product.product', string='Product')
- general_account_id = fields.Many2one('account.account', string='Financial Account', required=True, ondelete='restrict', domain=[('deprecated', '=', False)])
+ general_account_id = fields.Many2one('account.account', string='Financial Account', ondelete='restrict',
+ related='move_id.account_id', store=True, domain=[('deprecated', '=', False)])
move_id = fields.Many2one('account.move.line', string='Move Line', ondelete='cascade', index=True)
journal_id = fields.Many2one('account.analytic.journal', string='Analytic Journal', required=True, ondelete='restrict', index=True)
code = fields.Char(size=8)
@@ -30,7 +31,7 @@ class AccountAnalyticLine(models.Model):
if not journal_id:
j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type', '=', 'purchase')])
journal_id = j_ids and j_ids[0] or False
- if not journal_id or not prod_id:
+ if not journal_id:
return {}
product_obj = self.pool.get('product.product')
analytic_journal_obj = self.pool.get('account.analytic.journal')
@@ -52,18 +53,10 @@ class AccountAnalyticLine(models.Model):
a = prod.property_account_expense_id.id
if not a:
a = prod.categ_id.property_account_expense_categ_id.id
- if not a:
- raise UserError(_('There is no expense account defined ' \
- 'for this product: "%s" (id:%d).') % \
- (prod.name, prod.id,))
else:
a = prod.property_account_income_id.id
if not a:
a = prod.categ_id.property_account_income_categ_id.id
- if not a:
- raise UserError(_('There is no income account defined ' \
- 'for this product: "%s" (id:%d).') % \
- (prod.name, prod_id,))
flag = False
# Compute based on pricetype
@@ -83,7 +76,12 @@ class AccountAnalyticLine(models.Model):
# price_get() will respect a 'uom' in its context, in order
# to return a default price for those units
ctx['uom'] = unit
- amount_unit = prod.price_get(pricetype.field, context=ctx)[prod.id]
+ amount_unit = prod.price_get(pricetype.field, context=ctx)
+ if amount_unit:
+ amount_unit = amount_unit[prod.id]
+ else:
+ amount_unit = 0.0
+
amount = amount_unit * quantity or 0.0
cur_record = self.browse(cr, uid, id, context=context)
currency = cur_record.exists() and cur_record.currency_id or prod.company_id.currency_id
diff --git a/addons/delivery/test/delivery_cost.yml b/addons/delivery/test/delivery_cost.yml
index 2022b844759..50177e59cf7 100644
--- a/addons/delivery/test/delivery_cost.yml
+++ b/addons/delivery/test/delivery_cost.yml
@@ -2,7 +2,7 @@
In order to test Carrier Cost,
-
Create sale order with Normal Delivery Charges
--
+-
!record {model: sale.order, id: sale_normal_delivery_charges}:
partner_id: base.res_partner_18
partner_invoice_id: base.res_partner_18
@@ -48,7 +48,7 @@
self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]})
-
Create one more sale order with Free Delivery Charges
--
+-
!record {model: sale.order, id: sale_free_delivery_charges}:
partner_id: base.res_partner_7
partner_invoice_id: base.res_partner_address_13
@@ -57,7 +57,7 @@
order_policy: 'manual'
order_line:
- name: 'Service on demand'
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
product_uom_qty: 24
product_uos_qty: 24
product_uom: product.product_uom_hour
diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py
index 62f0bec6009..3ba4eead94e 100644
--- a/addons/hr_timesheet/__openerp__.py
+++ b/addons/hr_timesheet/__openerp__.py
@@ -37,7 +37,6 @@ up a management by affair.
],
'test': [
'../account/test/account_minimal_test.xml',
- 'test/hr_timesheet_data.xml',
'test/hr_timesheet_users.yml',
],
'installable': True,
diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py
index a71dbd8b95b..d6687976657 100644
--- a/addons/hr_timesheet/hr_timesheet.py
+++ b/addons/hr_timesheet/hr_timesheet.py
@@ -14,12 +14,7 @@ class HrEmployee(models.Model):
# We need the "or ..." because we need an empty recordset of the right type, 'False' is not enough.
return self.env.ref('hr_timesheet.analytic_journal', raise_if_not_found=False) or self.env['account.analytic.journal']
- @api.model
- def _get_default_employee_product(self):
- # We need the "or ..." because we need an empty recordset of the right type, 'False' is not enough.
- return self.env.ref('product.product_product_consultant', raise_if_not_found=False) or self.env['product.product']
-
- product_id = fields.Many2one('product.product', 'Product', help="If you want to reinvoice working time of employees, link this employee to a service to determinate the cost price of the job.", default=_get_default_employee_product)
+ product_id = fields.Many2one('product.product', 'Product', help="If you want to reinvoice working time of employees, link this employee to a service to determinate the cost price of the job.")
journal_id = fields.Many2one('account.analytic.journal', 'Analytic Journal', default=_get_default_analytic_journal)
uom_id = fields.Many2one('product.uom', related='product_id.uom_id', string='Unit of Measure', store=True, readonly=True)
@@ -48,7 +43,7 @@ class account_analytic_line(models.Model):
if emp and emp.product_id.id:
return emp.product_id.id
else:
- raise exceptions.ValidationError("This user or employee is not associated to a valid Product")
+ return None
@api.model
def _get_employee_unit(self, user_id=None):
@@ -56,7 +51,7 @@ class account_analytic_line(models.Model):
if emp and emp.product_id.uom_id.id:
return emp.product_id.uom_id.id
else:
- raise exceptions.ValidationError("This user or employee is not associated to a Product with a valid Amount Type")
+ return None
@api.model
def _get_general_account(self, user_id=None):
@@ -64,7 +59,7 @@ class account_analytic_line(models.Model):
if emp and emp.product_id.categ_id.property_account_expense_categ_id.id:
return emp.product_id.categ_id.property_account_expense_categ_id.id
else:
- raise exceptions.ValidationError("This user or employee is not associated to a Product with a valid Financial Account")
+ return None
@api.model
def _get_analytic_journal(self, user_id=None):
@@ -72,24 +67,12 @@ class account_analytic_line(models.Model):
if emp and emp.journal_id.id:
return emp.journal_id.id
else:
- raise exceptions.ValidationError("This user or employee is not associated to a valid Journal ID")
+ journal = self.env['account.analytic.journal'].search([('type', '=', 'general')], limit=1)
- @api.one
- @api.constrains('user_id')
- def check_user_id(self):
- if self.is_timesheet:
- emp = self.env['hr.employee'].search([('user_id', '=', self.user_id.id)], limit=1)
- if not emp:
- raise exceptions.ValidationError("There is no employee defined for user " + self.user_id.name)
+ if journal:
+ return journal.id
else:
- if not emp.journal_id.id:
- raise exceptions.ValidationError("The employee " + emp.name + " is not associated to a valid Analytic Journal. Please define one for him or select another user.")
- elif not emp.product_id:
- raise exceptions.ValidationError("The employee " + emp.name + " is not associated to a valid Product. Please define one for him or select another user.")
- elif not emp.product_id.uom_id.id:
- raise exceptions.ValidationError("The employee " + emp.name + " is not associated to a valid Product Unit of Measure. Please define one for him or select another user.")
- elif not emp.product_id.categ_id.property_account_expense_categ_id.id:
- raise exceptions.ValidationError("The employee " + emp.name + " is not associated to a valid Financial Account. Please define one for him or select another user.")
+ return None
@api.onchange('user_id')
def V8_on_change_user_id(self):
@@ -112,7 +95,7 @@ class account_analytic_line(models.Model):
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit=False, journal_id=False, context=None):
res = {'value': {}}
- if prod_id and unit_amount:
+ if unit_amount:
# find company
company_id = self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context)
r = super(account_analytic_line, self).on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, journal_id, context=context)
diff --git a/addons/hr_timesheet/hr_timesheet_data.xml b/addons/hr_timesheet/hr_timesheet_data.xml
index 4fb03a7211e..35d6bfb0185 100644
--- a/addons/hr_timesheet/hr_timesheet_data.xml
+++ b/addons/hr_timesheet/hr_timesheet_data.xml
@@ -9,18 +9,5 @@
-
-
- True
- 75.0
- 30.0
-
-
- Service
-
- service
-
-
-
diff --git a/addons/hr_timesheet/hr_timesheet_demo.xml b/addons/hr_timesheet/hr_timesheet_demo.xml
index b512038e8da..faec6e306ca 100644
--- a/addons/hr_timesheet/hr_timesheet_demo.xml
+++ b/addons/hr_timesheet/hr_timesheet_demo.xml
@@ -1,15 +1,12 @@
-
-
-
-
+
-
+
@@ -25,10 +22,5 @@
True
-
-
-
-
-
diff --git a/addons/hr_timesheet/hr_timesheet_demo.yml b/addons/hr_timesheet/hr_timesheet_demo.yml
index 011a302c135..530df19cf9e 100644
--- a/addons/hr_timesheet/hr_timesheet_demo.yml
+++ b/addons/hr_timesheet/hr_timesheet_demo.yml
@@ -10,7 +10,7 @@
'user_id': ref('base.user_root'),
'date': time.strftime('%Y-%m-%d'),
'unit_amount': 2.00,
- 'product_id': ref('product.product_product_consultant'),
+ 'product_id': ref('product.product_product_1'),
'product_uom_id': ref('product.product_uom_hour'),
'account_id': ref('analytic.analytic_administratif'),
'amount': -60.00,
@@ -23,7 +23,7 @@
'user_id': ref('base.user_root'),
'date': time.strftime('%Y-%m-%d'),
'unit_amount': 1.00,
- 'product_id': ref('product.product_product_consultant'),
+ 'product_id': ref('product.product_product_1'),
'product_uom_id': ref('product.product_uom_hour'),
'account_id': ref('analytic.analytic_administratif'),
'amount': -30.00,
@@ -36,7 +36,7 @@
'user_id': ref('base.user_root'),
'date': time.strftime('%Y-%m-%d'),
'unit_amount': 3.00,
- 'product_id': ref('product.product_product_consultant'),
+ 'product_id': ref('product.product_product_1'),
'product_uom_id': ref('product.product_uom_hour'),
'account_id': ref('analytic.analytic_administratif'),
'amount': -90.00,
@@ -49,7 +49,7 @@
'user_id': ref('base.user_root'),
'date': time.strftime('%Y-%m-%d'),
'unit_amount': 1.00,
- 'product_id': ref('product.product_product_consultant'),
+ 'product_id': ref('product.product_product_1'),
'product_uom_id': ref('product.product_uom_hour'),
'account_id': ref('analytic.analytic_administratif'),
'amount': -30.00,
@@ -62,7 +62,7 @@
'user_id': ref('base.user_root'),
'date': time.strftime('%Y-%m-%d'),
'unit_amount': 1.00,
- 'product_id': ref('product.product_product_consultant'),
+ 'product_id': ref('product.product_product_1'),
'product_uom_id': ref('product.product_uom_hour'),
'account_id': ref('analytic.analytic_administratif'),
'amount': -30.00,
diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml
index 1fa91bc1828..cd3a3f0b91b 100644
--- a/addons/hr_timesheet/hr_timesheet_view.xml
+++ b/addons/hr_timesheet/hr_timesheet_view.xml
@@ -6,7 +6,7 @@
account.analytic.line.treeaccount.analytic.line
-
+
@@ -17,7 +17,7 @@
-
+
@@ -43,7 +43,7 @@
-
+
-
+
Timesheet Accountsir.actions.act_window
@@ -137,7 +137,7 @@
-
+
Activitiesaccount.analytic.line
diff --git a/addons/hr_timesheet/test/hr_timesheet_data.xml b/addons/hr_timesheet/test/hr_timesheet_data.xml
deleted file mode 100644
index c9ad0322dc0..00000000000
--- a/addons/hr_timesheet/test/hr_timesheet_data.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
- True
- 75.0
- 30.0
-
-
- Service - Test
-
- service
-
-
-
-
-
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
index 51aa1e75408..058137f5b71 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
@@ -270,6 +270,9 @@ class account_analytic_line(osv.osv):
if not analytic_line.to_invoice:
raise UserError(_('Trying to invoice non invoiceable line for %s.') % (analytic_line.product_id.name))
+ if not analytic_line.product_id and not data['product']:
+ raise UserError(_('No product associated with %s, force a product.') % (analytic_line.name))
+
key = (analytic_line.product_id.id,
analytic_line.product_uom_id.id,
analytic_line.user_id.id,
diff --git a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml
index 009a5b1cd12..a63478db8df 100644
--- a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml
+++ b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml
@@ -9,7 +9,7 @@
general_account_id: a_expense
journal_id: hr_timesheet.analytic_journal
name: develop yaml for hr module
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
product_uom_id: product.product_uom_hour
to_invoice: hr_timesheet_invoice.timesheet_invoice_factor2
unit_amount: 5.00
@@ -49,13 +49,13 @@
code: "I000"
user_type_id: "account.data_account_type_revenue"
tax_ids: [tax10]
--
- I set the account as property_account_income_id on the product and I set the tax on the product
--
- !record {model: product.product, id: product.product_product_consultant, view: False}:
+-
+ I set the account as property_account_income_id on the product and I set the tax on the product
+-
+ !record {model: product.product, id: product.product_product_1, view: False}:
property_account_income_id: account_income_i000
uom_id: product.product_uom_hour
- taxes_id: [tax10]
+ taxes_id: [tax10]
list_price: 75
-
I create invoice on analytic Line using "Invoice analytic Line" wizard.
@@ -64,7 +64,7 @@
date: 1
name: 1
price: 1
- product: product.product_product_consultant
+ product: product.product_product_1
time: 1
-
I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice.
@@ -129,7 +129,7 @@
general_account_id: a_expense
journal_id: hr_timesheet.analytic_journal
name: sales module extension
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
product_uom_id: product.product_uom_hour
to_invoice: hr_timesheet_invoice.timesheet_invoice_factor2
unit_amount: 5.00
@@ -142,7 +142,7 @@
general_account_id: a_expense
journal_id: hr_timesheet.analytic_journal
name: template design
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
product_uom_id: product.product_uom_hour
to_invoice: hr_timesheet_invoice.timesheet_invoice_factor2
unit_amount: 5.00
@@ -152,7 +152,7 @@
!record {model: hr.timesheet.invoice.create, id: hr_timesheet_invoice_create_1}:
date: 1
name: 1
- product: product.product_product_consultant
+ product: product.product_product_1
time: 1
group_by_partner: 1
-
diff --git a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice_no_prod_tax.yml b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice_no_prod_tax.yml
index 23dc1fa75c3..40363ba1d14 100644
--- a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice_no_prod_tax.yml
+++ b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice_no_prod_tax.yml
@@ -9,7 +9,7 @@
general_account_id: a_expense
journal_id: hr_timesheet.analytic_journal
name: develop yaml for hr module
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
product_uom_id: product.product_uom_hour
to_invoice: hr_timesheet_invoice.timesheet_invoice_factor2
unit_amount: 5.00
@@ -51,7 +51,7 @@
-
I set the account as property_account_income_id on the product and I set no tax on the product (so default tax from the account will be used)
-
- !record {model: product.product, id: product.product_product_consultant, view: False}:
+ !record {model: product.product, id: product.product_product_1, view: False}:
property_account_income_id: account_income_i000
uom_id: product.product_uom_hour
taxes_id: []
@@ -63,7 +63,7 @@
date: 1
name: 1
price: 1
- product: product.product_product_consultant
+ product: product.product_product_1
time: 1
-
I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice.
@@ -91,7 +91,7 @@
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner),
('origin', '=', 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0")) + '_aaldyfhrm1_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1") ))
])
-
+
invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0]
for invoice in invoice_id.invoice_line_ids:
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
index 6cd0c3ba796..139ba39cb45 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
@@ -15,7 +15,7 @@ class hr_timesheet_invoice_create(osv.osv_memory):
'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'),
'name': fields.boolean('Description', help='The detail of each work done will be displayed on the invoice'),
'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'),
- 'product': fields.many2one('product.product', 'Force Product', help='Fill this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'),
+ 'product': fields.many2one('product.product', 'Force Product', help='Fill this field only if you want to force the use a specific product. Keep empty to use the real product that comes from the cost.'),
'group_by_partner': fields.boolean('Group by Partner', help='If this box is checked, the system will group invoices by customer.'),
}
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index fee198150cc..30c09356495 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -52,8 +52,6 @@ class hr_timesheet_sheet(osv.osv):
if 'employee_id' in vals:
if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id'], context=context).user_id:
raise UserError(_('In order to create a timesheet for this employee, you must link him/her to a user.'))
- if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id'], context=context).product_id:
- raise UserError(_('In order to create a timesheet for this employee, you must link the employee to a product, like \'Consultant\'.'))
if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id'], context=context).journal_id:
raise UserError(_('In order to create a timesheet for this employee, you must assign an analytic journal to the employee, like \'Timesheet Journal\'.'))
if vals.get('attendances_ids'):
@@ -97,7 +95,7 @@ class hr_timesheet_sheet(osv.osv):
date_attendances.append((1, name, att_tuple))
elif att_tuple[0] in [2,3]:
date_attendances.append((0, self.pool['hr.attendance'].browse(cr, uid, att_tuple[1]).name, att_tuple))
- else:
+ else:
date_attendances.append((0, False, att_tuple))
date_attendances.sort()
return [att[2] for att in date_attendances]
@@ -120,7 +118,7 @@ class hr_timesheet_sheet(osv.osv):
for sheet in self.browse(cr, uid, ids, context=context):
if sheet.employee_id.id not in employee_ids: employee_ids.append(sheet.employee_id.id)
return hr_employee.attendance_action_change(cr, uid, employee_ids, context=context)
-
+
def _count_attendances(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, 0)
attendances_groups = self.pool['hr.attendance'].read_group(cr, uid, [('sheet_id' , 'in' , ids)], ['sheet_id'], 'sheet_id', context=context)
diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
index 9363454df09..df9383af192 100644
--- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
+++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
@@ -45,7 +45,7 @@
user_id: base.user_demo
unit_amount: 6.00
amount: -90.00
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
general_account_id: a_expense
journal_id: hr_timesheet.analytic_journal
-
@@ -74,7 +74,7 @@
unit_amount: 2.00
user_id: base.user_demo
amount: -90.00
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
general_account_id: a_expense
journal_id: hr_timesheet.analytic_journal
-
diff --git a/addons/hr_timesheet_sheet/wizard/hr_timesheet_current.py b/addons/hr_timesheet_sheet/wizard/hr_timesheet_current.py
index 419d4901d9c..a0cec9fab48 100644
--- a/addons/hr_timesheet_sheet/wizard/hr_timesheet_current.py
+++ b/addons/hr_timesheet_sheet/wizard/hr_timesheet_current.py
@@ -16,9 +16,6 @@ class hr_timesheet_current_open(osv.osv_memory):
context = {}
view_type = 'form,tree'
- user_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)], context=context)
- if not len(user_ids):
- raise UserError(_('Please create an employee and associate it with this user.'))
ids = ts.search(cr, uid, [('user_id','=',uid),('state','in',('draft','new')),('date_from','<=',time.strftime('%Y-%m-%d')), ('date_to','>=',time.strftime('%Y-%m-%d'))], context=context)
if len(ids) > 1:
diff --git a/addons/project_timesheet/project_timesheet_demo.xml b/addons/project_timesheet/project_timesheet_demo.xml
index 33d30a94191..78aade68999 100644
--- a/addons/project_timesheet/project_timesheet_demo.xml
+++ b/addons/project_timesheet/project_timesheet_demo.xml
@@ -3,12 +3,11 @@
-
+
-
@@ -16,7 +15,6 @@
Lisa Jongejans
- Building 1, Second Floor+3282623500
@@ -27,21 +25,19 @@
Martin Lawrence
-
+ Jimmy Kosikin
- Alice Englert
- Building 1, Second Floor+3282823500
@@ -52,7 +48,6 @@
-
diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml
index 564d6934a33..44c77756cbb 100644
--- a/addons/project_timesheet/project_timesheet_view.xml
+++ b/addons/project_timesheet/project_timesheet_view.xml
@@ -114,7 +114,7 @@
-
+
@@ -168,7 +168,7 @@
-
+
diff --git a/addons/sale_contract/models/res_config.py b/addons/sale_contract/models/res_config.py
index 30f75853a74..2de8c3ea7d5 100644
--- a/addons/sale_contract/models/res_config.py
+++ b/addons/sale_contract/models/res_config.py
@@ -21,10 +21,6 @@ class sale_configuration(osv.osv_memory):
if res.get('module_project'):
user = self.pool.get('res.users').browse(cr, uid, uid, context)
res['time_unit'] = user.company_id.project_time_mode_id.id
- else:
- product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
- if product and product.exists():
- res['time_unit'] = product.uom_id.id
res['timesheet'] = res.get('module_sale_contract')
return res
@@ -32,14 +28,6 @@ class sale_configuration(osv.osv_memory):
ir_model_data = self.pool.get('ir.model.data')
wizard = self.browse(cr, uid, ids)[0]
- if wizard.time_unit:
- product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
- if product and product.exists():
- product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
- else:
- _logger.info("Product with xml_id 'product.product_product_consultant' not found, UoMs not updated!")
- raise UserError(_("Product with xml_id 'product.product_product_consultant' not found, UoMs not updated!"))
-
if wizard.module_project and wizard.time_unit:
user = self.pool.get('res.users').browse(cr, uid, uid, context)
user.company_id.write({'project_time_mode_id': wizard.time_unit.id})
diff --git a/addons/sale_contract/test/account_analytic_analysis.yml b/addons/sale_contract/test/account_analytic_analysis.yml
index 00476a6f003..69950269fb8 100644
--- a/addons/sale_contract/test/account_analytic_analysis.yml
+++ b/addons/sale_contract/test/account_analytic_analysis.yml
@@ -1,5 +1,5 @@
-
- In order to test Contract Recurrent Invoice I create a new Contract Template
+ In order to test Contract Recurrent Invoice I create a new Contract Template
-
!record {model: account.analytic.account, id: contract_template}:
name: Maintenance of Servers
@@ -10,9 +10,9 @@
recurring_interval : 1
recurring_invoice_line_ids:
- quantity: 2.0
- price_unit: 75.0
+ price_unit: 30.75
name: Database Administration
- product_id: product.product_product_consultant
+ product_id: product.product_product_1
uom_id: product.product_uom_hour
-
I create a contract based on this template
@@ -43,4 +43,4 @@
ids = self.search(cr, uid, [('invoice_line.analytic_account_id','=',aid)], context=context)
assert len(ids)>=1, 'No invoice created for the contract'
for invoice in self.browse(cr, uid, ids,context=context):
- assert float_compare(invoice.amount_untaxed, 150.0, precision_digits=2) == 0, "The invoice total is different than 150!"
+ assert float_compare(invoice.amount_untaxed, 61.5, precision_digits=2) == 0, "The invoice total is different than 61.5!"
diff --git a/addons/sale_contract/views/res_config_view.xml b/addons/sale_contract/views/res_config_view.xml
index 9f9b778d308..e65f22aa4e5 100644
--- a/addons/sale_contract/views/res_config_view.xml
+++ b/addons/sale_contract/views/res_config_view.xml
@@ -13,18 +13,8 @@