[MERGE] merge with main branch

bzr revid: mra@mra-laptop-20100710091818-5xyvdcu926fis2qz
This commit is contained in:
Mustufa Rangwala
2010-07-10 14:48:18 +05:30
4 changed files with 122 additions and 9 deletions
+5 -2
View File
@@ -454,7 +454,7 @@ and users by email"),
contact_id = self.pool.get('res.partner.contact').browse(cr, uid, contact)
data['badge_name'] = contact_id.name
data['badge_title'] = contact_id.title
data['badge_title'] = contact_id.title.name
if partner:
partner_addresses = self.pool.get('res.partner.address').search(cr, uid, [('partner_id', '=', partner)])
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('contact_id', '=', contact), ('address_id', 'in', partner_addresses)])
@@ -471,7 +471,9 @@ and users by email"),
data_event = self.pool.get('event.event').browse(cr, uid, event_id)
context['currency_id'] = data_event.currency_id.id
if data_event.user_id.id:
return {'value': {'user_id':data_event.user_id.id}}
if data_event.product_id:
if not partner_invoice_id:
unit_price=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
@@ -516,6 +518,7 @@ and users by email"),
data_event = self.pool.get('event.event').browse(cr, uid, event_id)
if data_event.product_id:
data['event_product']=data_event.product_id.name
if not partner_invoice_id:
data['unit_price']=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
return {'value': data}
@@ -3,10 +3,9 @@
-
!record {model: project.project, id: project_project_retroplanning0}:
company_id: base.main_company
date: '2010-06-10'
date: !eval time.strftime('%Y-%m-%d')
name: Retro Planning
-
Create task 'Plan all projects'
-
@@ -19,12 +18,11 @@
project_id: project_project_retroplanning0
remaining_hours: 24.0
state: draft
-
Check if task deadline_date and start_date changes upon changing its project's end_date
-
!python {model: project.project}: |
from datetime import datetime, date
from datetime import datetime, date, timedelta
import time
data_project = self.browse(cr,uid,[ref("project_project_retroplanning0")])
prj = data_project[0]
@@ -32,17 +30,19 @@
if prj.date:
old_end_date = date(*time.strptime(prj.date,'%Y-%m-%d')[:3])
if old_end_date:
new_end_date = date(*time.strptime('2010-06-10','%Y-%m-%d')[:3])
new_end_date = date.today()+timedelta(1)
res={}
for task in prj.tasks:
start_dt = (datetime(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:6])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S')
deadline_dt=''
if task.date_deadline:
deadline_dt = (datetime(*time.strptime(task.date_deadline,'%Y-%m-%d')[:6])+(new_end_date-old_end_date)).strftime('%Y-%m-%d')
deadline_dt = (datetime(*time.strptime(task.date_deadline,'%Y-%m-%d')[:6])+(new_end_date-old_end_date)).strftime('%Y-%m-%d')
res[task.id]=[start_dt,deadline_dt]
self.write(cr, uid, [ref("project_project_retroplanning0")], {'date':'2010-06-10'})
self.write(cr, uid, [ref("project_project_retroplanning0")], {'date' : (datetime.datetime.now()+datetime.timedelta(1)).strftime('%Y-%m-%d')
})
data_project = self.browse(cr,uid,[ref("project_project_retroplanning0")])
prj = data_project[0]
for task in prj.tasks:
assert task.date_start == res[task.id][0], "task start date differs, expected %s, got %s"%(res[task.id][0], task.date_start)
assert task.date_deadline == res[task.id][1], "task deadline date differs, expected %s, got %s"%(res[task.id][1], task.date_deadline)
+1
View File
@@ -103,6 +103,7 @@
<record id="trans_confirmed_router" model="workflow.transition">
<field name="act_from" ref="act_confirmed"/>
<field name="act_to" ref="act_router"/>
<field name="signal">purchase_approve</field>
</record>
<record id="trans_router_picking" model="workflow.transition">
<field name="act_from" ref="act_router"/>
+109
View File
@@ -0,0 +1,109 @@
-
In order to test the procurement with product type buy in OpenERP, I will create product
and then I will create procurement for this product.
-
I create product.
-
!record {model: product.product, id: product_product_cddrive0}:
categ_id: product.product_category_3
cost_method: standard
mes_type: fixed
name: CD drive
procure_method: make_to_order
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
valuation: manual_periodic
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 5.0
-
I create procurement order.
-
!record {model: procurement.order, id: procurement_order_testcase0}:
company_id: base.main_company
date_planned: '2010-07-07 15:38:53'
location_id: stock.stock_location_stock
name: Test Case
priority: '1'
procure_method: make_to_order
product_id: product_product_cddrive0
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos: product.product_uom_unit
product_uos_qty: 0.0
state: draft
-
I confirm on procurement order.
-
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_testcase0}
-
I run the scheduler.
-
!workflow {model: procurement.order, action: button_check, ref: procurement_order_testcase0}
-
I check that purchase order is generated.
-
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
assert(proc_ids.purchase_id), _('Purchase Order is not Created!')
-
I check the state is running.
-
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
assert(proc_ids.state == 'running'), _('Exception')
-
I confirm and Approve the purchase order.
-
!python {model: purchase.order}: |
procurement_obj = self.pool.get('procurement.order')
proc_ids = procurement_obj.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
import netsvc
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.order',proc_ids.purchase_id.id,'purchase_confirm', cr)
wf_service.trg_validate(uid, 'purchase.order',proc_ids.purchase_id.id,'purchase_approve', cr)
-
I receive the order of the supplier ASUStek from the Incoming Shipments menu.
-
!python {model: stock.picking }: |
import time
procurement_obj = self.pool.get('procurement.order')
proc_ids = procurement_obj.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
picking_id = self.search(cr, uid, [('origin', '=', proc_ids.purchase_id.name)])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d')
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I confirm the Reservation.
-
!python {model: stock.move }: |
procurement_obj = self.pool.get('procurement.order')
proc_ids = procurement_obj.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
self.action_done(cr,uid,[proc_ids.move_id.id])
-
I check the state is Done.
-
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
assert(proc_ids.state == 'done'), _('Order is not in done state')