Re-use employee instance and append new Party instance
Get the employee from the user after having set it as current user return None because the context of the instance still has the context of the admin user (with employee=None) but applies to the user. This is because set_user change globally the user and context of the config. Appending instance to a many2many require an instance with the same context. issue7144 review44251003
This commit is contained in:
1 parent
9e0d6b4fd6
commit
5d93d00bb6
1 file changed
+2
-2
@@ -94,7 +94,7 @@ Create purchase requisition::
|
||||
>>> PurchaseRequisition = Model.get('purchase.requisition')
|
||||
>>> requisition = PurchaseRequisition()
|
||||
>>> requisition.description = 'Description'
|
||||
>>> requisition.employee = purchase_user.employee
|
||||
>>> requisition.employee = employee
|
||||
>>> requisition.supply_date = today
|
||||
>>> requisition_line = requisition.lines.new()
|
||||
>>> requisition_line.product = product
|
||||
@@ -119,7 +119,7 @@ add another supplier::
|
||||
... 'purchase.request.quotation.create', [purchase_request])
|
||||
>>> [supplier] == create_quotation.form.suppliers
|
||||
True
|
||||
>>> create_quotation.form.suppliers.append(supplier2)
|
||||
>>> create_quotation.form.suppliers.append(Party(supplier2.id))
|
||||
>>> create_quotation.execute('create_quotations')
|
||||
>>> create_quotation.execute('end')
|
||||
>>> purchase_request.state
|
||||
|
||||
Reference in new issue
Block a user