Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added missing test files #2

Open
wants to merge 6 commits into
base: 10.0-mi-sake_automatic_workflow_payment_mode-lmi
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions sale_automatic_workflow/tests/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# Copyright 2014 Camptocamp SA (author: Guewen Baconnier)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests import common


class TestAutomaticWorkflowBase(common.TransactionCase):

def create_sale_order(self, workflow, override=None):
sale_obj = self.env['sale.order']
partner_values = {'name': 'Imperator Caius Julius Caesar Divus'}
partner = self.env['res.partner'].create(partner_values)
product_values = {'name': 'Bread',
'list_price': 5,
'type': 'product'}
product = self.env['product.product'].create(product_values)
self.product_uom_unit = self.env.ref('product.product_uom_unit')
values = {
'partner_id': partner.id,
'order_line': [(0, 0, {
'name': product.name,
'product_id': product.id,
'product_uom': self.product_uom_unit.id,
'price_unit': product.list_price,
'product_uom_qty': 1})],
'workflow_process_id': workflow.id,
}
if override:
values.update(override)
return sale_obj.create(values)

def create_full_automatic(self, override=None):
workflow_obj = self.env['sale.workflow.process']
values = workflow_obj.create({
'name': 'Full Automatic',
'picking_policy': 'one',
'validate_order': True,
'validate_picking': True,
'create_invoice': True,
'validate_invoice': True,
'invoice_date_is_order_date': True,
})
if override:
values.update(override)
return values

def progress(self):
self.env['automatic.workflow.job'].run()
71 changes: 16 additions & 55 deletions sale_automatic_workflow/tests/test_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,16 @@
from datetime import datetime, timedelta

from odoo import fields
from odoo.tests import common
from odoo.addons.sale_automatic_workflow.tests.common import \
TestAutomaticWorkflowBase


class TestAutomaticWorkflow(common.TransactionCase):

def _create_sale_order(self, workflow, override=None):
sale_obj = self.env['sale.order']
partner_values = {'name': 'Imperator Caius Julius Caesar Divus'}
partner = self.env['res.partner'].create(partner_values)
product_values = {'name': 'Bread',
'list_price': 5,
'type': 'product'}
product = self.env['product.product'].create(product_values)
self.product_uom_unit = self.env.ref('product.product_uom_unit')
values = {
'partner_id': partner.id,
'order_line': [(0, 0, {
'name': product.name,
'product_id': product.id,
'product_uom': self.product_uom_unit.id,
'price_unit': product.list_price,
'product_uom_qty': 1})],
'workflow_process_id': workflow.id,
}
if override:
values.update(override)
return sale_obj.create(values)

def _create_full_automatic(self, override=None):
workflow_obj = self.env['sale.workflow.process']
values = workflow_obj.create({
'name': 'Full Automatic',
'picking_policy': 'one',
'validate_order': True,
'validate_picking': True,
'create_invoice': True,
'validate_invoice': True,
'invoice_date_is_order_date': True,
})
if override:
values.update(override)
return values

def progress(self):
self.env['automatic.workflow.job'].run()
class TestAutomaticWorkflow(TestAutomaticWorkflowBase):

def test_full_automatic(self):
workflow = self._create_full_automatic()
sale = self._create_sale_order(workflow)
workflow = self.create_full_automatic()
sale = self.create_sale_order(workflow)
sale._onchange_workflow_process_id()
self.assertEqual(sale.state, 'draft')
self.assertEqual(sale.workflow_process_id, workflow)
Expand All @@ -68,11 +29,11 @@ def test_full_automatic(self):
self.assertEqual(picking.state, 'done')

def test_onchange(self):
workflow = self._create_full_automatic()
sale = self._create_sale_order(workflow)
workflow = self.create_full_automatic()
sale = self.create_sale_order(workflow)
sale._onchange_workflow_process_id()
self.assertEqual(sale.picking_policy, 'one')
workflow2 = self._create_full_automatic(
workflow2 = self.create_full_automatic(
override={
'picking_policy': 'direct',
}
Expand All @@ -82,7 +43,7 @@ def test_onchange(self):
self.assertEqual(sale.picking_policy, 'direct')

def test_date_invoice_from_sale_order(self):
workflow = self._create_full_automatic()
workflow = self.create_full_automatic()
# date_order on sale.order is date + time
# date_invoice on account.invoice is date only
last_week_time = datetime.now() - timedelta(days=7)
Expand All @@ -91,7 +52,7 @@ def test_date_invoice_from_sale_order(self):
override = {
'date_order': last_week_time,
}
sale = self._create_sale_order(workflow, override=override)
sale = self.create_sale_order(workflow, override=override)
sale._onchange_workflow_process_id()
self.assertEqual(sale.date_order, last_week_time)
self.progress()
Expand All @@ -101,7 +62,7 @@ def test_date_invoice_from_sale_order(self):
self.assertEqual(invoice.workflow_process_id, sale.workflow_process_id)

def test_invoice_from_picking_with_service_product(self):
workflow = self._create_full_automatic()
workflow = self.create_full_automatic()
product_service = self.env.ref('product.service_order_01')
product_uom_hour = self.env.ref('product.product_uom_hour')
override = {
Expand All @@ -112,7 +73,7 @@ def test_invoice_from_picking_with_service_product(self):
'product_uom': product_uom_hour.id,
})],
}
sale = self._create_sale_order(workflow, override=override)
sale = self.create_sale_order(workflow, override=override)
sale._onchange_workflow_process_id()
self.progress()
self.assertFalse(sale.picking_ids)
Expand All @@ -126,18 +87,18 @@ def test_journal_on_invoice(self):
new_sale_journal = self.env['account.journal'].create({"name": "TTSA",
"code": "TTSA",
"type": "sale"})
workflow = self._create_full_automatic()
sale = self._create_sale_order(workflow)
workflow = self.create_full_automatic()
sale = self.create_sale_order(workflow)
sale._onchange_workflow_process_id()
self.progress()
self.assertTrue(sale.invoice_ids)
invoice = sale.invoice_ids
self.assertEqual(invoice.journal_id.id, sale_journal.id)

workflow = self._create_full_automatic(
workflow = self.create_full_automatic(
override={'property_journal_id': new_sale_journal.id},
)
sale = self._create_sale_order(workflow)
sale = self.create_sale_order(workflow)
sale._onchange_workflow_process_id()
self.progress()
self.assertTrue(sale.invoice_ids)
Expand Down
4 changes: 2 additions & 2 deletions sale_automatic_workflow_payment_mode/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

{'name': 'Sale Automatic Workflow - Payment Mode',
'version': '9.0.2.0.0',
'version': '10.0.1.0.0',
'author': 'Camptocamp,Sodexis,Odoo Community Association (OCA)',
'license': 'AGPL-3',
'category': 'Sales Management',
Expand All @@ -15,6 +15,6 @@
'views/account_payment_mode_views.xml',
'views/sale_workflow_process_view.xml',
],
'installable': False,
'installable': True,
'auto_install': True,
}
70 changes: 70 additions & 0 deletions sale_automatic_workflow_payment_mode/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_automatic_workflow_payment_mode
#
# Translators:
# OCA Transbot <[email protected]>, 2017
# Marc Tormo i Bochaca <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-25 02:52+0000\n"
"PO-Revision-Date: 2017-04-25 02:52+0000\n"
"Last-Translator: Marc Tormo i Bochaca <[email protected]>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model.fields,field_description:sale_automatic_workflow_payment_mode.field_account_payment_mode_workflow_process_id
msgid "Automatic Workflow"
msgstr ""

#. module: sale_automatic_workflow_payment_mode
#: model:ir.filters,name:sale_automatic_workflow_payment_mode.automatic_workflow_payment_filter
msgid "Automatic Workflow Payment Filter"
msgstr ""

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model.fields,field_description:sale_automatic_workflow_payment_mode.field_sale_workflow_process_payment_filter_id
msgid "Payment Filter"
msgstr ""

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model.fields,field_description:sale_automatic_workflow_payment_mode.field_sale_workflow_process_payment_filter_domain
msgid "Payment Filter Domain"
msgstr ""

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model,name:sale_automatic_workflow_payment_mode.model_account_payment_mode
msgid "Payment Modes"
msgstr "Formes de pagament "

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model.fields,field_description:sale_automatic_workflow_payment_mode.field_sale_workflow_process_register_payment
msgid "Register Payment"
msgstr ""

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model,name:sale_automatic_workflow_payment_mode.model_sale_workflow_process
msgid "Sale Workflow Process"
msgstr ""

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model,name:sale_automatic_workflow_payment_mode.model_sale_order
msgid "Sales Order"
msgstr "Comandes de venda"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.ui.view,arch_db:sale_automatic_workflow_payment_mode.sale_workflow_process_view_form
msgid "Set selection based on a search filter:"
msgstr ""

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model,name:sale_automatic_workflow_payment_mode.model_automatic_workflow_job
msgid "automatic.workflow.job"
msgstr ""
21 changes: 11 additions & 10 deletions sale_automatic_workflow_payment_mode/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
#
# Translators:
# OCA Transbot <[email protected]>, 2016
# Rudolf Schnapka <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-24 02:46+0000\n"
"PO-Revision-Date: 2016-08-24 02:46+0000\n"
"Last-Translator: OCA Transbot <[email protected]>, 2016\n"
"POT-Creation-Date: 2017-03-04 06:46+0000\n"
"PO-Revision-Date: 2017-03-04 06:46+0000\n"
"Last-Translator: Rudolf Schnapka <[email protected]>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -26,27 +27,27 @@ msgstr "Automatischer Workflow"
#. module: sale_automatic_workflow_payment_mode
#: model:ir.filters,name:sale_automatic_workflow_payment_mode.automatic_workflow_payment_filter
msgid "Automatic Workflow Payment Filter"
msgstr ""
msgstr "Automatischer Workflow Zahlungs-Eingrenzung"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model.fields,field_description:sale_automatic_workflow_payment_mode.field_sale_workflow_process_payment_filter_id
msgid "Payment Filter"
msgstr ""
msgstr "Zahlungseingrenzung"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model.fields,field_description:sale_automatic_workflow_payment_mode.field_sale_workflow_process_payment_filter_domain
msgid "Payment Filter Domain"
msgstr ""
msgstr "Zahlungseingrenzung Domäne"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model,name:sale_automatic_workflow_payment_mode.model_account_payment_mode
msgid "Payment Modes"
msgstr ""
msgstr "Zahlweise"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model.fields,field_description:sale_automatic_workflow_payment_mode.field_sale_workflow_process_register_payment
msgid "Register Payment"
msgstr ""
msgstr "Verbuche Zahlung"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model,name:sale_automatic_workflow_payment_mode.model_sale_workflow_process
Expand All @@ -61,9 +62,9 @@ msgstr "Verkaufsauftrag"
#. module: sale_automatic_workflow_payment_mode
#: model:ir.ui.view,arch_db:sale_automatic_workflow_payment_mode.sale_workflow_process_view_form
msgid "Set selection based on a search filter:"
msgstr ""
msgstr "Setze Auswahl gemäß Suchfilter:"

#. module: sale_automatic_workflow_payment_mode
#: model:ir.model,name:sale_automatic_workflow_payment_mode.model_automatic_workflow_job
msgid "automatic.workflow.job"
msgstr ""
msgstr "automatic.workflow.job"
Loading