[FIX] moved product_consultant data into the module product, as the hr_timesheet module is not the only one using it (sale do as well)

lp bug: https://launchpad.net/bugs/877495 fixed

bzr revid: qdp-launchpad@openerp.com-20111018153152-s7op06lppfu2p0up
This commit is contained in:
Quentin (OpenERP) 2011-10-18 17:31:52 +02:00
parent 96837ce080
commit c829e12bd2
8 changed files with 36 additions and 33 deletions

View File

@ -46,7 +46,7 @@ class hr_employee(osv.osv):
def _getEmployeeProduct(self, cr, uid, context=None):
md = self.pool.get('ir.model.data')
try:
result = md.get_object_reference(cr, uid, 'hr_timesheet', 'product_consultant')
result = md.get_object_reference(cr, uid, 'product', 'product_consultant')
return result[1]
except ValueError:
pass

View File

@ -2,19 +2,8 @@
<openerp>
<data>
<record id="product_consultant" model="product.product">
<field name="list_price">75.0</field>
<field name="standard_price">30.0</field>
<field name="uom_id" ref="product.uom_hour"/>
<field name="uom_po_id" ref="product.uom_hour"/>
<field name="name">Service on Timesheet</field>
<field name="categ_id" ref="product.cat0"/>
<field name="type">service</field>
<field eval="False" name="purchase_ok"/>
</record>
<record id="hr.employee" model="hr.employee">
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
</record>
<record id="analytic_journal" model="account.analytic.journal">

View File

@ -3,13 +3,13 @@
<data noupdate="1">
<record id="hr.employee" model="hr.employee">
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="analytic_journal"/>
</record>
<!-- complete our example employee -->
<record id="hr.employee1" model="hr.employee">
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="analytic_journal"/>
</record>
@ -18,7 +18,7 @@
<field name="user_id" ref="base.user_root"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
<field eval="2.00" name="unit_amount"/>
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="product_uom_id" ref="product.uom_hour"/>
<field name="account_id" model="account.analytic.account" search="[('code','=','1')]"></field>
<field eval="-60.00" name="amount"/>
@ -31,7 +31,7 @@
<field name="user_id" ref="base.user_root"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
<field eval="1.00" name="unit_amount"/>
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="product_uom_id" ref="product.uom_hour"/>
<field name="account_id" model="account.analytic.account" search="[('code','=','1')]"></field>
<field eval="-30.00" name="amount"/>
@ -44,7 +44,7 @@
<field name="user_id" ref="base.user_root"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
<field eval="03.00" name="unit_amount"/>
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="product_uom_id" ref="product.uom_hour"/>
<field name="account_id" model="account.analytic.account" search="[('code','=','1')]"></field>
<field eval="-90.00" name="amount"/>
@ -57,7 +57,7 @@
<field name="user_id" ref="base.user_root"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
<field eval="01.00" name="unit_amount"/>
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="product_uom_id" ref="product.uom_hour"/>
<field name="account_id" model="account.analytic.account" search="[('code','=','1')]"></field>
<field eval="-30.00" name="amount"/>
@ -70,7 +70,7 @@
<field name="user_id" ref="base.user_root"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
<field eval="01.00" name="unit_amount"/>
<field name="product_id" ref="product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="product_uom_id" ref="product.uom_hour"/>
<field name="account_id" model="account.analytic.account" search="[('code','=','1')]"></field>
<field eval="-30.00" name="amount"/>

View File

@ -11,7 +11,7 @@
general_account_id: account.a_expense
journal_id: hr_timesheet.analytic_journal
name: develop yaml for hr module
product_id: hr_timesheet.product_consultant
product_id: product.product_consultant
product_uom_id: product.uom_hour
to_invoice: hr_timesheet_invoice.timesheet_invoice_factor2
unit_amount: 5.00
@ -31,7 +31,7 @@
date: 1
name: 1
price: 1
product: hr_timesheet.product_consultant
product: product.product_consultant
time: 1
-
@ -67,7 +67,7 @@
I create final invoice for this analytic account.
-
!record {model: hr.timesheet.invoice.create.final, id: hr_timesheet_invoice_create_final_0}:
balance_product: hr_timesheet.product_consultant
balance_product: product.product_consultant
date: 1
name: 1
price: 1

View File

@ -97,7 +97,7 @@
name: 'Develop yaml for hr module'
unit_amount: 3.00
amount: -90.00
product_id: hr_timesheet.product_consultant
product_id: product_consultant
general_account_id: account.a_expense
user_id: base.user_root
journal_id: hr_timesheet.analytic_journal
@ -128,7 +128,7 @@
name: 'Develop yaml for hr module'
unit_amount: 2.0
amount: -90.00
product_id: hr_timesheet.product_consultant
product_id: product_consultant
general_account_id: account.a_expense
user_id: base.user_root
journal_id: hr_timesheet.analytic_journal

View File

@ -168,5 +168,19 @@ parameter) will see those record just disappear.
<field name="name">Product UoS</field>
<field name="digits" eval="3"/>
</record>
<!--
Product
-->
<record id="product_consultant" model="product.product">
<field name="list_price">75.0</field>
<field name="standard_price">30.0</field>
<field name="uom_id" ref="product.uom_hour"/>
<field name="uom_po_id" ref="product.uom_hour"/>
<field name="name">Service on Timesheet</field>
<field name="categ_id" ref="product.cat0"/>
<field name="type">service</field>
<field eval="False" name="purchase_ok"/>
</record>
</data>
</openerp>

View File

@ -4,13 +4,13 @@
<!-- Example employee -->
<record id="hr.employee2" model="hr.employee">
<field name="user_id" ref="project.res_users_technical_leader"/>
<field name="product_id" ref="hr_timesheet.product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="hr_timesheet.analytic_journal"/>
</record>
<record id="hr.employee3" model="hr.employee">
<field name="user_id" ref="project.res_users_project_manager"/>
<field name="product_id" ref="hr_timesheet.product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="hr_timesheet.analytic_journal"/>
</record>
@ -19,7 +19,7 @@
<field name="calendar_id" ref="resource.timesheet_group1"/>
<field name="user_id" ref="project.res_users_analyst"/>
<field name="category_ids" eval="[(6, 0, [ref('hr.category_employee')])]"/>
<field name="product_id" ref="hr_timesheet.product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="hr_timesheet.analytic_journal"/>
</record>
@ -28,7 +28,7 @@
<field name="calendar_id" ref="resource.timesheet_group1"/>
<field name="user_id" ref="project.res_users_developer"/>
<field name="category_ids" eval="[(6, 0, [ref('hr.category_employee')])]"/>
<field name="product_id" ref="hr_timesheet.product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="hr_timesheet.analytic_journal"/>
</record>
<record id="hr.employee6" model="hr.employee">
@ -36,7 +36,7 @@
<field name="calendar_id" ref="resource.timesheet_group1"/>
<field name="user_id" ref="project.res_users_designer"/>
<field name="category_ids" eval="[(6, 0, [ref('hr.category_employee')])]"/>
<field name="product_id" ref="hr_timesheet.product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="hr_timesheet.analytic_journal"/>
</record>
<record id="hr.employee7" model="hr.employee">
@ -44,7 +44,7 @@
<field name="calendar_id" ref="resource.timesheet_group1"/>
<field name="user_id" ref="project.res_users_tester"/>
<field name="category_ids" eval="[(6, 0, [ref('hr.category_employee')])]"/>
<field name="product_id" ref="hr_timesheet.product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="hr_timesheet.analytic_journal"/>
</record>
<record id="hr.employee8" model="hr.employee">
@ -52,7 +52,7 @@
<field name="calendar_id" ref="resource.timesheet_group1"/>
<field name="user_id" ref="project.res_users_finacial_manager"/>
<field name="category_ids" eval="[(6, 0, [ref('hr.category_employee')])]"/>
<field name="product_id" ref="hr_timesheet.product_consultant"/>
<field name="product_id" ref="product.product_consultant"/>
<field name="journal_id" ref="hr_timesheet.analytic_journal"/>
</record>

View File

@ -1312,7 +1312,7 @@ class sale_config_picking_policy(osv.osv_memory):
pooler.restart_pool(cr.dbname, update_module=True)[1]
if wizard.time_unit:
prod_id = data_obj.get_object(cr, uid, 'hr_timesheet', 'product_consultant').id
prod_id = data_obj.get_object(cr, uid, 'product', 'product_consultant').id
product_obj = self.pool.get('product.product')
product_obj.write(cr, uid, prod_id, {'uom_id':wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})