@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -116,8 +116,7 @@ Run Reconcile wizard::
|
||||
|
||||
>>> reconcile = Wizard('account.reconcile')
|
||||
>>> reconcile.execute('next_')
|
||||
>>> reconcile.form.party == (customer if party_required else None)
|
||||
True
|
||||
>>> assertEqual(reconcile.form.party, (customer if party_required else None))
|
||||
>>> reconcile.form.write_off_amount
|
||||
Decimal('0.00')
|
||||
>>> len(reconcile.form.lines)
|
||||
|
||||
@@ -6,7 +6,8 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, assertEqual, assertTrue)
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -89,8 +90,8 @@ Reconcile Lines without writeoff::
|
||||
'end'
|
||||
>>> reconcile1.reload()
|
||||
>>> reconcile2.reload()
|
||||
>>> reconcile1.reconciliation == reconcile2.reconciliation != None
|
||||
True
|
||||
>>> assertEqual(reconcile1.reconciliation, reconcile2.reconciliation)
|
||||
>>> assertTrue(reconcile1.reconciliation)
|
||||
>>> len(reconcile1.reconciliation.lines)
|
||||
2
|
||||
|
||||
@@ -115,8 +116,8 @@ Reconcile general ledger lines::
|
||||
'end'
|
||||
>>> gl_reconcile1.reload()
|
||||
>>> gl_reconcile2.reload()
|
||||
>>> gl_reconcile1.reconciliation == gl_reconcile2.reconciliation != None
|
||||
True
|
||||
>>> assertEqual(gl_reconcile1.reconciliation, gl_reconcile2.reconciliation)
|
||||
>>> assertTrue(gl_reconcile1.reconciliation)
|
||||
|
||||
Unreconcile general ledger, lines::
|
||||
|
||||
@@ -184,15 +185,14 @@ Reconcile Lines with write-off::
|
||||
>>> reconcile_lines.execute('reconcile')
|
||||
>>> reconcile1.reload()
|
||||
>>> reconcile2.reload()
|
||||
>>> reconcile1.reconciliation == reconcile2.reconciliation != None
|
||||
True
|
||||
>>> assertEqual(reconcile1.reconciliation, reconcile2.reconciliation)
|
||||
>>> assertTrue(reconcile1.reconciliation)
|
||||
>>> len(reconcile1.reconciliation.lines)
|
||||
3
|
||||
>>> writeoff_line1, = [l for l in reconcile1.reconciliation.lines
|
||||
... if l.credit == Decimal(3)]
|
||||
>>> writeoff_line2, = [l for l in writeoff_line1.move.lines
|
||||
... if l != writeoff_line1]
|
||||
>>> writeoff_line2.account == expense
|
||||
True
|
||||
>>> assertEqual(writeoff_line2.account, expense)
|
||||
>>> writeoff_line2.debit
|
||||
Decimal('3.0')
|
||||
|
||||
@@ -6,7 +6,8 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, assertEqual, assertTrue)
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import create_company
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -107,8 +108,8 @@ Reconcile lines::
|
||||
>>> reconcile_lines.state
|
||||
'end'
|
||||
|
||||
>>> reconcile1.reconciliation == reconcile2.reconciliation != None
|
||||
True
|
||||
>>> assertEqual(reconcile1.reconciliation, reconcile2.reconciliation)
|
||||
>>> assertTrue(reconcile1.reconciliation)
|
||||
>>> reconciliation, = Reconciliation.find([])
|
||||
>>> len(reconciliation.lines)
|
||||
3
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -94,13 +94,10 @@ Cancel reversal Move::
|
||||
>>> line, _ = [l for l in move.lines if l.account == receivable]
|
||||
>>> cancel_move, = [l.move for l in line.reconciliation.lines
|
||||
... if l.move != move]
|
||||
>>> cancel_move.origin == move
|
||||
True
|
||||
>>> assertEqual(cancel_move.origin, move)
|
||||
>>> cancel_move.description
|
||||
'Reversal'
|
||||
>>> sorted([l.origin.id for l in cancel_move.lines]) == \
|
||||
... sorted(map(int, move.lines))
|
||||
True
|
||||
>>> assertEqual({l.origin for l in cancel_move.lines}, set(move.lines))
|
||||
>>> revenue.reload()
|
||||
>>> revenue.credit
|
||||
Decimal('42.00')
|
||||
@@ -132,13 +129,10 @@ Cancel Move::
|
||||
>>> line, _ = [l for l in move.lines if l.account == receivable]
|
||||
>>> cancel_move, = [l.move for l in line.reconciliation.lines
|
||||
... if l.move != move]
|
||||
>>> cancel_move.origin == move
|
||||
True
|
||||
>>> assertEqual(cancel_move.origin, move)
|
||||
>>> cancel_move.description
|
||||
'Cancel'
|
||||
>>> sorted([l.origin.id for l in cancel_move.lines]) == \
|
||||
... sorted(map(int, move.lines))
|
||||
True
|
||||
>>> assertEqual({l.origin for l in cancel_move.lines}, set(move.lines))
|
||||
>>> revenue.reload()
|
||||
>>> revenue.credit
|
||||
Decimal('0.00')
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
@@ -86,8 +86,7 @@ Create lines to delegate::
|
||||
Delegate lines::
|
||||
|
||||
>>> delegate = Wizard('account.move.line.delegate', receivable_lines)
|
||||
>>> delegate.form.journal == journal
|
||||
True
|
||||
>>> assertEqual(delegate.form.journal, journal)
|
||||
>>> delegate.form.party = party2
|
||||
>>> delegate.form.description = "Delegate lines"
|
||||
>>> delegate.execute('delegate')
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
@@ -132,12 +132,10 @@ Group lines::
|
||||
>>> all(r.delegate_to for r in reconciliations)
|
||||
True
|
||||
>>> delegate_to = reconciliations[0].delegate_to
|
||||
>>> delegate_to.account == receivable
|
||||
True
|
||||
>>> assertEqual(delegate_to.account, receivable)
|
||||
>>> delegate_to.debit
|
||||
Decimal('50')
|
||||
>>> delegate_to.maturity_date == period.start_date + dt.timedelta(days=2)
|
||||
True
|
||||
>>> assertEqual(delegate_to.maturity_date, period.start_date + dt.timedelta(days=2))
|
||||
>>> delegate_to.move_description_used
|
||||
'Group lines'
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
@@ -89,14 +89,10 @@ Split line by amount::
|
||||
>>> reschedule.execute('preview')
|
||||
|
||||
>>> term1, term2, term3, term4 = reschedule.form.terms
|
||||
>>> term1.date == period.end_date
|
||||
True
|
||||
>>> term2.date == period.end_date + relativedelta(months=2)
|
||||
True
|
||||
>>> term3.date == period.end_date + relativedelta(months=4)
|
||||
True
|
||||
>>> term4.date == period.end_date + relativedelta(months=6)
|
||||
True
|
||||
>>> assertEqual(term1.date, period.end_date)
|
||||
>>> assertEqual(term2.date, period.end_date + relativedelta(months=2))
|
||||
>>> assertEqual(term3.date, period.end_date + relativedelta(months=4))
|
||||
>>> assertEqual(term4.date, period.end_date + relativedelta(months=6))
|
||||
>>> term1.amount, term2.amount, term3.amount, term4.amount
|
||||
(Decimal('30.00'), Decimal('30.00'), Decimal('30.00'), Decimal('10.00'))
|
||||
|
||||
@@ -112,12 +108,9 @@ Split line by number::
|
||||
|
||||
>>> reschedule.form.description = "Split 3 months"
|
||||
>>> term1, term2, term3 = reschedule.form.terms
|
||||
>>> term1.date == period.end_date
|
||||
True
|
||||
>>> term2.date == period.end_date + relativedelta(months=1)
|
||||
True
|
||||
>>> term3.date == period.end_date + relativedelta(months=2)
|
||||
True
|
||||
>>> assertEqual(term1.date, period.end_date)
|
||||
>>> assertEqual(term2.date, period.end_date + relativedelta(months=1))
|
||||
>>> assertEqual(term3.date, period.end_date + relativedelta(months=2))
|
||||
>>> term1.amount, term2.amount, term3.amount
|
||||
(Decimal('33.33'), Decimal('33.33'), Decimal('33.34'))
|
||||
>>> term1.amount = Decimal('40.00')
|
||||
@@ -143,15 +136,12 @@ Check receivable::
|
||||
|
||||
>>> line1.debit, line1.amount
|
||||
(Decimal('36.00'), Decimal('40.00'))
|
||||
>>> line1.maturity_date == period.end_date
|
||||
True
|
||||
>>> assertEqual(line1.maturity_date, period.end_date)
|
||||
|
||||
>>> line2.debit, line2.amount
|
||||
(Decimal('27.00'), Decimal('30.00'))
|
||||
>>> line2.maturity_date == period.end_date + relativedelta(months=1)
|
||||
True
|
||||
>>> assertEqual(line2.maturity_date, period.end_date + relativedelta(months=1))
|
||||
|
||||
>>> line3.debit, line3.amount
|
||||
(Decimal('27.00'), Decimal('30.00'))
|
||||
>>> line3.maturity_date == period.end_date + relativedelta(months=3)
|
||||
True
|
||||
>>> assertEqual(line3.maturity_date, period.end_date + relativedelta(months=3))
|
||||
|
||||
@@ -7,7 +7,8 @@ Imports::
|
||||
>>> import datetime
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, assertEqual, assertLessEqual, assertGreaterEqual)
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -95,23 +96,19 @@ Create Template::
|
||||
Create Move::
|
||||
|
||||
>>> create_move = Wizard('account.move.template.create')
|
||||
>>> create_move.form.date == today
|
||||
True
|
||||
>>> assertEqual(create_move.form.date, today)
|
||||
>>> period = create_move.form.period
|
||||
>>> period.start_date <= today <= period.end_date
|
||||
True
|
||||
>>> assertLessEqual(period.start_date, today)
|
||||
>>> assertGreaterEqual(period.end_date, today)
|
||||
>>> index = fiscalyear.periods.index(create_move.form.period)
|
||||
>>> next_period = fiscalyear.periods[index + 1]
|
||||
>>> create_move.form.date = next_period.start_date
|
||||
>>> create_move.form.period == next_period
|
||||
True
|
||||
>>> assertEqual(create_move.form.period, next_period)
|
||||
>>> prev_period = fiscalyear.periods[index - 1]
|
||||
>>> create_move.form.period = prev_period
|
||||
>>> create_move.form.date == prev_period.end_date
|
||||
True
|
||||
>>> assertEqual(create_move.form.date, prev_period.end_date)
|
||||
>>> create_move.form.period = next_period
|
||||
>>> create_move.form.date == next_period.start_date
|
||||
True
|
||||
>>> assertEqual(create_move.form.date, next_period.start_date)
|
||||
>>> create_move.form.template = template
|
||||
>>> create_move.execute('keywords')
|
||||
>>> data = {}
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear
|
||||
@@ -69,6 +69,5 @@ Renew fiscalyear and test sequence name is updated::
|
||||
>>> renew_fiscalyear.form.reset_sequences = True
|
||||
>>> renew_fiscalyear.execute('create_')
|
||||
>>> new_fiscalyear, = renew_fiscalyear.actions[0]
|
||||
>>> new_fiscalyear.post_move_sequence.name == (
|
||||
>>> assertEqual(new_fiscalyear.post_move_sequence.name,
|
||||
... 'Sequence %s' % new_fiscalyear.name)
|
||||
True
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -94,8 +94,7 @@ Buy an asset::
|
||||
>>> invoice_line.product = asset_product
|
||||
>>> invoice_line.quantity = 1
|
||||
>>> invoice_line.unit_price = Decimal('1000')
|
||||
>>> invoice_line.account == asset_account
|
||||
True
|
||||
>>> assertEqual(invoice_line.account, asset_account)
|
||||
>>> supplier_invoice.invoice_date = fiscalyear.start_date
|
||||
>>> supplier_invoice.click('post')
|
||||
>>> supplier_invoice.state
|
||||
@@ -112,15 +111,12 @@ Depreciate the asset::
|
||||
>>> asset.supplier_invoice_line = invoice_line
|
||||
>>> asset.value
|
||||
Decimal('1000.00')
|
||||
>>> asset.start_date == supplier_invoice.invoice_date
|
||||
True
|
||||
>>> asset.end_date == (supplier_invoice.invoice_date +
|
||||
... relativedelta(years=2, days=-1))
|
||||
True
|
||||
>>> assertEqual(asset.start_date, supplier_invoice.invoice_date)
|
||||
>>> assertEqual(asset.end_date, (supplier_invoice.invoice_date +
|
||||
... relativedelta(years=2, days=-1)))
|
||||
>>> asset.quantity
|
||||
1.0
|
||||
>>> asset.unit == unit
|
||||
True
|
||||
>>> assertEqual(asset.unit, unit)
|
||||
>>> asset.residual_value = Decimal('100')
|
||||
>>> asset.click('create_lines')
|
||||
>>> len(asset.lines)
|
||||
@@ -173,12 +169,10 @@ Update the asset::
|
||||
Decimal('100.00')
|
||||
>>> update.form.date = (supplier_invoice.invoice_date
|
||||
... + relativedelta(months=2))
|
||||
>>> update.form.latest_move_date == (supplier_invoice.invoice_date
|
||||
... + relativedelta(months=3, days=-1))
|
||||
True
|
||||
>>> update.form.next_depreciation_date == (supplier_invoice.invoice_date
|
||||
... + relativedelta(months=4, days=-1))
|
||||
True
|
||||
>>> assertEqual(update.form.latest_move_date, (supplier_invoice.invoice_date
|
||||
... + relativedelta(months=3, days=-1)))
|
||||
>>> assertEqual(update.form.next_depreciation_date, (supplier_invoice.invoice_date
|
||||
... + relativedelta(months=4, days=-1)))
|
||||
>>> update.execute('create_move')
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
@@ -239,14 +233,12 @@ Sale the asset::
|
||||
>>> invoice_line.asset = asset
|
||||
>>> invoice_line.quantity = 1
|
||||
>>> invoice_line.unit_price = Decimal('600')
|
||||
>>> invoice_line.account == revenue
|
||||
True
|
||||
>>> assertEqual(invoice_line.account, revenue)
|
||||
>>> customer_invoice.click('post')
|
||||
>>> customer_invoice.state
|
||||
'posted'
|
||||
>>> asset.reload()
|
||||
>>> asset.customer_invoice_line == customer_invoice.lines[0]
|
||||
True
|
||||
>>> assertEqual(asset.customer_invoice_line, customer_invoice.lines[0])
|
||||
>>> revenue.debit
|
||||
Decimal('860.72')
|
||||
>>> revenue.credit
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -102,7 +102,5 @@ Purchase an asset mixed with services::
|
||||
>>> purchase.click('process')
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> asset_line, service_line = invoice.lines
|
||||
>>> asset_line.account == asset_account
|
||||
True
|
||||
>>> service_line.account == expense
|
||||
True
|
||||
>>> assertEqual(asset_line.account, asset_account)
|
||||
>>> assertEqual(service_line.account, expense)
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
|
||||
>>> from proteus import Model
|
||||
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_fiscalyear, create_chart, get_accounts)
|
||||
>>> from trytond.modules.account_invoice.tests.tools import (
|
||||
@@ -61,7 +61,5 @@ Create invoice::
|
||||
|
||||
Check consolidation company::
|
||||
|
||||
>>> invoice.consolidation_company == saber
|
||||
True
|
||||
>>> invoice.move.consolidation_company == saber
|
||||
True
|
||||
>>> assertEqual(invoice.consolidation_company, saber)
|
||||
>>> assertEqual(invoice.move.consolidation_company, saber)
|
||||
|
||||
@@ -8,7 +8,8 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, set_user, assertEqual, assertTrue)
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -165,14 +166,11 @@ Create dunnings on 5 days::
|
||||
>>> create_dunning.form.date = period.start_date + relativedelta(days=5)
|
||||
>>> create_dunning.execute('create_')
|
||||
>>> dunning, = Dunning.find([])
|
||||
>>> dunning.procedure == procedure
|
||||
True
|
||||
>>> dunning.level == procedure.levels[0]
|
||||
True
|
||||
>>> assertEqual(dunning.procedure, procedure)
|
||||
>>> assertEqual(dunning.level, procedure.levels[0])
|
||||
>>> dunning.state
|
||||
'draft'
|
||||
>>> dunning.line == dunning_line
|
||||
True
|
||||
>>> assertEqual(dunning.line, dunning_line)
|
||||
|
||||
Create dunnings on 30 days with draft dunning::
|
||||
|
||||
@@ -180,15 +178,12 @@ Create dunnings on 30 days with draft dunning::
|
||||
>>> create_dunning.form.date = period.start_date + relativedelta(days=30)
|
||||
>>> create_dunning.execute('create_')
|
||||
>>> dunning, = Dunning.find([])
|
||||
>>> dunning.procedure == procedure
|
||||
True
|
||||
>>> dunning.level == procedure.levels[0]
|
||||
True
|
||||
>>> assertEqual(dunning.procedure, procedure)
|
||||
>>> assertEqual(dunning.level, procedure.levels[0])
|
||||
>>> dunning.state
|
||||
'draft'
|
||||
>>> dunning.date
|
||||
>>> dunning.line == dunning_line
|
||||
True
|
||||
>>> assertEqual(dunning.line, dunning_line)
|
||||
|
||||
Process dunning::
|
||||
|
||||
@@ -209,16 +204,12 @@ Create dunnings on 30 days with blocked dunning::
|
||||
>>> create_dunning.form.date = period.start_date + relativedelta(days=30)
|
||||
>>> create_dunning.execute('create_')
|
||||
>>> dunning, = Dunning.find([])
|
||||
>>> dunning.procedure == procedure
|
||||
True
|
||||
>>> dunning.level == procedure.levels[0]
|
||||
True
|
||||
>>> assertEqual(dunning.procedure, procedure)
|
||||
>>> assertEqual(dunning.level, procedure.levels[0])
|
||||
>>> dunning.state
|
||||
'waiting'
|
||||
>>> dunning.line == dunning_line
|
||||
True
|
||||
>>> bool(dunning.blocked)
|
||||
True
|
||||
>>> assertEqual(dunning.line, dunning_line)
|
||||
>>> assertTrue(dunning.blocked)
|
||||
>>> dunning.blocked = False
|
||||
>>> dunning.save()
|
||||
|
||||
@@ -228,15 +219,12 @@ Create dunnings on 30 days::
|
||||
>>> create_dunning.form.date = period.start_date + relativedelta(days=30)
|
||||
>>> create_dunning.execute('create_')
|
||||
>>> dunning, = Dunning.find([])
|
||||
>>> dunning.procedure == procedure
|
||||
True
|
||||
>>> dunning.level == procedure.levels[1]
|
||||
True
|
||||
>>> assertEqual(dunning.procedure, procedure)
|
||||
>>> assertEqual(dunning.level, procedure.levels[1])
|
||||
>>> dunning.state
|
||||
'draft'
|
||||
>>> dunning.date
|
||||
>>> dunning.line == dunning_line
|
||||
True
|
||||
>>> assertEqual(dunning.line, dunning_line)
|
||||
|
||||
Pay dunning::
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -125,7 +125,5 @@ Process dunning::
|
||||
'Customer <customer@example.com>'
|
||||
>>> email.subject
|
||||
'Dunning Email'
|
||||
>>> email.resource == dunning
|
||||
True
|
||||
>>> email.dunning_level == level
|
||||
True
|
||||
>>> assertEqual(email.resource, dunning)
|
||||
>>> assertEqual(email.dunning_level, level)
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
@@ -168,8 +168,7 @@ Generate aeat reports::
|
||||
>>> extension
|
||||
'txt'
|
||||
>>> with file_open('account_es/tests/111.txt') as f:
|
||||
... content == f.read()
|
||||
True
|
||||
... assertEqual(content, f.read())
|
||||
>>> name
|
||||
'AEAT Model 111-2018-01'
|
||||
|
||||
@@ -182,8 +181,7 @@ Generate aeat reports::
|
||||
>>> extension
|
||||
'txt'
|
||||
>>> with file_open('account_es/tests/115.txt') as f:
|
||||
... content == f.read()
|
||||
True
|
||||
... assertEqual(content, f.read())
|
||||
>>> name
|
||||
'AEAT Model 115-2018-01'
|
||||
|
||||
@@ -195,8 +193,7 @@ Generate aeat reports::
|
||||
>>> extension
|
||||
'txt'
|
||||
>>> with file_open('account_es/tests/303.txt') as f:
|
||||
... content == f.read()
|
||||
True
|
||||
... assertEqual(content, f.read())
|
||||
>>> name
|
||||
'AEAT Model 303-2018-01'
|
||||
|
||||
@@ -212,8 +209,7 @@ Generate aeat reports::
|
||||
>>> extension
|
||||
'txt'
|
||||
>>> with file_open('account_es/tests/347.txt') as f:
|
||||
... content == f.read()
|
||||
True
|
||||
... assertEqual(content, f.read())
|
||||
>>> name
|
||||
'AEAT Model 347-...'
|
||||
|
||||
@@ -230,8 +226,7 @@ Generate aeat reports::
|
||||
>>> extension
|
||||
'txt'
|
||||
>>> with file_open('account_es/tests/349.txt') as f:
|
||||
... content == f.read()
|
||||
True
|
||||
... assertEqual(content, f.read())
|
||||
>>> name
|
||||
'AEAT Model 349-...'
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
@@ -103,8 +103,7 @@ EC Operation and VATList report uses company currency::
|
||||
... }
|
||||
>>> with config.set_context(context):
|
||||
... record, = VatList.find([])
|
||||
>>> record.party == party
|
||||
True
|
||||
>>> assertEqual(record.party, party)
|
||||
>>> record.amount
|
||||
Decimal('121.00')
|
||||
>>> ECOperationList = Model.get('account.reporting.es_ec_operation_list')
|
||||
@@ -115,8 +114,7 @@ EC Operation and VATList report uses company currency::
|
||||
... }
|
||||
>>> with config.set_context(context):
|
||||
... record, = ECOperationList.find([])
|
||||
>>> record.party == supplier
|
||||
True
|
||||
>>> assertEqual(record.party, supplier)
|
||||
>>> record.amount
|
||||
Decimal('50.00')
|
||||
>>> VatBook = Model.get('account.reporting.vat_book_es')
|
||||
@@ -127,8 +125,7 @@ EC Operation and VATList report uses company currency::
|
||||
... }
|
||||
>>> with config.set_context(context):
|
||||
... record, = VatBook.find([])
|
||||
>>> record.party == party
|
||||
True
|
||||
>>> assertEqual(record.party, party)
|
||||
>>> record.base_amount
|
||||
Decimal('100.00')
|
||||
>>> record.tax_amount
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
@@ -131,7 +131,6 @@ Generate aeat 303 report::
|
||||
>>> extension
|
||||
'txt'
|
||||
>>> with file_open('account_es/tests/303_compensate.txt') as f:
|
||||
... content == f.read()
|
||||
True
|
||||
... assertEqual(content, f.read())
|
||||
>>> name
|
||||
'AEAT Model 303-2018-02'
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
@@ -119,15 +119,13 @@ Generate VAT Book::
|
||||
>>> len(records)
|
||||
3
|
||||
>>> tax_record = [r for r in records if not r.surcharge_tax][0]
|
||||
>>> tax_record.party == party
|
||||
True
|
||||
>>> assertEqual(tax_record.party, party)
|
||||
>>> tax_record.base_amount
|
||||
Decimal('100.00')
|
||||
>>> tax_record.tax_amount
|
||||
Decimal('21.00')
|
||||
>>> surcharge_tax_record = [r for r in records if r.surcharge_tax][0]
|
||||
>>> surcharge_tax_record.party == surcharge_party
|
||||
True
|
||||
>>> assertEqual(surcharge_tax_record.party, surcharge_party)
|
||||
>>> surcharge_tax_record.base_amount
|
||||
Decimal('50.00')
|
||||
>>> surcharge_tax_record.tax_amount
|
||||
@@ -135,8 +133,7 @@ Generate VAT Book::
|
||||
>>> surcharge_tax_record.surcharge_tax_amount
|
||||
Decimal('2.60')
|
||||
>>> with file_open('account_es/tests/vat_book.csv', 'rb') as f:
|
||||
... content == f.read()
|
||||
True
|
||||
... assertEqual(content, f.read())
|
||||
>>> name
|
||||
'VAT Book-...'
|
||||
>>> extension
|
||||
|
||||
@@ -9,7 +9,7 @@ Imports::
|
||||
>>> import io
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear
|
||||
@@ -200,8 +200,7 @@ Generate FEC::
|
||||
>>> template = template.format(
|
||||
... current_date=current_date,
|
||||
... )
|
||||
>>> FEC.form.file.decode('utf-8') == template
|
||||
True
|
||||
>>> assertEqual(FEC.form.file.decode('utf-8'), template)
|
||||
|
||||
Generate FEC for previous fiscal year::
|
||||
|
||||
@@ -210,5 +209,4 @@ Generate FEC for previous fiscal year::
|
||||
>>> FEC.execute('generate')
|
||||
>>> file = os.path.join(os.path.dirname(__file__), 'FEC-previous.csv')
|
||||
>>> with io.open(file, mode='rb') as fp:
|
||||
... FEC.form.file.decode('utf-8') == fp.read().decode('utf-8')
|
||||
True
|
||||
... assertEqual(FEC.form.file.decode('utf-8'), fp.read().decode('utf-8'))
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -176,23 +176,20 @@ Create invoice::
|
||||
Test change tax::
|
||||
|
||||
>>> tax_line, = invoice.taxes
|
||||
>>> tax_line.tax == tax
|
||||
True
|
||||
>>> assertEqual(tax_line.tax, tax)
|
||||
>>> tax_line.tax = None
|
||||
>>> tax_line.tax = tax
|
||||
|
||||
Validate invoice::
|
||||
|
||||
>>> invoice.click('validate_invoice')
|
||||
>>> invoice.validated_by == employee
|
||||
True
|
||||
>>> assertEqual(invoice.validated_by, employee)
|
||||
|
||||
Post invoice::
|
||||
|
||||
>>> invoice.invoice_date = today
|
||||
>>> invoice.click('post')
|
||||
>>> invoice.posted_by == employee
|
||||
True
|
||||
>>> assertEqual(invoice.posted_by, employee)
|
||||
>>> invoice.state
|
||||
'posted'
|
||||
>>> invoice.tax_identifier.code
|
||||
@@ -252,8 +249,8 @@ Credit invoice with refund::
|
||||
... ('type', '=', 'out'), ('id', '!=', invoice.id)])
|
||||
>>> credit_note.state
|
||||
'paid'
|
||||
>>> all(line.taxes_date == today for line in credit_note.lines)
|
||||
True
|
||||
>>> for line in credit_note.lines:
|
||||
... assertEqual(line.taxes_date, today)
|
||||
>>> receivable.reload()
|
||||
>>> receivable.debit
|
||||
Decimal('240.00')
|
||||
@@ -370,16 +367,13 @@ Create some complex invoice and test its taxes base rounding::
|
||||
>>> invoice.save()
|
||||
>>> invoice.untaxed_amount
|
||||
Decimal('0.00')
|
||||
>>> invoice.taxes[0].base == invoice.untaxed_amount
|
||||
True
|
||||
>>> assertEqual(invoice.taxes[0].base, invoice.untaxed_amount)
|
||||
>>> empty_invoice, found_invoice = Invoice.find(
|
||||
... [('untaxed_amount', '=', Decimal(0))], order=[('id', 'ASC')])
|
||||
>>> found_invoice.id == invoice.id
|
||||
True
|
||||
>>> assertEqual(found_invoice, invoice)
|
||||
>>> empty_invoice, found_invoice = Invoice.find(
|
||||
... [('total_amount', '=', Decimal(0))], order=[('id', 'ASC')])
|
||||
>>> found_invoice.id == invoice.id
|
||||
True
|
||||
>>> assertEqual(found_invoice, invoice)
|
||||
|
||||
Clear company tax_identifier::
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
@@ -88,8 +88,7 @@ Pay the invoice::
|
||||
>>> pay = invoice.click('pay')
|
||||
>>> pay.form.amount
|
||||
Decimal('400.00')
|
||||
>>> pay.form.currency == eur
|
||||
True
|
||||
>>> assertEqual(pay.form.currency, eur)
|
||||
>>> pay.form.payment_method = payment_method
|
||||
>>> pay.form.date = today
|
||||
>>> pay.execute('choice')
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import create_company
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -101,8 +101,7 @@ Pay the invoice::
|
||||
>>> pay = Wizard('account.invoice.pay', [invoice])
|
||||
>>> pay.form.amount
|
||||
Decimal('400.00')
|
||||
>>> pay.form.currency == eur
|
||||
True
|
||||
>>> assertEqual(pay.form.currency, eur)
|
||||
>>> pay.form.payment_method = payment_method
|
||||
>>> pay.form.date = tomorrow
|
||||
>>> pay.execute('choice')
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -91,8 +91,7 @@ Post customer invoice::
|
||||
Copying invoice with single alternative payee is kept::
|
||||
|
||||
>>> duplicate_inv, = invoice.duplicate()
|
||||
>>> duplicate_inv.alternative_payees == invoice.alternative_payees
|
||||
True
|
||||
>>> assertEqual(duplicate_inv.alternative_payees, invoice.alternative_payees)
|
||||
|
||||
Set another payee::
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear
|
||||
@@ -99,7 +99,7 @@ Renew fiscalyear and test sequence name is updated::
|
||||
>>> renew_fiscalyear.form.reset_sequences = True
|
||||
>>> renew_fiscalyear.execute('create_')
|
||||
>>> new_fiscalyear, = renew_fiscalyear.actions[0]
|
||||
>>> all(seq.out_invoice_sequence.name ==
|
||||
... 'Sequence %s' % new_fiscalyear.name
|
||||
... for seq in new_fiscalyear.invoice_sequences)
|
||||
True
|
||||
>>> for sequence in new_fiscalyear.invoice_sequences:
|
||||
... assertEqual(
|
||||
... sequence.out_invoice_sequence.name,
|
||||
... 'Sequence %s' % new_fiscalyear.name)
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -90,14 +90,11 @@ Create invoice::
|
||||
Check invoice deferred and run it::
|
||||
|
||||
>>> deferral, = InvoiceDeferred.find([])
|
||||
>>> deferral.invoice_line == invoice_line
|
||||
True
|
||||
>>> assertEqual(deferral.invoice_line, invoice_line)
|
||||
>>> deferral.amount
|
||||
Decimal('1000.00')
|
||||
>>> deferral.start_date == invoice_line.defer_from
|
||||
True
|
||||
>>> deferral.end_date == invoice_line.defer_to
|
||||
True
|
||||
>>> assertEqual(deferral.start_date, invoice_line.defer_from)
|
||||
>>> assertEqual(deferral.end_date, invoice_line.defer_to)
|
||||
>>> deferral.click('run')
|
||||
|
||||
Check moves on invoice deferred::
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -86,29 +86,23 @@ Partially pay line::
|
||||
>>> pay_line = Wizard('account.move.line.pay', [line])
|
||||
>>> pay_line.form.date = tomorrow
|
||||
>>> pay_line.execute('next_')
|
||||
>>> pay_line.form.journal == payment_journal
|
||||
True
|
||||
>>> assertEqual(pay_line.form.journal, payment_journal)
|
||||
>>> pay_line.execute('next_')
|
||||
>>> payment, = Payment.find()
|
||||
>>> payment.date == tomorrow
|
||||
True
|
||||
>>> payment.party == supplier
|
||||
True
|
||||
>>> assertEqual(payment.date, tomorrow)
|
||||
>>> assertEqual(payment.party, supplier)
|
||||
>>> payment.amount
|
||||
Decimal('50.00')
|
||||
>>> payment.amount = Decimal('20.00')
|
||||
>>> payment.click('submit')
|
||||
>>> payment.submitted_by == employee
|
||||
True
|
||||
>>> assertEqual(payment.submitted_by, employee)
|
||||
>>> payment.click('approve')
|
||||
>>> payment.approved_by == employee
|
||||
True
|
||||
>>> assertEqual(payment.approved_by, employee)
|
||||
>>> payment.state
|
||||
'approved'
|
||||
>>> process_payment = payment.click('process_wizard')
|
||||
>>> group, = process_payment.actions[0]
|
||||
>>> group.payments == [payment]
|
||||
True
|
||||
>>> assertEqual(group.payments, [payment])
|
||||
>>> payment.state
|
||||
'processing'
|
||||
>>> line.reload()
|
||||
@@ -130,8 +124,7 @@ Success the payment and recheck the payment group::
|
||||
|
||||
>>> group.click('succeed')
|
||||
>>> payment.reload()
|
||||
>>> payment.succeeded_by == employee
|
||||
True
|
||||
>>> assertEqual(payment.succeeded_by, employee)
|
||||
>>> payment.state
|
||||
'succeeded'
|
||||
>>> group.reload()
|
||||
@@ -146,8 +139,7 @@ Search for the completed payment::
|
||||
>>> group, = PaymentGroup.find([('payment_complete', '=', 'True')])
|
||||
>>> group.payment_complete
|
||||
True
|
||||
>>> group.id == payment.group.id
|
||||
True
|
||||
>>> assertEqual(group, payment.group)
|
||||
|
||||
Partially fail to pay the remaining::
|
||||
|
||||
@@ -165,8 +157,7 @@ Partially fail to pay the remaining::
|
||||
Decimal('0.00')
|
||||
>>> payment.reload()
|
||||
>>> payment.click('fail')
|
||||
>>> payment.failed_by == employee
|
||||
True
|
||||
>>> assertEqual(payment.failed_by, employee)
|
||||
>>> payment.state
|
||||
'failed'
|
||||
>>> payment.group.payment_complete
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -90,12 +90,9 @@ Create direct debit::
|
||||
>>> payment, = Payment.find([])
|
||||
>>> payment.amount
|
||||
Decimal('100.00')
|
||||
>>> payment.party == customer1
|
||||
True
|
||||
>>> payment.date == tomorrow
|
||||
True
|
||||
>>> payment.journal == payment_journal
|
||||
True
|
||||
>>> assertEqual(payment.party, customer1)
|
||||
>>> assertEqual(payment.date, tomorrow)
|
||||
>>> assertEqual(payment.journal, payment_journal)
|
||||
|
||||
Re-run create direct debit does nothing::
|
||||
|
||||
@@ -103,5 +100,4 @@ Re-run create direct debit does nothing::
|
||||
>>> create_direct_debit.form.date = after_tomorrow
|
||||
>>> create_direct_debit.execute('create_')
|
||||
|
||||
>>> Payment.find([]) == [payment]
|
||||
True
|
||||
>>> assertEqual(Payment.find([]), [payment])
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -101,8 +101,7 @@ Fail the payment::
|
||||
>>> payment.click('submit')
|
||||
>>> process_payment = payment.click('process_wizard')
|
||||
>>> group, = process_payment.actions[0]
|
||||
>>> group.payments == [payment]
|
||||
True
|
||||
>>> assertEqual(group.payments, [payment])
|
||||
>>> payment.click('fail')
|
||||
>>> payment.state
|
||||
'failed'
|
||||
@@ -115,8 +114,7 @@ Create dunning::
|
||||
>>> create_dunning = Wizard('account.dunning.create')
|
||||
>>> create_dunning.execute('create_')
|
||||
>>> dunning, = Dunning.find([])
|
||||
>>> dunning.line == line
|
||||
True
|
||||
>>> assertEqual(dunning.line, line)
|
||||
|
||||
Recreate a payment::
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -72,8 +72,7 @@ Paying the line without date uses the maturity date::
|
||||
>>> pay_line.execute('next_')
|
||||
>>> pay_line.execute('next_')
|
||||
>>> payment, = Payment.find()
|
||||
>>> payment.date == next_week
|
||||
True
|
||||
>>> assertEqual(payment.date, next_week)
|
||||
|
||||
The date on the payment wizard is used for payment date::
|
||||
|
||||
@@ -83,5 +82,4 @@ The date on the payment wizard is used for payment date::
|
||||
>>> pay_line.execute('next_')
|
||||
>>> pay_line.execute('next_')
|
||||
>>> payment, = Payment.find()
|
||||
>>> payment.date == tomorrow
|
||||
True
|
||||
>>> assertEqual(payment.date, tomorrow)
|
||||
|
||||
@@ -10,7 +10,8 @@ Imports::
|
||||
>>> import braintree
|
||||
>>> from braintree.test.nonces import Nonces
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, assertEqual, assertTrue)
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -109,10 +110,8 @@ Process the payment::
|
||||
>>> process_payment = payment.click('process_wizard')
|
||||
>>> payment.state
|
||||
'processing'
|
||||
>>> bool(payment.braintree_payment_settled)
|
||||
True
|
||||
>>> payment.amount == amount
|
||||
True
|
||||
>>> assertTrue(payment.braintree_payment_settled)
|
||||
>>> assertEqual(payment.amount, amount)
|
||||
|
||||
>>> _ = gateway.testing.settle_transaction(payment.braintree_transaction_id)
|
||||
|
||||
@@ -127,8 +126,7 @@ Pull update::
|
||||
>>> payment.reload()
|
||||
>>> payment.state
|
||||
'succeeded'
|
||||
>>> payment.amount == amount
|
||||
True
|
||||
>>> assertEqual(payment.amount, amount)
|
||||
|
||||
Create a customer::
|
||||
|
||||
@@ -260,8 +258,7 @@ Refund some amount::
|
||||
>>> refund.state
|
||||
'processing'
|
||||
>>> payment.reload()
|
||||
>>> payment.amount == amount
|
||||
True
|
||||
>>> assertEqual(payment.amount, amount)
|
||||
|
||||
>>> _ = gateway.testing.settle_transaction(refund.braintree_transaction_id)
|
||||
>>> cron_refund_pull, = Cron.find([
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
@@ -112,8 +112,7 @@ Succeed payment::
|
||||
>>> succeed.execute('succeed')
|
||||
>>> payment.state
|
||||
'succeeded'
|
||||
>>> payment.clearing_move.date == first
|
||||
True
|
||||
>>> assertEqual(payment.clearing_move.date, first)
|
||||
>>> payment.clearing_move.state
|
||||
'draft'
|
||||
>>> bool(payment.clearing_reconciled)
|
||||
@@ -252,10 +251,8 @@ Create a line for the payment::
|
||||
>>> line = statement.lines.new(date=today)
|
||||
>>> line.amount = Decimal('-50.00')
|
||||
>>> line.related_to = payment
|
||||
>>> line.party == supplier
|
||||
True
|
||||
>>> line.account == bank_clearing
|
||||
True
|
||||
>>> assertEqual(line.party, supplier)
|
||||
>>> assertEqual(line.account, bank_clearing)
|
||||
|
||||
Remove the party must remove payment::
|
||||
|
||||
@@ -309,8 +306,7 @@ Create a statement that reimburse the payment group::
|
||||
... )
|
||||
>>> line = statement.lines.new(date=today)
|
||||
>>> line.related_to = payment.group
|
||||
>>> line.account == bank_clearing
|
||||
True
|
||||
>>> assertEqual(line.account, bank_clearing)
|
||||
>>> line.amount = Decimal('50.00')
|
||||
|
||||
>>> statement.click('validate_statement')
|
||||
@@ -453,10 +449,8 @@ Create statement for the payment::
|
||||
>>> line = statement.lines.new(date=yesterday)
|
||||
>>> line.amount = Decimal('-50.00')
|
||||
>>> line.related_to = payment
|
||||
>>> line.party == supplier
|
||||
True
|
||||
>>> line.account == bank_clearing
|
||||
True
|
||||
>>> assertEqual(line.party, supplier)
|
||||
>>> assertEqual(line.account, bank_clearing)
|
||||
>>> statement.save()
|
||||
|
||||
Validate statement and check the payment is confirmed::
|
||||
@@ -477,5 +471,4 @@ Validate statement and check the payment is confirmed::
|
||||
>>> debit_line, = [l for l in payment.clearing_move.lines if l.debit > 0]
|
||||
>>> debit_line.debit
|
||||
Decimal('50.00')
|
||||
>>> debit_line.date == yesterday
|
||||
True
|
||||
>>> assertEqual(debit_line.date, yesterday)
|
||||
|
||||
@@ -12,7 +12,7 @@ Imports::
|
||||
>>> import stripe
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
|
||||
@@ -104,8 +104,6 @@ Run cron::
|
||||
>>> cron_customer_create.click('run_once')
|
||||
|
||||
>>> stripe_customer2.reload()
|
||||
>>> stripe_customer2.identical_customers == [stripe_customer1]
|
||||
True
|
||||
>>> assertEqual(stripe_customer2.identical_customers, [stripe_customer1])
|
||||
>>> stripe_customer1.reload()
|
||||
>>> stripe_customer1.identical_customers == [stripe_customer2]
|
||||
True
|
||||
>>> assertEqual(stripe_customer1.identical_customers, [stripe_customer2])
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -104,9 +104,6 @@ Test rules with a sale::
|
||||
'processing'
|
||||
|
||||
>>> invoice, = sale.invoices
|
||||
>>> invoice.lines[0].account == account_revenue1
|
||||
True
|
||||
>>> invoice.lines[1].account == account_revenue2
|
||||
True
|
||||
>>> invoice.lines[2].account == account_revenue3
|
||||
True
|
||||
>>> assertEqual(invoice.lines[0].account, account_revenue1)
|
||||
>>> assertEqual(invoice.lines[1].account, account_revenue2)
|
||||
>>> assertEqual(invoice.lines[2].account, account_revenue3)
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -142,8 +142,7 @@ Received 180 from customer::
|
||||
>>> statement_line.date = today
|
||||
>>> statement_line.amount = Decimal('180')
|
||||
>>> statement_line.party = customer
|
||||
>>> statement_line.account == receivable
|
||||
True
|
||||
>>> assertEqual(statement_line.account, receivable)
|
||||
>>> statement_line.related_to = customer_invoice1
|
||||
>>> statement_line.amount
|
||||
Decimal('100.00')
|
||||
@@ -154,10 +153,8 @@ Received 180 from customer::
|
||||
'0001'
|
||||
>>> statement_line.description
|
||||
'description'
|
||||
>>> statement_line.party == customer
|
||||
True
|
||||
>>> statement_line.account == receivable
|
||||
True
|
||||
>>> assertEqual(statement_line.party, customer)
|
||||
>>> assertEqual(statement_line.account, receivable)
|
||||
>>> statement_line.description = 'other description'
|
||||
>>> statement_line.related_to = customer_invoice2
|
||||
>>> statement_line.amount
|
||||
@@ -182,8 +179,7 @@ Paid 50 to supplier::
|
||||
>>> statement_line.date = today
|
||||
>>> statement_line.amount = Decimal('-60')
|
||||
>>> statement_line.party = supplier
|
||||
>>> statement_line.account == payable
|
||||
True
|
||||
>>> assertEqual(statement_line.account, payable)
|
||||
>>> statement_line.related_to = supplier_invoice
|
||||
>>> statement_line.amount
|
||||
Decimal('-50.00')
|
||||
@@ -309,8 +305,7 @@ Let's test the negative amount version of the supplier/customer invoices::
|
||||
>>> statement_line.account = receivable
|
||||
>>> statement_line.amount = Decimal(-120)
|
||||
>>> statement_line.related_to = customer_invoice3
|
||||
>>> statement_line.related_to.id == customer_invoice3.id
|
||||
True
|
||||
>>> assertEqual(statement_line.related_to, customer_invoice3)
|
||||
|
||||
>>> statement_line = StatementLine()
|
||||
>>> statement.lines.append(statement_line)
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -77,14 +77,11 @@ Statement can not be posted until all origins are finished::
|
||||
>>> statement.click('draft')
|
||||
>>> origin, = statement.origins
|
||||
>>> line = origin.lines.new()
|
||||
>>> line.date == today
|
||||
True
|
||||
>>> assertEqual(line.date, today)
|
||||
>>> line.amount
|
||||
Decimal('50.00')
|
||||
>>> line.party == customer
|
||||
True
|
||||
>>> line.account == receivable
|
||||
True
|
||||
>>> assertEqual(line.party, customer)
|
||||
>>> assertEqual(line.account, receivable)
|
||||
>>> line.amount = Decimal('52.00')
|
||||
>>> line = origin.lines.new()
|
||||
>>> line.amount
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -99,17 +99,13 @@ Pending amount is used to fill all invoices::
|
||||
>>> line.related_to = customer_invoice1
|
||||
>>> line.amount
|
||||
Decimal('100.00')
|
||||
>>> line.party == customer
|
||||
True
|
||||
>>> line.account == receivable
|
||||
True
|
||||
>>> assertEqual(line.party, customer)
|
||||
>>> assertEqual(line.account, receivable)
|
||||
>>> origin.pending_amount
|
||||
Decimal('80.00')
|
||||
>>> line = origin.lines.new()
|
||||
>>> line.related_to = customer_invoice2
|
||||
>>> line.amount
|
||||
Decimal('80.00')
|
||||
>>> line.party == customer
|
||||
True
|
||||
>>> line.account == receivable
|
||||
True
|
||||
>>> assertEqual(line.party, customer)
|
||||
>>> assertEqual(line.account, receivable)
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import config, Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
@@ -80,8 +80,7 @@ Check Statement::
|
||||
|
||||
>>> Statement = Model.get('account.statement')
|
||||
>>> statement, = Statement.find([])
|
||||
>>> statement.journal == journal
|
||||
True
|
||||
>>> assertEqual(statement.journal, journal)
|
||||
>>> statement.number_of_lines
|
||||
1
|
||||
>>> statement.total_amount
|
||||
|
||||
@@ -5,7 +5,7 @@ Account Statement MT940 Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
@@ -110,8 +110,7 @@ Check Statement::
|
||||
datetime.date(2019, 7, 31)
|
||||
>>> origin.amount
|
||||
Decimal('100.00')
|
||||
>>> origin.party == customer
|
||||
True
|
||||
>>> assertEqual(origin.party, customer)
|
||||
>>> origin.description
|
||||
'98.76.54.321 John Doe'
|
||||
>>> origin.information['mt940_reference']
|
||||
|
||||
@@ -5,7 +5,7 @@ Account Statement OFX Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
@@ -101,8 +101,7 @@ Check Statement::
|
||||
datetime.date(2018, 2, 21)
|
||||
>>> origin.amount
|
||||
Decimal('100.00')
|
||||
>>> origin.party == michael_scott_paper
|
||||
True
|
||||
>>> assertEqual(origin.party, michael_scott_paper)
|
||||
>>> origin.description
|
||||
'COMMUNICATION'
|
||||
>>> origin.information['ofx_type']
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -84,7 +84,5 @@ Apply rules on statement::
|
||||
2
|
||||
>>> sorted([l.amount for l in statement.lines])
|
||||
[Decimal('5.00'), Decimal('45.00')]
|
||||
>>> {l.account for l in statement.lines} == {tax, receivable}
|
||||
True
|
||||
>>> {l.party for l in statement.lines} == {None, customer}
|
||||
True
|
||||
>>> assertEqual({l.account for l in statement.lines}, {tax, receivable})
|
||||
>>> assertEqual({l.party for l in statement.lines}, {None, customer})
|
||||
|
||||
+4
-7
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -106,8 +106,7 @@ Apply rules on statement match::
|
||||
|
||||
>>> statement.click('apply_rules')
|
||||
>>> line, = statement.lines
|
||||
>>> line.party == customer
|
||||
True
|
||||
>>> assertEqual(line.party, customer)
|
||||
|
||||
>>> statement.click('validate_statement')
|
||||
>>> statement.click('post')
|
||||
@@ -135,7 +134,5 @@ Now a party is found::
|
||||
>>> line, = statement.lines
|
||||
>>> line.amount
|
||||
Decimal('50.00')
|
||||
>>> line.party == customer
|
||||
True
|
||||
>>> line.account == accounts['receivable']
|
||||
True
|
||||
>>> assertEqual(line.party, customer)
|
||||
>>> assertEqual(line.account, accounts['receivable'])
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -116,7 +116,5 @@ Now a party is found::
|
||||
>>> line, = statement.lines
|
||||
>>> line.amount
|
||||
Decimal('50.00')
|
||||
>>> line.party == customer
|
||||
True
|
||||
>>> line.account == receivable
|
||||
True
|
||||
>>> assertEqual(line.party, customer)
|
||||
>>> assertEqual(line.account, receivable)
|
||||
|
||||
@@ -5,7 +5,7 @@ Account Statement Sepa Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
@@ -104,8 +104,7 @@ Check Statement::
|
||||
datetime.date(2009, 4, 29)
|
||||
>>> origin.amount
|
||||
Decimal('-100.00')
|
||||
>>> origin.party == supplier
|
||||
True
|
||||
>>> assertEqual(origin.party, supplier)
|
||||
>>> origin.description
|
||||
>>> origin.information['camt_creditor_name']
|
||||
'Supplier'
|
||||
|
||||
@@ -10,7 +10,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
@@ -179,8 +179,7 @@ Receive products from France::
|
||||
20.0
|
||||
>>> move.intrastat_country_of_origin
|
||||
>>> move.intrastat_vat
|
||||
>>> move.intrastat_declaration.month == today.replace(day=1)
|
||||
True
|
||||
>>> assertEqual(move.intrastat_declaration.month, today.replace(day=1))
|
||||
|
||||
>>> move, = shipment.inventory_moves
|
||||
>>> move.intrastat_type
|
||||
@@ -242,8 +241,7 @@ Receive returned products from France::
|
||||
5.0
|
||||
>>> move.intrastat_country_of_origin
|
||||
>>> move.intrastat_vat
|
||||
>>> move.intrastat_declaration.month == today.replace(day=1)
|
||||
True
|
||||
>>> assertEqual(move.intrastat_declaration.month, today.replace(day=1))
|
||||
|
||||
>>> move, = shipment.inventory_moves
|
||||
>>> move.intrastat_type
|
||||
@@ -253,8 +251,7 @@ Check declaration::
|
||||
>>> declaration, = IntrastatDeclaration.find([])
|
||||
>>> declaration.country.code
|
||||
'BE'
|
||||
>>> declaration.month == today.replace(day=1)
|
||||
True
|
||||
>>> assertEqual(declaration.month, today.replace(day=1))
|
||||
>>> declaration.state
|
||||
'opened'
|
||||
>>> bool(declaration.extended)
|
||||
|
||||
@@ -10,7 +10,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
@@ -188,8 +188,7 @@ Send products to particular to France::
|
||||
>>> move.intrastat_country_of_origin.code
|
||||
'CN'
|
||||
>>> move.intrastat_vat
|
||||
>>> move.intrastat_declaration.month == today.replace(day=1)
|
||||
True
|
||||
>>> assertEqual(move.intrastat_declaration.month, today.replace(day=1))
|
||||
|
||||
|
||||
Send products to US::
|
||||
@@ -255,16 +254,14 @@ Send returned products to France::
|
||||
'CN'
|
||||
>>> move.intrastat_vat.code
|
||||
'FR40303265045'
|
||||
>>> move.intrastat_declaration.month == today.replace(day=1)
|
||||
True
|
||||
>>> assertEqual(move.intrastat_declaration.month, today.replace(day=1))
|
||||
|
||||
Check declaration::
|
||||
|
||||
>>> declaration, = IntrastatDeclaration.find([])
|
||||
>>> declaration.country.code
|
||||
'BE'
|
||||
>>> declaration.month == today.replace(day=1)
|
||||
True
|
||||
>>> assertEqual(declaration.month, today.replace(day=1))
|
||||
>>> declaration.state
|
||||
'opened'
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -106,8 +106,7 @@ Cancel reversal move::
|
||||
True
|
||||
>>> cancel_move, = [l.move for l in line.reconciliation.lines
|
||||
... if l.move != move]
|
||||
>>> cancel_move.origin == move
|
||||
True
|
||||
>>> assertEqual(cancel_move.origin, move)
|
||||
>>> analytic_account.reload()
|
||||
>>> analytic_account.credit
|
||||
Decimal('42.00')
|
||||
@@ -138,8 +137,7 @@ Cancel move::
|
||||
True
|
||||
>>> cancel_move, = [l.move for l in line.reconciliation.lines
|
||||
... if l.move != move]
|
||||
>>> cancel_move.origin == move
|
||||
True
|
||||
>>> assertEqual(cancel_move.origin, move)
|
||||
>>> analytic_account.reload()
|
||||
>>> analytic_account.credit
|
||||
Decimal('0.00')
|
||||
@@ -165,12 +163,10 @@ Check analytic lines are created on posting::
|
||||
>>> move.click('post')
|
||||
>>> line, = [l for l in move.lines if l.analytic_lines]
|
||||
>>> analytic_line, = line.analytic_lines
|
||||
>>> analytic_line.account == analytic_account2
|
||||
True
|
||||
>>> assertEqual(analytic_line.account, analytic_account2)
|
||||
>>> analytic_line.credit
|
||||
Decimal('73')
|
||||
>>> analytic_line.date == analytic_line.move_line.date
|
||||
True
|
||||
>>> assertEqual(analytic_line.date, analytic_line.move_line.date)
|
||||
|
||||
Prepare to balance non-deferral accounts::
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -129,10 +129,8 @@ Copy the budget without amounts::
|
||||
>>> copy_budget.form.factor = Decimal('1.2')
|
||||
>>> copy_budget.execute('copy')
|
||||
>>> new_budget, = copy_budget.actions[0]
|
||||
>>> new_budget.start_date == next_period.start_date
|
||||
True
|
||||
>>> new_budget.end_date == next_period.end_date
|
||||
True
|
||||
>>> assertEqual(new_budget.start_date, next_period.start_date)
|
||||
>>> assertEqual(new_budget.end_date, next_period.end_date)
|
||||
>>> analytic_budget, other_analytic_budget = new_budget.lines
|
||||
>>> analytic_budget.total_amount
|
||||
Decimal('-84.00')
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -88,8 +88,7 @@ Create invoice with analytic accounts::
|
||||
>>> invoice.payment_term = payment_term
|
||||
>>> line = invoice.lines.new()
|
||||
>>> entry, = line.analytic_accounts
|
||||
>>> entry.root == root
|
||||
True
|
||||
>>> assertEqual(entry.root, root)
|
||||
>>> entry.account = analytic_account
|
||||
>>> line.product = product
|
||||
>>> line.quantity = 5
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -107,14 +107,11 @@ Create invoice::
|
||||
Check invoice deferred and run it::
|
||||
|
||||
>>> deferral, = InvoiceDeferred.find([])
|
||||
>>> deferral.invoice_line == invoice_line
|
||||
True
|
||||
>>> assertEqual(deferral.invoice_line, invoice_line)
|
||||
>>> deferral.amount
|
||||
Decimal('1000.00')
|
||||
>>> deferral.start_date == invoice_line.defer_from
|
||||
True
|
||||
>>> deferral.end_date == invoice_line.defer_to
|
||||
True
|
||||
>>> assertEqual(deferral.start_date, invoice_line.defer_from)
|
||||
>>> assertEqual(deferral.end_date, invoice_line.defer_to)
|
||||
>>> deferral.click('run')
|
||||
>>> deferral.state
|
||||
'running'
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -102,8 +102,7 @@ Purchase with analytic accounts::
|
||||
>>> purchase.invoice_method = 'order'
|
||||
>>> purchase_line = purchase.lines.new()
|
||||
>>> entry, = purchase_line.analytic_accounts
|
||||
>>> entry.root == root
|
||||
True
|
||||
>>> assertEqual(entry.root, root)
|
||||
>>> entry.account = analytic_account
|
||||
>>> purchase_line.product = product
|
||||
>>> purchase_line.quantity = 5
|
||||
@@ -119,8 +118,7 @@ Check invoice analytic accounts::
|
||||
>>> invoice = Invoice(purchase.invoices[0].id)
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> entry, = invoice_line.analytic_accounts
|
||||
>>> entry.account == analytic_account
|
||||
True
|
||||
>>> assertEqual(entry.account, analytic_account)
|
||||
|
||||
Purchase with an empty analytic account::
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -103,8 +103,7 @@ Sale with analytic accounts::
|
||||
>>> sale.invoice_method = 'order'
|
||||
>>> sale_line = sale.lines.new()
|
||||
>>> entry, = sale_line.analytic_accounts
|
||||
>>> entry.root == root
|
||||
True
|
||||
>>> assertEqual(entry.root, root)
|
||||
>>> entry.account = analytic_account
|
||||
>>> sale_line.product = product
|
||||
>>> sale_line.quantity = 5
|
||||
@@ -119,8 +118,7 @@ Check analytic accounts on invoice::
|
||||
>>> invoice = Invoice(sale.invoices[0].id)
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> entry, = invoice_line.analytic_accounts
|
||||
>>> entry.account == analytic_account
|
||||
True
|
||||
>>> assertEqual(entry.account, analytic_account)
|
||||
|
||||
Sale with an empty analytic account::
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, assertEqual, assertTrue)
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> now = dt.datetime.now()
|
||||
@@ -44,10 +45,8 @@ Create an attendance record for the employee::
|
||||
>>> attendance.at = now
|
||||
>>> attendance.save()
|
||||
|
||||
>>> attendance.date == now.date()
|
||||
True
|
||||
>>> bool(attendance.rec_name)
|
||||
True
|
||||
>>> assertEqual(attendance.date, now.date())
|
||||
>>> assertTrue(attendance.rec_name)
|
||||
|
||||
When creating a new attendance the type is automatically set::
|
||||
|
||||
@@ -91,5 +90,4 @@ Update attendance date time, update its date::
|
||||
>>> attendance.at = next_week
|
||||
>>> attendance.save()
|
||||
|
||||
>>> attendance.date == next_week.date()
|
||||
True
|
||||
>>> assertEqual(attendance.date, next_week.date())
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from proteus import Model
|
||||
>>> from trytond import backend
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
|
||||
@@ -75,7 +75,4 @@ Check attendance time sheet::
|
||||
>>> if backend.name != 'sqlite':
|
||||
... sheet, = Sheet.find([('date', '=', dt.date(2020, 4, 2))])
|
||||
... sheet.duration
|
||||
... sheet.timesheet_duration == dt.timedelta(hours=2)
|
||||
... else:
|
||||
... True
|
||||
True
|
||||
... assertEqual(sheet.timesheet_duration, dt.timedelta(hours=2))
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_chart, get_accounts)
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
@@ -127,16 +127,14 @@ Sale products with cost on shipment::
|
||||
Check shipment::
|
||||
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.carrier == carrier1
|
||||
True
|
||||
>>> assertEqual(shipment.carrier, carrier1)
|
||||
>>> shipment.cost_used
|
||||
Decimal('2.0000')
|
||||
>>> shipment.cost_sale_used
|
||||
Decimal('3.0000')
|
||||
|
||||
>>> carriage, = shipment.before_carriages
|
||||
>>> carriage.carrier == carrier2
|
||||
True
|
||||
>>> assertEqual(carriage.carrier, carrier2)
|
||||
>>> carriage.cost_used
|
||||
Decimal('1.0000')
|
||||
>>> carriage.cost_sale_used
|
||||
|
||||
+8
-15
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -120,8 +120,7 @@ Receive a single product line::
|
||||
>>> shipment.carrier = carrier
|
||||
>>> shipment.cost_used
|
||||
Decimal('60.0000')
|
||||
>>> shipment.cost_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_currency_used, company.currency)
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.state
|
||||
'received'
|
||||
@@ -148,8 +147,7 @@ Sale products with cost on shipment::
|
||||
>>> sale_line.quantity = 5.0
|
||||
>>> sale.click('quote')
|
||||
>>> cost_line = sale.lines[-1]
|
||||
>>> cost_line.product == carrier_product
|
||||
True
|
||||
>>> assertEqual(cost_line.product, carrier_product)
|
||||
>>> cost_line.quantity
|
||||
1.0
|
||||
>>> cost_line.amount
|
||||
@@ -165,22 +163,19 @@ Send products::
|
||||
|
||||
>>> ShipmentOut = Model.get('stock.shipment.out')
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.carrier == carrier
|
||||
True
|
||||
>>> assertEqual(shipment.carrier, carrier)
|
||||
>>> shipment.cost_used
|
||||
Decimal('15.0000')
|
||||
>>> shipment.cost_sale_used
|
||||
Decimal('15.0000')
|
||||
>>> shipment.cost_sale_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_sale_currency_used, company.currency)
|
||||
>>> move, = shipment.inventory_moves
|
||||
>>> move.quantity = 4
|
||||
>>> shipment.cost_used
|
||||
Decimal('12.0000')
|
||||
>>> shipment.cost_sale_used
|
||||
Decimal('12.0000')
|
||||
>>> shipment.cost_sale_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_sale_currency_used, company.currency)
|
||||
>>> shipment.state
|
||||
'waiting'
|
||||
>>> shipment.click('assign_force')
|
||||
@@ -216,8 +211,7 @@ Sale products with cost on order::
|
||||
>>> sale_line.quantity = 3.0
|
||||
>>> sale.click('quote')
|
||||
>>> cost_line = sale.lines[-1]
|
||||
>>> cost_line.product == carrier_product
|
||||
True
|
||||
>>> assertEqual(cost_line.product, carrier_product)
|
||||
>>> cost_line.quantity
|
||||
1.0
|
||||
>>> cost_line.amount
|
||||
@@ -232,8 +226,7 @@ Sale products with cost on order::
|
||||
Check customer shipment::
|
||||
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.carrier == carrier
|
||||
True
|
||||
>>> assertEqual(shipment.carrier, carrier)
|
||||
|
||||
Check customer invoice::
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
|
||||
@@ -119,9 +119,7 @@ Test right carrier is used on sale::
|
||||
>>> Sale = Model.get('sale.sale')
|
||||
>>> sale = Sale()
|
||||
>>> sale.party = customer
|
||||
>>> sale.carrier == carrier
|
||||
True
|
||||
>>> assertEqual(sale.carrier, carrier)
|
||||
>>> sale.carrier = None
|
||||
>>> sale.party = other_customer
|
||||
>>> sale.carrier == catalan_carrier
|
||||
True
|
||||
>>> assertEqual(sale.carrier, catalan_carrier)
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
|
||||
@@ -89,9 +89,7 @@ Test right carrier is used on sale::
|
||||
>>> Sale = Model.get('sale.sale')
|
||||
>>> sale = Sale()
|
||||
>>> sale.party = customer
|
||||
>>> sale.carrier == carrier
|
||||
True
|
||||
>>> assertEqual(sale.carrier, carrier)
|
||||
>>> sale.carrier = None
|
||||
>>> sale.party = other_customer
|
||||
>>> sale.carrier == local_carrier
|
||||
True
|
||||
>>> assertEqual(sale.carrier, local_carrier)
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -131,8 +131,7 @@ Receive a single product line::
|
||||
>>> shipment.carrier = carrier
|
||||
>>> shipment.cost_used
|
||||
Decimal('25.0000')
|
||||
>>> shipment.cost_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_currency_used, company.currency)
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.state
|
||||
'received'
|
||||
@@ -165,8 +164,7 @@ Sale products with cost on shipment::
|
||||
>>> sale_line.description = 'Comment'
|
||||
>>> sale.click('quote')
|
||||
>>> cost_line = sale.lines[-1]
|
||||
>>> cost_line.product == carrier_product
|
||||
True
|
||||
>>> assertEqual(cost_line.product, carrier_product)
|
||||
>>> cost_line.quantity
|
||||
1.0
|
||||
>>> cost_line.amount
|
||||
@@ -182,22 +180,19 @@ Send products::
|
||||
|
||||
>>> ShipmentOut = Model.get('stock.shipment.out')
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.carrier == carrier
|
||||
True
|
||||
>>> assertEqual(shipment.carrier, carrier)
|
||||
>>> shipment.cost_used
|
||||
Decimal('40.0000')
|
||||
>>> shipment.cost_sale_used
|
||||
Decimal('40.0000')
|
||||
>>> shipment.cost_sale_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_sale_currency_used, company.currency)
|
||||
>>> move = shipment.inventory_moves[0]
|
||||
>>> move.quantity -= 1
|
||||
>>> shipment.cost_used
|
||||
Decimal('25.0000')
|
||||
>>> shipment.cost_sale_used
|
||||
Decimal('25.0000')
|
||||
>>> shipment.cost_sale_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_sale_currency_used, company.currency)
|
||||
>>> shipment.state
|
||||
'waiting'
|
||||
>>> shipment.click('assign_force')
|
||||
@@ -233,8 +228,7 @@ Sale products with cost on order::
|
||||
>>> sale_line.quantity = 3.0
|
||||
>>> sale.click('quote')
|
||||
>>> cost_line = sale.lines[-1]
|
||||
>>> cost_line.product == carrier_product
|
||||
True
|
||||
>>> assertEqual(cost_line.product, carrier_product)
|
||||
>>> cost_line.quantity
|
||||
1.0
|
||||
>>> cost_line.amount
|
||||
@@ -249,8 +243,7 @@ Sale products with cost on order::
|
||||
Check customer shipment::
|
||||
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.carrier == carrier
|
||||
True
|
||||
>>> assertEqual(shipment.carrier, carrier)
|
||||
|
||||
Check customer invoice::
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -76,8 +76,7 @@ The agent is assigned on quotation::
|
||||
>>> sale.click('quote')
|
||||
>>> sale.state
|
||||
'quotation'
|
||||
>>> sale.agent == agent
|
||||
True
|
||||
>>> assertEqual(sale.agent, agent)
|
||||
|
||||
Agent is not set for yesterday sales::
|
||||
|
||||
@@ -107,7 +106,5 @@ Creating a sale and test agent is assigned::
|
||||
>>> sale.click('quote')
|
||||
>>> sale.state
|
||||
'quotation'
|
||||
>>> sale.quoted_by == employee
|
||||
True
|
||||
>>> sale.agent == agent
|
||||
True
|
||||
>>> assertEqual(sale.quoted_by, employee)
|
||||
>>> assertEqual(sale.agent, agent)
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -184,8 +184,8 @@ Pay invoice::
|
||||
>>> pay.state
|
||||
'end'
|
||||
>>> Commission = Model.get('commission')
|
||||
>>> [c.date == tomorrow for c in Commission.find([])]
|
||||
[True, True]
|
||||
>>> for commission in Commission.find([]):
|
||||
... assertEqual(commission.date, tomorrow)
|
||||
|
||||
Create commission invoices::
|
||||
|
||||
@@ -199,11 +199,9 @@ Create commission invoices::
|
||||
... ])
|
||||
>>> invoice.total_amount
|
||||
Decimal('10.00')
|
||||
>>> invoice.party == agent_party
|
||||
True
|
||||
>>> assertEqual(invoice.party, agent_party)
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> invoice_line.product == commission_product
|
||||
True
|
||||
>>> assertEqual(invoice_line.product, commission_product)
|
||||
|
||||
>>> invoice, = Invoice.find([
|
||||
... ('type', '=', 'out'),
|
||||
@@ -225,8 +223,7 @@ Credit invoice::
|
||||
>>> credit = Wizard('account.invoice.credit', [invoice])
|
||||
>>> credit.execute('credit')
|
||||
>>> credit_note, = credit.actions[0]
|
||||
>>> credit_note.agent == agent
|
||||
True
|
||||
>>> assertEqual(credit_note.agent, agent)
|
||||
|
||||
Check commission reporting per agent::
|
||||
|
||||
@@ -241,8 +238,7 @@ Check commission reporting per agent::
|
||||
>>> reporting_agent.number
|
||||
1
|
||||
|
||||
>>> reporting_agent_timeseries.date == tomorrow
|
||||
True
|
||||
>>> assertEqual(reporting_agent_timeseries.date, tomorrow)
|
||||
>>> reporting_agent_timeseries.base_amount
|
||||
Decimal('100.00')
|
||||
>>> reporting_agent_timeseries.amount
|
||||
|
||||
@@ -5,7 +5,7 @@ Document Incoming Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
Activate modules::
|
||||
@@ -31,6 +31,5 @@ Process document::
|
||||
>>> document.state
|
||||
'done'
|
||||
>>> new_document = document.result
|
||||
>>> new_document.data == document.data
|
||||
True
|
||||
>>> assertEqual(new_document.data, document.data)
|
||||
>>> new_document.type
|
||||
|
||||
@@ -5,7 +5,7 @@ Document Incoming Invoice Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_chart, create_fiscalyear)
|
||||
>>> from trytond.modules.account_invoice.tests.tools import (
|
||||
@@ -57,5 +57,4 @@ Process document::
|
||||
|
||||
>>> document.click('process')
|
||||
>>> invoice = document.result
|
||||
>>> invoice.party == suppplier
|
||||
True
|
||||
>>> assertEqual(invoice.party, suppplier)
|
||||
|
||||
+4
-7
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_chart, create_fiscalyear, get_accounts, create_tax)
|
||||
@@ -97,8 +97,7 @@ Process document::
|
||||
|
||||
>>> document.click('process')
|
||||
>>> invoice = document.result
|
||||
>>> invoice.party == suppplier
|
||||
True
|
||||
>>> assertEqual(invoice.party, suppplier)
|
||||
>>> invoice.reference
|
||||
'INV-0007'
|
||||
>>> invoice.invoice_date
|
||||
@@ -108,8 +107,7 @@ Process document::
|
||||
>>> len(invoice.lines)
|
||||
2
|
||||
>>> line_service, = [l for l in invoice.lines if l.product]
|
||||
>>> line_service.product == service
|
||||
True
|
||||
>>> assertEqual(line_service.product, service)
|
||||
>>> line_service.quantity
|
||||
23.0
|
||||
>>> line_service.unit_price
|
||||
@@ -125,8 +123,7 @@ Process document::
|
||||
[Decimal('5.75'), Decimal('40.00')]
|
||||
>>> sorted([t.base for t in invoice.taxes])
|
||||
[Decimal('57.50'), Decimal('200.00')]
|
||||
>>> {t.tax for t in invoice.taxes} == {tax_10, tax_20}
|
||||
True
|
||||
>>> assertEqual({t.tax for t in invoice.taxes}, {tax_10, tax_20})
|
||||
>>> invoice.untaxed_amount
|
||||
Decimal('257.50')
|
||||
>>> invoice.tax_amount
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -152,8 +152,7 @@ Test incoterms are deducted from sale::
|
||||
>>> sale.shipment_cost_method = None
|
||||
>>> sale.incoterm.rec_name
|
||||
'FCA (2020)'
|
||||
>>> sale.incoterm_location == warehouse_address
|
||||
True
|
||||
>>> assertEqual(sale.incoterm_location, warehouse_address)
|
||||
|
||||
Try sale without incoterm::
|
||||
|
||||
@@ -193,8 +192,7 @@ Test incoterm on shipment::
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.incoterm.rec_name
|
||||
'CIF (2020)'
|
||||
>>> shipment.incoterm_location == port.addresses[0]
|
||||
True
|
||||
>>> assertEqual(shipment.incoterm_location, port.addresses[0])
|
||||
|
||||
Test incoterm is set on purchase::
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ Imports::
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from proteus.config import get_config
|
||||
>>> from trytond.pyson import Eval, PYSONEncoder
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, assertEqual, assertIn, assertTrue)
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
Patch sendmail_transactional::
|
||||
@@ -105,8 +106,7 @@ Trigger scenario::
|
||||
|
||||
>>> Record = Model.get('marketing.automation.record')
|
||||
>>> record, = Record.find([])
|
||||
>>> record.record == party
|
||||
True
|
||||
>>> assertEqual(record.record, party)
|
||||
>>> scenario.record_count
|
||||
1
|
||||
>>> scenario.record_count_blocked
|
||||
@@ -138,24 +138,19 @@ Check email sent::
|
||||
>>> from_, to, msg = smtp_calls.call_args[0]
|
||||
>>> smtp_calls.reset_mock()
|
||||
>>> msg = msg.get_payload(0).get_payload(decode=True).decode('utf-8')
|
||||
>>> to == [contact.value]
|
||||
True
|
||||
>>> re.search(r'Hello, (.*)!', msg).group(1) == party.name
|
||||
True
|
||||
>>> assertEqual(to, [contact.value])
|
||||
>>> assertEqual(re.search(r'Hello, (.*)!', msg).group(1), party.name)
|
||||
>>> open_url.shortened_url in msg
|
||||
True
|
||||
>>> open_url.record == record_activity
|
||||
True
|
||||
>>> assertEqual(open_url.record, record_activity)
|
||||
>>> open_url.method
|
||||
'marketing.automation.record.activity|on_email_opened'
|
||||
>>> click_url.shortened_url in msg
|
||||
True
|
||||
>>> click_url.record == record_activity
|
||||
True
|
||||
>>> assertEqual(click_url.record, record_activity)
|
||||
>>> click_url.method
|
||||
'marketing.automation.record.activity|on_email_clicked'
|
||||
>>> record.uuid in msg
|
||||
True
|
||||
>>> assertIn(record.uuid, msg)
|
||||
|
||||
>>> email, = Email.find([])
|
||||
>>> email.recipients
|
||||
@@ -164,10 +159,8 @@ Check email sent::
|
||||
'Hello'
|
||||
>>> email.resource == party
|
||||
True
|
||||
>>> email.marketing_automation_activity == root_activity
|
||||
True
|
||||
>>> bool(email.marketing_automation_record)
|
||||
True
|
||||
>>> assertEqual(email.marketing_automation_activity, root_activity)
|
||||
>>> assertTrue(email.marketing_automation_record)
|
||||
|
||||
Trigger open email and reminder after delay::
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Imports::
|
||||
>>> from proteus.config import get_config
|
||||
>>> from trytond.modules.company.tests.tools import create_company
|
||||
>>> from trytond.pyson import Eval, PYSONEncoder
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
Patch sendmail_transactional::
|
||||
@@ -84,8 +84,7 @@ Trigger scenario::
|
||||
>>> cron_process.click('run_once')
|
||||
|
||||
>>> record, = Record.find([])
|
||||
>>> record.record == sale
|
||||
True
|
||||
>>> assertEqual(record.record, sale)
|
||||
|
||||
Block and unsubscribe::
|
||||
|
||||
@@ -93,8 +92,7 @@ Block and unsubscribe::
|
||||
>>> bool(record.blocked)
|
||||
True
|
||||
>>> party.reload()
|
||||
>>> party.marketing_scenario_unsubscribed == [scenario]
|
||||
True
|
||||
>>> assertEqual(party.marketing_scenario_unsubscribed, [scenario])
|
||||
|
||||
Create a new sale::
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Imports::
|
||||
... set_fiscalyear_invoice_sequences)
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
|
||||
Activate modules::
|
||||
|
||||
@@ -107,8 +107,7 @@ Create an opportunity and convert to sale::
|
||||
>>> sale, = opportunity.click('convert')
|
||||
>>> opportunity.state
|
||||
'converted'
|
||||
>>> opportunity.sales == [sale]
|
||||
True
|
||||
>>> assertEqual(opportunity.sales, [sale])
|
||||
|
||||
Check and confirm sale::
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Party Erase Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
|
||||
Activate modules::
|
||||
|
||||
@@ -33,8 +33,7 @@ Create a party::
|
||||
Try erase active party::
|
||||
|
||||
>>> erase = Wizard('party.erase', models=[party])
|
||||
>>> erase.form.party == party
|
||||
True
|
||||
>>> assertEqual(erase.form.party, party)
|
||||
>>> erase.execute('erase')
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
@@ -46,8 +45,7 @@ Erase inactive party::
|
||||
>>> party.save()
|
||||
|
||||
>>> erase = Wizard('party.erase', models=[party])
|
||||
>>> erase.form.party == party
|
||||
True
|
||||
>>> assertEqual(erase.form.party, party)
|
||||
>>> erase.execute('erase')
|
||||
|
||||
Check fields have been erased::
|
||||
|
||||
@@ -5,7 +5,8 @@ Party Replace Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import (
|
||||
... activate_modules, assertEqual, assertFalse)
|
||||
|
||||
Activate modules::
|
||||
|
||||
@@ -35,8 +36,7 @@ Create a second party similar party::
|
||||
Replace the second by the first party::
|
||||
|
||||
>>> replace = Wizard('party.replace', models=[party2])
|
||||
>>> replace.form.source == party2
|
||||
True
|
||||
>>> assertEqual(replace.form.source, party2)
|
||||
>>> replace.form.destination = party1
|
||||
>>> replace.execute('replace')
|
||||
|
||||
@@ -45,13 +45,9 @@ Replace the second by the first party::
|
||||
False
|
||||
|
||||
>>> identifier2.reload()
|
||||
>>> identifier2.party == party1
|
||||
True
|
||||
>>> bool(identifier2.active)
|
||||
False
|
||||
>>> assertEqual(identifier2.party, party1)
|
||||
>>> assertFalse(identifier2.active)
|
||||
|
||||
>>> address2.reload()
|
||||
>>> address2.party == party1
|
||||
True
|
||||
>>> bool(address2.active)
|
||||
False
|
||||
>>> assertEqual(address2.party, party1)
|
||||
>>> assertFalse(address2.active)
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> import time
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
|
||||
@@ -111,11 +111,10 @@ Check cost history::
|
||||
>>> order = [('date', 'ASC')]
|
||||
>>> [c.cost_price for c in ProductCostHistory.find([], order=order)]
|
||||
[Decimal('100.0000'), Decimal('120.0000'), Decimal('110.0000')]
|
||||
>>> [c.date for c in ProductCostHistory.find([], order=order)] == [
|
||||
>>> assertEqual([c.date for c in ProductCostHistory.find([], order=order)], [
|
||||
... today - dt.timedelta(days=2),
|
||||
... today - dt.timedelta(days=1),
|
||||
... today]
|
||||
True
|
||||
... today])
|
||||
|
||||
Check cost price history on product::
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -192,8 +192,7 @@ Check invoice::
|
||||
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> line, = invoice.lines
|
||||
>>> line.product == service
|
||||
True
|
||||
>>> assertEqual(line.product, service)
|
||||
|
||||
Check stock moves::
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -179,8 +179,7 @@ Check invoice::
|
||||
|
||||
>>> invoice, = sale.invoices
|
||||
>>> line, = invoice.lines
|
||||
>>> line.product == service
|
||||
True
|
||||
>>> assertEqual(line.product, service)
|
||||
|
||||
Check shipment::
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
|
||||
@@ -129,8 +129,7 @@ Make a production::
|
||||
>>> production.product = product
|
||||
>>> production.bom = bom
|
||||
>>> production.quantity = 2
|
||||
>>> production.planned_start_date == yesterday
|
||||
True
|
||||
>>> assertEqual(production.planned_start_date, yesterday)
|
||||
>>> sorted([i.quantity for i in production.inputs])
|
||||
[10.0, 300.0]
|
||||
>>> output, = production.outputs
|
||||
@@ -168,14 +167,13 @@ Do the production::
|
||||
>>> production.click('run')
|
||||
>>> {i.state for i in production.inputs}
|
||||
{'done'}
|
||||
>>> {i.effective_date == today for i in production.inputs}
|
||||
{True}
|
||||
>>> for input_ in production.inputs:
|
||||
... assertEqual(input_.effective_date, today)
|
||||
>>> production.click('done')
|
||||
>>> output, = production.outputs
|
||||
>>> output.state
|
||||
'done'
|
||||
>>> output.effective_date == production.effective_date
|
||||
True
|
||||
>>> assertEqual(output.effective_date, production.effective_date)
|
||||
>>> output.unit_price
|
||||
Decimal('12.5000')
|
||||
>>> with config.set_context(locations=[storage.id]):
|
||||
@@ -195,14 +193,12 @@ Make a production with effective date yesterday and running the day before::
|
||||
>>> production.click('assign_try')
|
||||
>>> production.click('run')
|
||||
>>> production.reload()
|
||||
>>> {i.effective_date == before_yesterday for i in production.inputs}
|
||||
{True}
|
||||
>>> for input_ in production.inputs:
|
||||
... assertEqual(input_.effective_date, before_yesterday)
|
||||
>>> production.click('done')
|
||||
>>> production.reload()
|
||||
>>> output, = production.outputs
|
||||
>>> output.effective_date == yesterday
|
||||
True
|
||||
|
||||
>>> assertEqual(output.effective_date, yesterday)
|
||||
|
||||
Make a production with a bom of zero quantity::
|
||||
|
||||
@@ -232,5 +228,4 @@ Reschedule productions::
|
||||
>>> cron.interval_type = 'months'
|
||||
>>> cron.click('run_once')
|
||||
>>> production.reload()
|
||||
>>> production.planned_start_date == today
|
||||
True
|
||||
>>> assertEqual(production.planned_start_date, today)
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_chart, \
|
||||
@@ -107,8 +107,7 @@ Create Routing::
|
||||
>>> routing = Routing(name="Supplier")
|
||||
>>> routing.supplier = supplier
|
||||
>>> routing.supplier_service = service
|
||||
>>> routing.supplier_service_supplier == service_supplier
|
||||
True
|
||||
>>> assertEqual(routing.supplier_service_supplier, service_supplier)
|
||||
>>> routing.supplier_quantity = 2
|
||||
>>> routing.boms.append(bom)
|
||||
>>> routing.save()
|
||||
@@ -131,10 +130,8 @@ Make a production::
|
||||
>>> production.state
|
||||
'waiting'
|
||||
>>> purchase_line, = production.purchase_lines
|
||||
>>> purchase_line.product == service
|
||||
True
|
||||
>>> purchase_line.product_supplier == service_supplier
|
||||
True
|
||||
>>> assertEqual(purchase_line.product, service)
|
||||
>>> assertEqual(purchase_line.product_supplier, service_supplier)
|
||||
>>> purchase_line.quantity
|
||||
20.0
|
||||
>>> production.cost
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
|
||||
@@ -75,5 +75,4 @@ There is now a production request with the routing::
|
||||
|
||||
>>> Production = Model.get('production')
|
||||
>>> production, = Production.find([])
|
||||
>>> production.routing == routing
|
||||
True
|
||||
>>> assertEqual(production.routing, routing)
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
|
||||
@@ -186,16 +186,12 @@ Make a production::
|
||||
Test works::
|
||||
|
||||
>>> work1, work2 = production.works
|
||||
>>> work1.operation == operation1
|
||||
True
|
||||
>>> work1.work_center == center1
|
||||
True
|
||||
>>> assertEqual(work1.operation, operation1)
|
||||
>>> assertEqual(work1.work_center, center1)
|
||||
>>> work1.state
|
||||
'request'
|
||||
>>> work2.operation == operation2
|
||||
True
|
||||
>>> work2.work_center == center2
|
||||
True
|
||||
>>> assertEqual(work2.operation, operation2)
|
||||
>>> assertEqual(work2.work_center, center2)
|
||||
>>> work2.state
|
||||
'request'
|
||||
|
||||
@@ -220,23 +216,20 @@ Run works::
|
||||
>>> cycle1.click('run')
|
||||
>>> cycle1.state
|
||||
'running'
|
||||
>>> cycle1.run_by == employee
|
||||
True
|
||||
>>> assertEqual(cycle1.run_by, employee)
|
||||
>>> work1.reload()
|
||||
>>> work1.state
|
||||
'running'
|
||||
>>> cycle1.click('do')
|
||||
>>> cycle1.state
|
||||
'done'
|
||||
>>> cycle1.done_by == employee
|
||||
True
|
||||
>>> assertEqual(cycle1.done_by, employee)
|
||||
>>> work1.reload()
|
||||
>>> work1.state
|
||||
'finished'
|
||||
>>> cycle2 = work2.cycles.new()
|
||||
>>> cycle2.click('cancel')
|
||||
>>> cycle2.cancelled_by == employee
|
||||
True
|
||||
>>> assertEqual(cycle2.cancelled_by, employee)
|
||||
>>> cycle2.state
|
||||
'cancelled'
|
||||
>>> work2.reload()
|
||||
|
||||
@@ -5,7 +5,7 @@ Project Status Scenario
|
||||
Imports::
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company
|
||||
|
||||
Activate project::
|
||||
@@ -30,11 +30,9 @@ Create a project with a task::
|
||||
>>> Work = Model.get('project.work')
|
||||
|
||||
>>> project = Work(type='project', name="Project")
|
||||
>>> project.status == open
|
||||
True
|
||||
>>> assertEqual(project.status, open)
|
||||
>>> task = project.children.new(name="Task")
|
||||
>>> task.status == open
|
||||
True
|
||||
>>> assertEqual(task.status, open)
|
||||
|
||||
>>> project.save()
|
||||
>>> task, = project.children
|
||||
@@ -89,6 +87,5 @@ Re-open task::
|
||||
Copy the project::
|
||||
|
||||
>>> project_copy, = project.duplicate()
|
||||
>>> project_copy.status == open
|
||||
True
|
||||
>>> assertEqual(project_copy.status, open)
|
||||
>>> project_copy.progress
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -168,13 +168,11 @@ Purchase 5 products::
|
||||
>>> purchase.click('quote')
|
||||
>>> purchase.untaxed_amount, purchase.tax_amount, purchase.total_amount
|
||||
(Decimal('25.00'), Decimal('2.50'), Decimal('27.50'))
|
||||
>>> purchase.quoted_by == employee
|
||||
True
|
||||
>>> assertEqual(purchase.quoted_by, employee)
|
||||
>>> purchase.click('confirm')
|
||||
>>> purchase.untaxed_amount, purchase.tax_amount, purchase.total_amount
|
||||
(Decimal('25.00'), Decimal('2.50'), Decimal('27.50'))
|
||||
>>> purchase.confirmed_by == employee
|
||||
True
|
||||
>>> assertEqual(purchase.confirmed_by, employee)
|
||||
>>> purchase.state
|
||||
'processing'
|
||||
>>> purchase.shipment_state
|
||||
@@ -184,8 +182,7 @@ Purchase 5 products::
|
||||
>>> len(purchase.moves), len(purchase.shipment_returns), len(purchase.invoices)
|
||||
(2, 0, 1)
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> invoice.origins == purchase.rec_name
|
||||
True
|
||||
>>> assertEqual(invoice.origins, purchase.rec_name)
|
||||
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
|
||||
(Decimal('25.00'), Decimal('2.50'), Decimal('27.50'))
|
||||
|
||||
@@ -195,19 +192,15 @@ Invoice line must be linked to stock move::
|
||||
... invoice.lines, key=lambda l: l.quantity or 0)
|
||||
>>> stock_move1, stock_move2 = sorted(purchase.moves,
|
||||
... key=lambda m: m.quantity)
|
||||
>>> invoice_line1.stock_moves == [stock_move1]
|
||||
True
|
||||
>>> stock_move1.invoice_lines == [invoice_line1]
|
||||
True
|
||||
>>> invoice_line2.stock_moves == [stock_move2]
|
||||
True
|
||||
>>> stock_move2.invoice_lines == [invoice_line2]
|
||||
True
|
||||
>>> assertEqual(invoice_line1.stock_moves, [stock_move1])
|
||||
>>> assertEqual(stock_move1.invoice_lines, [invoice_line1])
|
||||
>>> assertEqual(invoice_line2.stock_moves, [stock_move2])
|
||||
>>> assertEqual(stock_move2.invoice_lines, [invoice_line2])
|
||||
|
||||
Check actual quantity::
|
||||
|
||||
>>> all(l.quantity == l.actual_quantity for l in purchase.lines)
|
||||
True
|
||||
>>> for line in purchase.lines:
|
||||
... assertEqual(line.quantity, line.actual_quantity)
|
||||
|
||||
Post invoice and check no new invoices::
|
||||
|
||||
@@ -269,8 +262,7 @@ Validate Shipments::
|
||||
... incoming_move = Move(id=move.id)
|
||||
... shipment.incoming_moves.append(incoming_move)
|
||||
>>> shipment.save()
|
||||
>>> shipment.origins == purchase.rec_name
|
||||
True
|
||||
>>> assertEqual(shipment.origins, purchase.rec_name)
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.click('done')
|
||||
>>> purchase.reload()
|
||||
@@ -296,10 +288,8 @@ Open supplier invoice::
|
||||
|
||||
Invoice lines must be linked to each stock moves::
|
||||
|
||||
>>> invoice_line1.stock_moves == [stock_move1]
|
||||
True
|
||||
>>> invoice_line2.stock_moves == [stock_move2]
|
||||
True
|
||||
>>> assertEqual(invoice_line1.stock_moves, [stock_move1])
|
||||
>>> assertEqual(invoice_line2.stock_moves, [stock_move2])
|
||||
|
||||
Check second invoices::
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
|
||||
@@ -44,8 +44,7 @@ Create a product with suppliers::
|
||||
>>> product, = template.products
|
||||
>>> product_supplier = product.product_suppliers.new()
|
||||
>>> product_supplier.party = supplier
|
||||
>>> product_supplier.template == template
|
||||
True
|
||||
>>> assertEqual(product_supplier.template, template)
|
||||
>>> product.save()
|
||||
|
||||
Supplier is copied when copying the template::
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_chart, get_accounts, create_tax)
|
||||
@@ -45,8 +45,7 @@ Create a purchase without product::
|
||||
|
||||
>>> purchase = Purchase(party=supplier)
|
||||
>>> line = purchase.lines.new()
|
||||
>>> line.taxes == [tax]
|
||||
True
|
||||
>>> assertEqual(line.taxes, [tax])
|
||||
>>> line.quantity = 1
|
||||
>>> line.unit_price = Decimal('100.0000')
|
||||
>>> purchase.click('quote')
|
||||
@@ -62,5 +61,4 @@ Check invoice::
|
||||
>>> invoice.total_amount
|
||||
Decimal('110.00')
|
||||
>>> line, = invoice.lines
|
||||
>>> line.account == accounts['expense']
|
||||
True
|
||||
>>> assertEqual(line.account, accounts['expense'])
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from decimal import Decimal
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -88,8 +88,7 @@ Create a sale with a line::
|
||||
Change the party::
|
||||
|
||||
>>> modify_header = purchase.click('modify_header')
|
||||
>>> modify_header.form.party == supplier
|
||||
True
|
||||
>>> assertEqual(modify_header.form.party, supplier)
|
||||
>>> modify_header.form.party = another
|
||||
>>> modify_header.execute('modify')
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -107,20 +107,18 @@ Check purchase reporting per supplier::
|
||||
>>> len(reports)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.supplier.id, r.number, r.expense) for r in reports) == \
|
||||
... sorted([(supplier1.id, 1, Decimal('30')),
|
||||
... (supplier2.id, 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.supplier.id, r.number, r.expense) for r in reports},
|
||||
... {(supplier1.id, 1, Decimal('30')),
|
||||
... (supplier2.id, 1, Decimal('10'))})
|
||||
>>> len(time_series)
|
||||
2
|
||||
>>> purchase1_ts_date = purchase1.purchase_date.replace(day=1)
|
||||
>>> purchase2_ts_date = purchase2.purchase_date.replace(day=1)
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.supplier.id, r.date, r.number, r.expense)
|
||||
... for r in time_series) == sorted(
|
||||
... [(supplier1.id, purchase1_ts_date, 1, Decimal('30')),
|
||||
... (supplier2.id, purchase2_ts_date, 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.supplier.id, r.date, r.number, r.expense)
|
||||
... for r in time_series},
|
||||
... {(supplier1.id, purchase1_ts_date, 1, Decimal('30')),
|
||||
... (supplier2.id, purchase2_ts_date, 1, Decimal('10'))})
|
||||
|
||||
Check purchase reporting per product without supplier::
|
||||
|
||||
@@ -139,15 +137,13 @@ Check purchase reporting per product with supplier::
|
||||
>>> len(reports)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.product.id, r.number, r.expense) for r in reports) == \
|
||||
... sorted([(product1.id, 1, Decimal('20')),
|
||||
... (product2.id, 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.product.id, r.number, r.expense) for r in reports},
|
||||
... {(product1.id, 1, Decimal('20')),
|
||||
... (product2.id, 1, Decimal('10'))})
|
||||
>>> len(time_series)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.product.id, r.date, r.number, r.expense)
|
||||
... for r in time_series) == sorted(
|
||||
... [(product1.id, purchase1_ts_date, 1, Decimal('20')),
|
||||
... (product2.id, purchase1_ts_date, 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.product.id, r.date, r.number, r.expense)
|
||||
... for r in time_series},
|
||||
... {(product1.id, purchase1_ts_date, 1, Decimal('20')),
|
||||
... (product2.id, purchase1_ts_date, 1, Decimal('10'))})
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -88,7 +88,6 @@ Return purchase using the wizard::
|
||||
>>> returned_purchase, = Purchase.find([
|
||||
... ('state', '=', 'draft'),
|
||||
... ])
|
||||
>>> returned_purchase.origin == purchase_to_return
|
||||
True
|
||||
>>> assertEqual(returned_purchase.origin, purchase_to_return)
|
||||
>>> sorted([x.quantity or 0 for x in returned_purchase.lines])
|
||||
[-1.0, 0]
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -101,8 +101,7 @@ Add an amendment::
|
||||
>>> line.action = 'payment_term'
|
||||
>>> line = amendment.lines.new()
|
||||
>>> line.action = 'party'
|
||||
>>> line.party == supplier1
|
||||
True
|
||||
>>> assertEqual(line.party, supplier1)
|
||||
>>> line.party = supplier2
|
||||
>>> line = amendment.lines.new()
|
||||
>>> line.action = 'warehouse'
|
||||
@@ -111,8 +110,7 @@ Add an amendment::
|
||||
>>> line = amendment.lines.new()
|
||||
>>> line.action = 'line'
|
||||
>>> line.line = purchase.lines[0]
|
||||
>>> line.product == product1
|
||||
True
|
||||
>>> assertEqual(line.product, product1)
|
||||
>>> line.product = product2
|
||||
>>> line.quantity
|
||||
5.0
|
||||
@@ -133,11 +131,9 @@ Validate amendment::
|
||||
>>> purchase.reload()
|
||||
>>> purchase.revision
|
||||
1
|
||||
>>> purchase.party == supplier2
|
||||
True
|
||||
>>> assertEqual(purchase.party, supplier2)
|
||||
>>> line = purchase.lines[0]
|
||||
>>> line.product == product2
|
||||
True
|
||||
>>> assertEqual(line.product, product2)
|
||||
>>> line.quantity
|
||||
4.0
|
||||
>>> line.unit_price
|
||||
@@ -149,15 +145,13 @@ Validate amendment::
|
||||
Decimal('46.00')
|
||||
|
||||
>>> move, = purchase.moves
|
||||
>>> move.product == product2
|
||||
True
|
||||
>>> assertEqual(move.product, product2)
|
||||
>>> move.quantity
|
||||
4.0
|
||||
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> line = invoice.lines[0]
|
||||
>>> line.product == product2
|
||||
True
|
||||
>>> assertEqual(line.product, product2)
|
||||
>>> line.quantity
|
||||
4.0
|
||||
>>> line.unit_price
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -109,8 +109,7 @@ Create purchase from blanket agreement::
|
||||
>>> purchase, = create_purchase.actions[0]
|
||||
|
||||
>>> line, = purchase.lines
|
||||
>>> line.product == product1
|
||||
True
|
||||
>>> assertEqual(line.product, product1)
|
||||
>>> line.quantity
|
||||
20.0
|
||||
>>> line.unit_price
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_chart, get_accounts)
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
@@ -96,8 +96,7 @@ Create purchase::
|
||||
>>> purchase_request.state
|
||||
'purchased'
|
||||
|
||||
>>> purchase_request.purchase_line.unit == gr
|
||||
True
|
||||
>>> assertEqual(purchase_request.purchase_line.unit, gr)
|
||||
>>> purchase_request.purchase_line.quantity
|
||||
100.0
|
||||
|
||||
@@ -123,7 +122,6 @@ Create purchase::
|
||||
>>> purchase_request.state
|
||||
'purchased'
|
||||
|
||||
>>> purchase_request.purchase_line.unit == gr
|
||||
True
|
||||
>>> assertEqual(purchase_request.purchase_line.unit, gr)
|
||||
>>> purchase_request.purchase_line.quantity
|
||||
1050.0
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import (create_chart,
|
||||
@@ -157,8 +157,7 @@ There is now a draft purchase request::
|
||||
|
||||
>>> set_user(purchase_user)
|
||||
>>> pr, = PurchaseRequest.find([('state', '=', 'draft')])
|
||||
>>> pr.product == product
|
||||
True
|
||||
>>> assertEqual(pr.product, product)
|
||||
>>> pr.quantity
|
||||
1.0
|
||||
|
||||
@@ -241,12 +240,10 @@ Create the purchase with a unique line::
|
||||
>>> len(purchase.lines)
|
||||
1
|
||||
>>> line, = purchase.lines
|
||||
>>> line.product == product
|
||||
True
|
||||
>>> assertEqual(line.product, product)
|
||||
>>> line.quantity
|
||||
2.0
|
||||
>>> line.unit == unit
|
||||
True
|
||||
>>> assertEqual(line.unit, unit)
|
||||
|
||||
Create a purchase request without product::
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -125,8 +125,7 @@ add another supplier::
|
||||
'draft'
|
||||
>>> create_quotation = Wizard(
|
||||
... 'purchase.request.quotation.create', [purchase_request])
|
||||
>>> [supplier] == create_quotation.form.suppliers
|
||||
True
|
||||
>>> assertEqual(create_quotation.form.suppliers, [supplier])
|
||||
>>> create_quotation.form.suppliers.append(Party(supplier2.id))
|
||||
>>> create_quotation.execute('create_quotations')
|
||||
>>> create_quotation.execute('end')
|
||||
@@ -205,8 +204,7 @@ best price from quotations was selected (supplier2 price)::
|
||||
>>> purchase, = Purchase.find([
|
||||
... ('state', '=', 'draft'),
|
||||
... ])
|
||||
>>> purchase.party == supplier2
|
||||
True
|
||||
>>> assertEqual(purchase.party, supplier2)
|
||||
>>> purchase.lines[0].unit_price
|
||||
Decimal('8.000')
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (create_company,
|
||||
... get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (create_chart,
|
||||
@@ -201,18 +201,14 @@ Create Purchase order from Request::
|
||||
>>> pr, = PurchaseRequest.find([('state', '=', 'draft')])
|
||||
>>> pr.state
|
||||
'draft'
|
||||
>>> pr.product == product
|
||||
True
|
||||
>>> pr.party == supplier
|
||||
True
|
||||
>>> assertEqual(pr.product, product)
|
||||
>>> assertEqual(pr.party, supplier)
|
||||
>>> pr.quantity
|
||||
2.0
|
||||
>>> pr.computed_quantity
|
||||
2.0
|
||||
>>> pr.supply_date == today
|
||||
True
|
||||
>>> pr.warehouse == warehouse_loc
|
||||
True
|
||||
>>> assertEqual(pr.supply_date, today)
|
||||
>>> assertEqual(pr.warehouse, warehouse_loc)
|
||||
>>> create_purchase = Wizard('purchase.request.create_purchase', [pr])
|
||||
>>> pr.state
|
||||
'purchased'
|
||||
@@ -308,10 +304,8 @@ Create purchase requisition with two different suppliers::
|
||||
>>> pr = PurchaseRequest.find([('state', '=', 'draft')])
|
||||
>>> len(pr)
|
||||
2
|
||||
>>> pr[0].party == supplier2
|
||||
True
|
||||
>>> pr[1].party == supplier
|
||||
True
|
||||
>>> assertEqual(pr[0].party, supplier2)
|
||||
>>> assertEqual(pr[1].party, supplier)
|
||||
>>> create_purchase = Wizard('purchase.request.create_purchase', pr)
|
||||
>>> purchase, = Purchase.find([
|
||||
... ('state', '=', 'draft'),
|
||||
|
||||
+5
-9
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -89,24 +89,20 @@ Create purchase from blanket agreement::
|
||||
|
||||
>>> create_purchase = Wizard(
|
||||
... 'purchase.blanket_agreement.create_purchase', [blanket_agreement])
|
||||
>>> create_purchase.form.lines[0].unit == gr
|
||||
True
|
||||
>>> assertEqual(create_purchase.form.lines[0].unit, gr)
|
||||
>>> create_purchase.execute('create_purchase')
|
||||
|
||||
>>> purchase, = create_purchase.actions[0]
|
||||
>>> line, = purchase.lines
|
||||
>>> line.product == product
|
||||
True
|
||||
>>> assertEqual(line.product, product)
|
||||
|
||||
>>> line.secondary_unit == gr
|
||||
True
|
||||
>>> assertEqual(line.secondary_unit, gr)
|
||||
>>> line.secondary_quantity
|
||||
800.0
|
||||
>>> line.secondary_unit_price
|
||||
Decimal('7.0000')
|
||||
|
||||
>>> line.unit == unit
|
||||
True
|
||||
>>> assertEqual(line.unit, unit)
|
||||
>>> line.quantity
|
||||
8.0
|
||||
>>> line.unit_price
|
||||
|
||||
+2
-3
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import (
|
||||
... create_company, get_company)
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
@@ -100,8 +100,7 @@ Create Purchase order from Request::
|
||||
>>> create_purchase.execute('start')
|
||||
>>> request.state
|
||||
'purchased'
|
||||
>>> request.purchase_line.unit == unit
|
||||
True
|
||||
>>> assertEqual(request.purchase_line.unit, unit)
|
||||
>>> request.purchase_line.quantity
|
||||
3.0
|
||||
>>> request.purchase_line.unit_price
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_chart, \
|
||||
@@ -123,8 +123,7 @@ Check secondary unit on invoice::
|
||||
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> line, = invoice.lines
|
||||
>>> line.secondary_unit == kg
|
||||
True
|
||||
>>> assertEqual(line.secondary_unit, kg)
|
||||
>>> line.secondary_quantity
|
||||
2.0
|
||||
>>> line.secondary_unit_price
|
||||
@@ -133,8 +132,7 @@ Check secondary unit on invoice::
|
||||
Check secondary unit on move::
|
||||
|
||||
>>> move, = purchase.moves
|
||||
>>> move.secondary_unit == kg
|
||||
True
|
||||
>>> assertEqual(move.secondary_unit, kg)
|
||||
>>> move.secondary_quantity
|
||||
2.0
|
||||
>>> move.secondary_unit_price
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
|
||||
@@ -82,8 +82,7 @@ Receive a single product line::
|
||||
>>> shipment.carrier = carrier
|
||||
>>> shipment.cost_used
|
||||
Decimal('3.0000')
|
||||
>>> shipment.cost_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_currency_used, company.currency)
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.state
|
||||
'received'
|
||||
|
||||
+2
-3
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -139,8 +139,7 @@ Receive a single product line::
|
||||
>>> shipment.carrier = carrier
|
||||
>>> shipment.cost_used
|
||||
Decimal('3.0000')
|
||||
>>> shipment.cost_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_currency_used, company.currency)
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.state
|
||||
'received'
|
||||
|
||||
+2
-3
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -150,8 +150,7 @@ Receive 4 products::
|
||||
>>> shipment.carrier = carrier
|
||||
>>> shipment.cost_used
|
||||
Decimal('3.0000')
|
||||
>>> shipment.cost_currency_used == company.currency
|
||||
True
|
||||
>>> assertEqual(shipment.cost_currency_used, company.currency)
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.state
|
||||
'received'
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.tests.tools import activate_modules, set_user
|
||||
>>> from trytond.tests.tools import activate_modules, set_user, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -160,13 +160,11 @@ Sale 5 products::
|
||||
>>> sale.click('quote')
|
||||
>>> sale.untaxed_amount, sale.tax_amount, sale.total_amount
|
||||
(Decimal('50.00'), Decimal('5.00'), Decimal('55.00'))
|
||||
>>> sale.quoted_by == employee
|
||||
True
|
||||
>>> assertEqual(sale.quoted_by, employee)
|
||||
>>> sale.click('confirm')
|
||||
>>> sale.untaxed_amount, sale.tax_amount, sale.total_amount
|
||||
(Decimal('50.00'), Decimal('5.00'), Decimal('55.00'))
|
||||
>>> sale.confirmed_by == employee
|
||||
True
|
||||
>>> assertEqual(sale.confirmed_by, employee)
|
||||
>>> sale.state
|
||||
'processing'
|
||||
>>> sale.shipment_state
|
||||
@@ -176,11 +174,9 @@ Sale 5 products::
|
||||
>>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices)
|
||||
(1, 0, 1)
|
||||
>>> invoice, = sale.invoices
|
||||
>>> invoice.origins == sale.rec_name
|
||||
True
|
||||
>>> assertEqual(invoice.origins, sale.rec_name)
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.origins == sale.rec_name
|
||||
True
|
||||
>>> assertEqual(shipment.origins, sale.rec_name)
|
||||
|
||||
Invoice line must be linked to stock move::
|
||||
|
||||
@@ -188,19 +184,15 @@ Invoice line must be linked to stock move::
|
||||
... invoice.lines, key=lambda l: l.quantity or 0)
|
||||
>>> stock_move1, stock_move2 = sorted(shipment.outgoing_moves,
|
||||
... key=lambda m: m.quantity or 0)
|
||||
>>> invoice_line1.stock_moves == [stock_move1]
|
||||
True
|
||||
>>> stock_move1.invoice_lines == [invoice_line1]
|
||||
True
|
||||
>>> invoice_line2.stock_moves == [stock_move2]
|
||||
True
|
||||
>>> stock_move2.invoice_lines == [invoice_line2]
|
||||
True
|
||||
>>> assertEqual(invoice_line1.stock_moves, [stock_move1])
|
||||
>>> assertEqual(stock_move1.invoice_lines, [invoice_line1])
|
||||
>>> assertEqual(invoice_line2.stock_moves, [stock_move2])
|
||||
>>> assertEqual(stock_move2.invoice_lines, [invoice_line2])
|
||||
|
||||
Check actual quantity::
|
||||
|
||||
>>> all(l.quantity == l.actual_quantity for l in sale.lines)
|
||||
True
|
||||
>>> for line in sale.lines:
|
||||
... assertEqual(line.quantity, line.actual_quantity)
|
||||
|
||||
Post invoice and check no new invoices::
|
||||
|
||||
@@ -288,10 +280,8 @@ Open customer invoice::
|
||||
|
||||
Invoice lines must be linked to each stock moves::
|
||||
|
||||
>>> invoice_line1.stock_moves == [stock_move1]
|
||||
True
|
||||
>>> invoice_line2.stock_moves == [stock_move2]
|
||||
True
|
||||
>>> assertEqual(invoice_line1.stock_moves, [stock_move1])
|
||||
>>> assertEqual(invoice_line2.stock_moves, [stock_move2])
|
||||
|
||||
Check second invoices::
|
||||
|
||||
@@ -356,8 +346,7 @@ Stock moves must be linked to invoice line::
|
||||
>>> stock_move, = shipment.outgoing_moves
|
||||
>>> stock_move.quantity
|
||||
4.0
|
||||
>>> stock_move.invoice_lines == [invoice_line]
|
||||
True
|
||||
>>> assertEqual(stock_move.invoice_lines, [invoice_line])
|
||||
|
||||
Ship 3 products::
|
||||
|
||||
@@ -634,8 +623,7 @@ Return sales using the wizard::
|
||||
>>> returned_sale, = Sale.find([
|
||||
... ('state', '=', 'draft'),
|
||||
... ])
|
||||
>>> returned_sale.origin == sale_to_return
|
||||
True
|
||||
>>> assertEqual(returned_sale.origin, sale_to_return)
|
||||
>>> sorted([x.quantity or 0 for x in returned_sale.lines])
|
||||
[-1.0, 0]
|
||||
|
||||
@@ -683,8 +671,7 @@ invoices::
|
||||
>>> sale.click('confirm')
|
||||
>>> invoice, = sale.invoices
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> invoice_line.stock_moves == []
|
||||
True
|
||||
>>> assertEqual(invoice_line.stock_moves, [])
|
||||
>>> invoice_line.quantity = 5.0
|
||||
>>> invoice.click('post')
|
||||
>>> pay = invoice.click('pay')
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_chart, get_accounts, create_tax)
|
||||
@@ -45,8 +45,7 @@ Create a sale without product::
|
||||
|
||||
>>> sale = Sale(party=customer)
|
||||
>>> line = sale.lines.new()
|
||||
>>> line.taxes == [tax]
|
||||
True
|
||||
>>> assertEqual(line.taxes, [tax])
|
||||
>>> line.quantity = 1
|
||||
>>> line.unit_price = Decimal('100.0000')
|
||||
>>> sale.click('quote')
|
||||
@@ -62,5 +61,4 @@ Check invoice::
|
||||
>>> invoice.total_amount
|
||||
Decimal('110.00')
|
||||
>>> line, = invoice.lines
|
||||
>>> line.account == accounts['revenue']
|
||||
True
|
||||
>>> assertEqual(line.account, accounts['revenue'])
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports::
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from decimal import Decimal
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -90,8 +90,7 @@ Create a sale with a line::
|
||||
Change the party::
|
||||
|
||||
>>> modify_header = sale.click('modify_header')
|
||||
>>> modify_header.form.party == customer
|
||||
True
|
||||
>>> assertEqual(modify_header.form.party, customer)
|
||||
>>> modify_header.form.party = another
|
||||
>>> modify_header.execute('modify')
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -164,18 +164,16 @@ Check sale reporting per customer::
|
||||
>>> len(reports)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.customer.id, r.number, r.revenue) for r in reports) == \
|
||||
... sorted([(customer1.id, 1, Decimal('30')),
|
||||
... (customer2.id, 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.customer.id, r.number, r.revenue) for r in reports},
|
||||
... {(customer1.id, 1, Decimal('30')),
|
||||
... (customer2.id, 1, Decimal('10'))})
|
||||
>>> len(time_series)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.customer.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series) == sorted(
|
||||
... [(customer1.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (customer2.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.customer.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series},
|
||||
... {(customer1.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (customer2.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))})
|
||||
|
||||
Check sale reporting per customer categories::
|
||||
|
||||
@@ -190,29 +188,26 @@ Check sale reporting per customer categories::
|
||||
>>> len(reports)
|
||||
3
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.category.id, r.number, r.revenue) for r in reports) == \
|
||||
... sorted([(party_category_child1.id, 1, Decimal('30')),
|
||||
... assertEqual({(r.category.id, r.number, r.revenue) for r in reports},
|
||||
... {(party_category_child1.id, 1, Decimal('30')),
|
||||
... (party_category_root2.id, 1, Decimal('30')),
|
||||
... (party_category_child2.id, 1, Decimal('10'))])
|
||||
True
|
||||
... (party_category_child2.id, 1, Decimal('10'))})
|
||||
>>> len(time_series)
|
||||
3
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.category.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series) == sorted(
|
||||
... [(party_category_child1.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... assertEqual({(r.category.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series},
|
||||
... {(party_category_child1.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (party_category_root2.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (party_category_child2.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))])
|
||||
True
|
||||
... (party_category_child2.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))})
|
||||
>>> len(tree)
|
||||
4
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.name, r.revenue) for r in tree) == sorted([
|
||||
... ('Root1', Decimal('40')),
|
||||
... assertEqual({(r.name, r.revenue) for r in tree},
|
||||
... {('Root1', Decimal('40')),
|
||||
... ('Child1', Decimal('30')),
|
||||
... ('Child2', Decimal('10')),
|
||||
... ('Root2', Decimal('30'))])
|
||||
True
|
||||
... ('Root2', Decimal('30'))})
|
||||
>>> child1, = CustomerCategoryTree.find([('rec_name', '=', 'Child1')])
|
||||
>>> child1.rec_name
|
||||
'Child1'
|
||||
@@ -227,19 +222,17 @@ Check sale reporting per product::
|
||||
>>> len(reports)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.product.id, r.number, r.revenue) for r in reports) == \
|
||||
... sorted([(product1.id, 2, Decimal('30')),
|
||||
... (product2.id, 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.product.id, r.number, r.revenue) for r in reports},
|
||||
... {(product1.id, 2, Decimal('30')),
|
||||
... (product2.id, 1, Decimal('10'))})
|
||||
>>> len(time_series)
|
||||
3
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.product.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series) == sorted(
|
||||
... [(product1.id, sale1.sale_date.replace(day=1), 1, Decimal('20')),
|
||||
... assertEqual({(r.product.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series},
|
||||
... {(product1.id, sale1.sale_date.replace(day=1), 1, Decimal('20')),
|
||||
... (product2.id, sale1.sale_date.replace(day=1), 1, Decimal('10')),
|
||||
... (product1.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))])
|
||||
True
|
||||
... (product1.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))})
|
||||
|
||||
Check sale reporting per product categories::
|
||||
|
||||
@@ -254,35 +247,32 @@ Check sale reporting per product categories::
|
||||
>>> len(reports)
|
||||
4
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.category.id, r.number, r.revenue) for r in reports) == \
|
||||
... sorted([(category_child1.id, 2, Decimal('30')),
|
||||
... assertEqual({(r.category.id, r.number, r.revenue) for r in reports},
|
||||
... {(category_child1.id, 2, Decimal('30')),
|
||||
... (category_root2.id, 2, Decimal('30')),
|
||||
... (category_child2.id, 1, Decimal('10')),
|
||||
... (account_category.id, 2, Decimal('40'))])
|
||||
True
|
||||
... (account_category.id, 2, Decimal('40'))})
|
||||
>>> len(time_series)
|
||||
7
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.category.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series) == sorted(
|
||||
... [(category_child1.id, sale1.sale_date.replace(day=1), 1, Decimal('20')),
|
||||
... assertEqual({(r.category.id, r.date, r.number, r.revenue)
|
||||
... for r in time_series},
|
||||
... {(category_child1.id, sale1.sale_date.replace(day=1), 1, Decimal('20')),
|
||||
... (category_root2.id, sale1.sale_date.replace(day=1), 1, Decimal('20')),
|
||||
... (category_child2.id, sale1.sale_date.replace(day=1), 1, Decimal('10')),
|
||||
... (category_child1.id, sale2.sale_date.replace(day=1), 1, Decimal('10')),
|
||||
... (category_root2.id, sale2.sale_date.replace(day=1), 1, Decimal('10')),
|
||||
... (account_category.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (account_category.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))])
|
||||
True
|
||||
... (account_category.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))})
|
||||
>>> len(tree)
|
||||
5
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.name, r.revenue) for r in tree) == sorted([
|
||||
... ('Root1', Decimal('40')),
|
||||
... assertEqual({(r.name, r.revenue) for r in tree},
|
||||
... {('Root1', Decimal('40')),
|
||||
... ('Child1', Decimal('30')),
|
||||
... ('Child2', Decimal('10')),
|
||||
... ('Root2', Decimal('30')),
|
||||
... ('Account Category', Decimal('40'))])
|
||||
True
|
||||
... ('Account Category', Decimal('40'))})
|
||||
>>> child1, = ProductCategoryTree.find([('rec_name', '=', 'Child1')])
|
||||
>>> child1.rec_name
|
||||
'Child1'
|
||||
@@ -311,16 +301,14 @@ Check sale reporting per countries::
|
||||
>>> len(country_time_series)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.country.id, r.date, r.number, r.revenue)
|
||||
... for r in country_time_series) == sorted(
|
||||
... [(country_us.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (country_us.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.country.id, r.date, r.number, r.revenue)
|
||||
... for r in country_time_series},
|
||||
... {(country_us.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (country_us.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))})
|
||||
>>> len(subdivision_time_series)
|
||||
2
|
||||
>>> with config.set_context(context=context):
|
||||
... sorted((r.subdivision.id, r.date, r.number, r.revenue)
|
||||
... for r in subdivision_time_series) == sorted(
|
||||
... [(california.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (new_york.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))])
|
||||
True
|
||||
... assertEqual({(r.subdivision.id, r.date, r.number, r.revenue)
|
||||
... for r in subdivision_time_series},
|
||||
... {(california.id, sale1.sale_date.replace(day=1), 1, Decimal('30')),
|
||||
... (new_york.id, sale2.sale_date.replace(day=1), 1, Decimal('10'))})
|
||||
|
||||
@@ -7,7 +7,7 @@ Imports::
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
@@ -135,8 +135,7 @@ As usual an invoice and a shipment has been created::
|
||||
|
||||
>>> invoice, = sale.invoices
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> invoice_line.account == revenue
|
||||
True
|
||||
>>> assertEqual(invoice_line.account, revenue)
|
||||
>>> invoice.total_amount
|
||||
Decimal('20.00')
|
||||
>>> len(sale.shipments)
|
||||
@@ -164,12 +163,10 @@ The advance payment invoice has been created::
|
||||
|
||||
>>> invoice, = sale.advance_payment_invoices
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> invoice_line.account == advance_payment_account
|
||||
True
|
||||
>>> assertEqual(invoice_line.account, advance_payment_account)
|
||||
>>> invoice.total_amount
|
||||
Decimal('10.00')
|
||||
>>> invoice.invoice_date == next_week
|
||||
True
|
||||
>>> assertEqual(invoice.invoice_date, next_week)
|
||||
>>> invoice.invoice_date = None
|
||||
>>> invoice.click('post')
|
||||
>>> sale.reload()
|
||||
@@ -199,16 +196,13 @@ Let's pay the advance payment invoice::
|
||||
2
|
||||
>>> il1, il2 = sorted([il for il in invoice.lines],
|
||||
... key=lambda il: 1 if il.product else 0)
|
||||
>>> il1.account == advance_payment_account
|
||||
True
|
||||
>>> assertEqual(il1.account, advance_payment_account)
|
||||
>>> il1.unit_price
|
||||
Decimal('10.00')
|
||||
>>> il1.taxes_date == today
|
||||
True
|
||||
>>> assertEqual(il1.taxes_date, today)
|
||||
>>> il1.quantity
|
||||
-1.0
|
||||
>>> il2.product == product
|
||||
True
|
||||
>>> assertEqual(il2.product, product)
|
||||
>>> il2.unit_price
|
||||
Decimal('20.0000')
|
||||
>>> il2.quantity
|
||||
@@ -256,8 +250,7 @@ Let's try to pack it::
|
||||
Let's pay the advance payment invoice::
|
||||
|
||||
>>> invoice, = sale.advance_payment_invoices
|
||||
>>> invoice.invoice_date == next_week
|
||||
True
|
||||
>>> assertEqual(invoice.invoice_date, next_week)
|
||||
>>> invoice.invoice_date = None
|
||||
>>> invoice.click('post')
|
||||
>>> pay = invoice.click('pay')
|
||||
@@ -316,8 +309,7 @@ There is no purchase request created yet::
|
||||
The advance payment invoice has been created, now pay it::
|
||||
|
||||
>>> invoice, = sale.advance_payment_invoices
|
||||
>>> invoice.invoice_date == next_week
|
||||
True
|
||||
>>> assertEqual(invoice.invoice_date, next_week)
|
||||
>>> invoice.invoice_date = None
|
||||
>>> invoice.click('post')
|
||||
>>> pay = invoice.click('pay')
|
||||
@@ -404,8 +396,7 @@ it::
|
||||
>>> _, inv_recreated = sale.advance_payment_invoices
|
||||
>>> inv_recreated.total_amount
|
||||
Decimal('10.00')
|
||||
>>> inv_recreated.invoice_date == next_week
|
||||
True
|
||||
>>> assertEqual(inv_recreated.invoice_date, next_week)
|
||||
>>> inv_recreated.invoice_date = None
|
||||
>>> inv_recreated.click('post')
|
||||
>>> pay = inv_recreated.click('pay')
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user