Test expected output instead of comparison in doctest
This commit is contained in:
@@ -85,8 +85,8 @@ Reconcile Lines without writeoff::
|
||||
|
||||
>>> reconcile_lines = Wizard('account.move.reconcile_lines',
|
||||
... [reconcile1, reconcile2])
|
||||
>>> reconcile_lines.state == 'end'
|
||||
True
|
||||
>>> reconcile_lines.state
|
||||
'end'
|
||||
>>> reconcile1.reload()
|
||||
>>> reconcile2.reload()
|
||||
>>> reconcile1.reconciliation == reconcile2.reconciliation != None
|
||||
@@ -98,8 +98,8 @@ Unreconcile lines::
|
||||
|
||||
>>> unreconcile_lines = Wizard(
|
||||
... 'account.move.unreconcile_lines', [reconcile1])
|
||||
>>> unreconcile_lines.state == 'end'
|
||||
True
|
||||
>>> unreconcile_lines.state
|
||||
'end'
|
||||
>>> reconcile1.reload()
|
||||
>>> reconcile1.reconciliation
|
||||
>>> reconcile2.reload()
|
||||
@@ -111,8 +111,8 @@ Reconcile general ledger lines::
|
||||
>>> gl_reconcile2 = GLLine(reconcile2.id)
|
||||
>>> reconcile_lines = Wizard('account.move.reconcile_lines',
|
||||
... [gl_reconcile1, gl_reconcile2])
|
||||
>>> reconcile_lines.state == 'end'
|
||||
True
|
||||
>>> reconcile_lines.state
|
||||
'end'
|
||||
>>> gl_reconcile1.reload()
|
||||
>>> gl_reconcile2.reload()
|
||||
>>> gl_reconcile1.reconciliation == gl_reconcile2.reconciliation != None
|
||||
@@ -122,8 +122,8 @@ Unreconcile general ledger, lines::
|
||||
|
||||
>>> unreconcile_lines = Wizard(
|
||||
... 'account.move.unreconcile_lines', [gl_reconcile1])
|
||||
>>> unreconcile_lines.state == 'end'
|
||||
True
|
||||
>>> unreconcile_lines.state
|
||||
'end'
|
||||
>>> gl_reconcile1.reload()
|
||||
>>> gl_reconcile1.reconciliation
|
||||
>>> gl_reconcile2.reload()
|
||||
@@ -178,8 +178,8 @@ Reconcile Lines with write-off::
|
||||
|
||||
>>> reconcile_lines = Wizard('account.move.reconcile_lines',
|
||||
... [reconcile1, reconcile2])
|
||||
>>> reconcile_lines.form_state == 'writeoff'
|
||||
True
|
||||
>>> reconcile_lines.form_state
|
||||
'writeoff'
|
||||
>>> reconcile_lines.form.writeoff = writeoff_method
|
||||
>>> reconcile_lines.execute('reconcile')
|
||||
>>> reconcile1.reload()
|
||||
|
||||
@@ -149,8 +149,8 @@ With reconciliation::
|
||||
>>> reconcile2, = [l for l in move.lines if l.account == receivable]
|
||||
>>> reconcile_lines = Wizard('account.move.reconcile_lines',
|
||||
... [reconcile1, reconcile2])
|
||||
>>> reconcile_lines.state == 'end'
|
||||
True
|
||||
>>> reconcile_lines.state
|
||||
'end'
|
||||
>>> reconcile_date = reconcile1.reconciliation.create_date
|
||||
|
||||
Balance non-deferral::
|
||||
|
||||
@@ -123,8 +123,8 @@ Receive remaining line::
|
||||
... ('reconciliation', '=', None),
|
||||
... ])
|
||||
>>> reconcile_lines = Wizard('account.move.reconcile_lines', lines)
|
||||
>>> reconcile_lines.state == 'end'
|
||||
True
|
||||
>>> reconcile_lines.state
|
||||
'end'
|
||||
|
||||
>>> invoice.reload()
|
||||
>>> invoice.state
|
||||
|
||||
@@ -93,8 +93,8 @@ Check Statement::
|
||||
>>> statement.number_of_lines
|
||||
1
|
||||
>>> origin, = statement.origins
|
||||
>>> origin.date == datetime.date(2018, 3, 19)
|
||||
True
|
||||
>>> origin.date
|
||||
datetime.date(2018, 3, 19)
|
||||
>>> origin.amount
|
||||
Decimal('-10.98')
|
||||
>>> origin.description
|
||||
|
||||
@@ -108,8 +108,8 @@ Reconcile lines::
|
||||
>>> Line = Model.get('account.move.line')
|
||||
>>> lines = Line.find([('account', '=', receivable.id)])
|
||||
>>> reconcile_lines = Wizard('account.move.reconcile_lines', lines)
|
||||
>>> reconcile_lines.state == 'end'
|
||||
True
|
||||
>>> reconcile_lines.state
|
||||
'end'
|
||||
|
||||
Can close the period::
|
||||
|
||||
|
||||
@@ -132,8 +132,8 @@ Pay 1 term of the invoice::
|
||||
>>> reconcile_lines = Wizard('account.move.reconcile_lines',
|
||||
... [payment_line, term1],
|
||||
... context={'payment_date': period.start_date})
|
||||
>>> reconcile_lines.state == 'end'
|
||||
True
|
||||
>>> reconcile_lines.state
|
||||
'end'
|
||||
|
||||
Check tax codes::
|
||||
|
||||
|
||||
@@ -55,15 +55,14 @@ Check attendance sheet::
|
||||
|
||||
>>> Sheet = Model.get('attendance.sheet')
|
||||
>>> sheet, = Sheet.find([])
|
||||
>>> sheet.duration == dt.timedelta(hours=8)
|
||||
True
|
||||
>>> sheet.duration
|
||||
datetime.timedelta(seconds=28800)
|
||||
>>> sheet.date
|
||||
datetime.date(2020, 4, 1)
|
||||
>>> len(sheet.lines)
|
||||
3
|
||||
>>> (sum([l.duration for l in sheet.lines], dt.timedelta()) ==
|
||||
... dt.timedelta(hours=8))
|
||||
True
|
||||
>>> sum([l.duration for l in sheet.lines], dt.timedelta())
|
||||
datetime.timedelta(seconds=28800)
|
||||
|
||||
Fill attendance over 1 day::
|
||||
|
||||
@@ -73,8 +72,8 @@ Fill attendance over 1 day::
|
||||
Check attendance sheet::
|
||||
|
||||
>>> sheet, = Sheet.find([('date', '=', dt.date(2020, 4, 2))])
|
||||
>>> sheet.duration == dt.timedelta(hours=10)
|
||||
True
|
||||
>>> sheet.duration
|
||||
datetime.timedelta(seconds=36000)
|
||||
|
||||
Add attendance for other employee::
|
||||
|
||||
@@ -84,5 +83,5 @@ Add attendance for other employee::
|
||||
Check attendance sheet::
|
||||
|
||||
>>> sheet, = Sheet.find([('employee', '=', employee2.id)])
|
||||
>>> sheet.duration == dt.timedelta(hours=6)
|
||||
True
|
||||
>>> sheet.duration
|
||||
datetime.timedelta(seconds=21600)
|
||||
|
||||
@@ -67,10 +67,10 @@ Check attendance time sheet::
|
||||
|
||||
>>> Sheet = Model.get('attendance.sheet')
|
||||
>>> sheet, = Sheet.find([('date', '=', dt.date(2020, 4, 1))])
|
||||
>>> sheet.duration == dt.timedelta(hours=8)
|
||||
True
|
||||
>>> sheet.timesheet_duration == dt.timedelta(hours=7)
|
||||
True
|
||||
>>> sheet.duration
|
||||
datetime.timedelta(seconds=28800)
|
||||
>>> sheet.timesheet_duration
|
||||
datetime.timedelta(seconds=25200)
|
||||
|
||||
>>> if backend.name != 'sqlite':
|
||||
... sheet, = Sheet.find([('date', '=', dt.date(2020, 4, 2))])
|
||||
|
||||
+2
-2
@@ -218,8 +218,8 @@ Sale products with cost on order::
|
||||
>>> cost_line = sale.lines[-1]
|
||||
>>> cost_line.product == carrier_product
|
||||
True
|
||||
>>> cost_line.quantity == 1
|
||||
True
|
||||
>>> cost_line.quantity
|
||||
1.0
|
||||
>>> cost_line.amount
|
||||
Decimal('9.00')
|
||||
>>> sale.click('confirm')
|
||||
|
||||
@@ -167,8 +167,8 @@ Sale products with cost on shipment::
|
||||
>>> cost_line = sale.lines[-1]
|
||||
>>> cost_line.product == carrier_product
|
||||
True
|
||||
>>> cost_line.quantity == 1
|
||||
True
|
||||
>>> cost_line.quantity
|
||||
1.0
|
||||
>>> cost_line.amount
|
||||
Decimal('40.00')
|
||||
>>> sale.click('confirm')
|
||||
@@ -235,8 +235,8 @@ Sale products with cost on order::
|
||||
>>> cost_line = sale.lines[-1]
|
||||
>>> cost_line.product == carrier_product
|
||||
True
|
||||
>>> cost_line.quantity == 1
|
||||
True
|
||||
>>> cost_line.quantity
|
||||
1.0
|
||||
>>> cost_line.amount
|
||||
Decimal('25.00')
|
||||
>>> sale.click('confirm')
|
||||
|
||||
@@ -131,11 +131,11 @@ Make a production::
|
||||
>>> production.quantity = 2
|
||||
>>> production.planned_start_date == yesterday
|
||||
True
|
||||
>>> sorted([i.quantity for i in production.inputs]) == [10, 300]
|
||||
True
|
||||
>>> sorted([i.quantity for i in production.inputs])
|
||||
[10.0, 300.0]
|
||||
>>> output, = production.outputs
|
||||
>>> output.quantity == 2
|
||||
True
|
||||
>>> output.quantity
|
||||
2.0
|
||||
>>> production.save()
|
||||
>>> production.cost
|
||||
Decimal('25.0000')
|
||||
@@ -152,24 +152,24 @@ Test reset bom button::
|
||||
... change=[
|
||||
... 'bom', 'product', 'unit', 'quantity',
|
||||
... 'inputs', 'outputs', 'company', 'warehouse', 'location'])
|
||||
>>> sorted([i.quantity for i in production.inputs]) == [10, 300]
|
||||
True
|
||||
>>> sorted([i.quantity for i in production.inputs])
|
||||
[10.0, 300.0]
|
||||
>>> output, = production.outputs
|
||||
>>> output.quantity == 2
|
||||
True
|
||||
>>> output.quantity
|
||||
2.0
|
||||
|
||||
Do the production::
|
||||
|
||||
>>> production.click('assign_try')
|
||||
>>> production.state
|
||||
'assigned'
|
||||
>>> all(i.state == 'assigned' for i in production.inputs)
|
||||
True
|
||||
>>> {i.state for i in production.inputs}
|
||||
{'assigned'}
|
||||
>>> production.click('run')
|
||||
>>> all(i.state == 'done' for i in production.inputs)
|
||||
True
|
||||
>>> len(set(i.effective_date == today for i in production.inputs))
|
||||
1
|
||||
>>> {i.state for i in production.inputs}
|
||||
{'done'}
|
||||
>>> {i.effective_date == today for i in production.inputs}
|
||||
{True}
|
||||
>>> production.click('done')
|
||||
>>> output, = production.outputs
|
||||
>>> output.state
|
||||
@@ -179,8 +179,8 @@ Do the production::
|
||||
>>> output.unit_price
|
||||
Decimal('12.5000')
|
||||
>>> with config.set_context(locations=[storage.id]):
|
||||
... Product(product.id).quantity == 2
|
||||
True
|
||||
... Product(product.id).quantity
|
||||
2.0
|
||||
|
||||
Make a production with effective date yesterday and running the day before::
|
||||
|
||||
@@ -195,8 +195,8 @@ Make a production with effective date yesterday and running the day before::
|
||||
>>> production.click('assign_try')
|
||||
>>> production.click('run')
|
||||
>>> production.reload()
|
||||
>>> all(i.effective_date == before_yesterday for i in production.inputs)
|
||||
True
|
||||
>>> {i.effective_date == before_yesterday for i in production.inputs}
|
||||
{True}
|
||||
>>> production.click('done')
|
||||
>>> production.reload()
|
||||
>>> output, = production.outputs
|
||||
|
||||
@@ -69,5 +69,5 @@ Count product linked to customer::
|
||||
>>> ProductCustomer = Model.get('sale.product_customer')
|
||||
>>> products = ProductCustomer.find(
|
||||
... [('party', '=', customer.id)])
|
||||
>>> len(products) == 2
|
||||
True
|
||||
>>> len(products)
|
||||
2
|
||||
|
||||
@@ -355,7 +355,7 @@ class Sale(metaclass=PoolMeta):
|
||||
sequence=sequence,
|
||||
type='line',
|
||||
product=product,
|
||||
quantity=1, # XXX
|
||||
quantity=1., # XXX
|
||||
unit=product.sale_uom,
|
||||
shipment_cost=shipment_cost,
|
||||
)
|
||||
|
||||
@@ -70,14 +70,10 @@ Receive the shipment::
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.state
|
||||
'received'
|
||||
>>> len(shipment.incoming_moves)
|
||||
1
|
||||
>>> all(m.state == 'done' for m in shipment.incoming_moves)
|
||||
True
|
||||
>>> len(shipment.inventory_moves)
|
||||
1
|
||||
>>> all(m.state == 'draft' for m in shipment.inventory_moves)
|
||||
True
|
||||
>>> [m.state for m in shipment.incoming_moves]
|
||||
['done']
|
||||
>>> [m.state for m in shipment.inventory_moves]
|
||||
['draft']
|
||||
|
||||
>>> restocking_list = Report('stock.shipment.in.restocking_list')
|
||||
>>> _ = restocking_list.execute([shipment])
|
||||
@@ -118,7 +114,5 @@ Finish the shipment::
|
||||
'done'
|
||||
>>> len(shipment.incoming_moves)
|
||||
1
|
||||
>>> len(shipment.inventory_moves)
|
||||
1
|
||||
>>> all(m.state == 'done' for m in shipment.inventory_moves)
|
||||
True
|
||||
>>> [m.state for m in shipment.inventory_moves]
|
||||
['done']
|
||||
|
||||
@@ -176,10 +176,8 @@ Ignore non assigned moves and pack shipment::
|
||||
>>> shipment_out.packed_by == employee
|
||||
True
|
||||
>>> shipment_out.done_by
|
||||
>>> all(m.state == 'assigned' for m in shipment_out.outgoing_moves)
|
||||
True
|
||||
>>> len(shipment_out.outgoing_moves)
|
||||
1
|
||||
>>> [m.state for m in shipment_out.outgoing_moves]
|
||||
['assigned']
|
||||
>>> len(shipment_out.inventory_moves)
|
||||
1
|
||||
>>> shipment_out.inventory_moves[0].state
|
||||
@@ -196,8 +194,8 @@ Set the state as Done::
|
||||
>>> shipment_out.click('done')
|
||||
>>> shipment_out.done_by == employee
|
||||
True
|
||||
>>> all(m.state == 'done' for m in shipment_out.outgoing_moves)
|
||||
True
|
||||
>>> [m.state for m in shipment_out.outgoing_moves]
|
||||
['done']
|
||||
>>> planned_dates = [m.planned_date for m in
|
||||
... shipment_out.outgoing_moves]
|
||||
>>> planned_dates == [today]
|
||||
|
||||
@@ -74,14 +74,10 @@ Receive shipment::
|
||||
>>> shipment.state
|
||||
'received'
|
||||
|
||||
>>> len(shipment.incoming_moves)
|
||||
1
|
||||
>>> all(m.state == 'done' for m in shipment.incoming_moves)
|
||||
True
|
||||
>>> len(shipment.inventory_moves)
|
||||
1
|
||||
>>> all(m.state == 'draft' for m in shipment.inventory_moves)
|
||||
True
|
||||
>>> [m.state for m in shipment.incoming_moves]
|
||||
['done']
|
||||
>>> [m.state for m in shipment.inventory_moves]
|
||||
['draft']
|
||||
|
||||
>>> restocking_list = Report('stock.shipment.out.return.restocking_list')
|
||||
>>> _ = restocking_list.execute([shipment])
|
||||
@@ -93,7 +89,5 @@ Finish the shipment::
|
||||
'done'
|
||||
>>> len(shipment.incoming_moves)
|
||||
1
|
||||
>>> len(shipment.inventory_moves)
|
||||
1
|
||||
>>> all(m.state == 'done' for m in shipment.inventory_moves)
|
||||
True
|
||||
>>> [m.state for m in shipment.inventory_moves]
|
||||
['done']
|
||||
|
||||
Reference in New Issue
Block a user