mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-24 06:52:05 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -3,3 +3,4 @@
|
|||
|
||||
from . import test_anglo_saxon_valuation
|
||||
from . import test_repair
|
||||
from . import test_rules_installation
|
||||
|
|
|
|||
|
|
@ -1,23 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from unittest import skip
|
||||
|
||||
from odoo.tests import Form, tagged
|
||||
from odoo.addons.stock_account.tests.test_anglo_saxon_valuation_reconciliation_common import ValuationReconciliationTestCommon
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
@skip('Temporary to fast merge new valuation')
|
||||
class TestAngloSaxonValuation(ValuationReconciliationTestCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref=None):
|
||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
cls.env.user.company_id.anglo_saxon_accounting = True
|
||||
|
||||
cls.fifo_product = cls.env['product.product'].create({
|
||||
'name': 'product',
|
||||
'type': 'product',
|
||||
'is_storable': True,
|
||||
'categ_id': cls.stock_account_product_categ.id,
|
||||
})
|
||||
|
||||
|
|
@ -25,13 +28,12 @@ class TestAngloSaxonValuation(ValuationReconciliationTestCommon):
|
|||
'name': 'Basic Accountman',
|
||||
'login': 'basic_accountman',
|
||||
'password': 'basic_accountman',
|
||||
'groups_id': [(6, 0, cls.env.ref('account.group_account_invoice').ids)],
|
||||
'group_ids': [(6, 0, cls.env.ref('account.group_account_invoice').ids)],
|
||||
})
|
||||
|
||||
def _make_in_move(self, product, quantity=1, unit_cost=None):
|
||||
unit_cost = unit_cost or product.standard_price
|
||||
move = self.env['stock.move'].create({
|
||||
'name': product.name,
|
||||
'product_id': product.id,
|
||||
'location_id': self.env.ref('stock.stock_location_suppliers').id,
|
||||
'location_dest_id': self.company_data['default_warehouse'].lot_stock_id.id,
|
||||
|
|
@ -40,12 +42,14 @@ class TestAngloSaxonValuation(ValuationReconciliationTestCommon):
|
|||
'price_unit': unit_cost,
|
||||
})
|
||||
move._action_confirm()
|
||||
move.quantity_done = quantity
|
||||
move.quantity = quantity
|
||||
move.picked = True
|
||||
move._action_done()
|
||||
return move
|
||||
|
||||
def test_inv_ro_with_auto_fifo_part(self):
|
||||
self.fifo_product.standard_price = 100
|
||||
self.fifo_product.taxes_id = False
|
||||
|
||||
self._make_in_move(self.fifo_product, unit_cost=10)
|
||||
self._make_in_move(self.fifo_product, unit_cost=25)
|
||||
|
|
@ -53,27 +57,24 @@ class TestAngloSaxonValuation(ValuationReconciliationTestCommon):
|
|||
ro = self.env['repair.order'].create({
|
||||
'product_id': self.product_a.id,
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_method': 'after_repair',
|
||||
'operations': [(0, 0, {
|
||||
'name': self.fifo_product.name,
|
||||
'type': 'add',
|
||||
'move_ids': [(0, 0, {
|
||||
'repair_line_type': 'add',
|
||||
'product_id': self.fifo_product.id,
|
||||
'price_unit': 1,
|
||||
'product_uom_qty': 1,
|
||||
})],
|
||||
})
|
||||
ro.action_repair_confirm()
|
||||
ro.action_validate()
|
||||
ro.action_repair_start()
|
||||
ro.action_repair_end()
|
||||
|
||||
wizard_ctx = {
|
||||
"active_model": 'repair_order',
|
||||
"active_ids": [ro.id],
|
||||
"active_id": ro.id
|
||||
}
|
||||
self.env['repair.order.make_invoice'].with_context(wizard_ctx).create({}).make_invoices()
|
||||
invoice = ro.invoice_id
|
||||
ro.sudo().action_create_sale_order()
|
||||
so = ro.sale_order_id
|
||||
so.sudo().action_confirm()
|
||||
self.assertEqual(so.order_line.qty_to_invoice, 1)
|
||||
|
||||
invoice = so._create_invoices()
|
||||
self.env.invalidate_all()
|
||||
self.env.flush_all()
|
||||
invoice.with_user(self.basic_accountman).action_post()
|
||||
|
||||
self.assertRecordValues(invoice.line_ids, [
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,21 @@
|
|||
from odoo.tests import common, tagged
|
||||
|
||||
|
||||
@tagged('at_install', '-post_install')
|
||||
class TestGlobalRouteRulesInstallation(common.TransactionCase):
|
||||
def test_rule_installation(self):
|
||||
company_id = self.env.ref('base.main_company').id
|
||||
rule = self.env['stock.rule'].search([
|
||||
('picking_type_id.code', '=', 'repair_operation'),
|
||||
('company_id', '=', company_id)
|
||||
])
|
||||
self.assertTrue(rule, "Stock Rule was not created")
|
||||
self.assertEqual(rule.procure_method, 'make_to_order', "Procure method is incorrect")
|
||||
self.assertEqual(rule.company_id.id, company_id, "Company ID is incorrect")
|
||||
self.assertEqual(rule.action, 'pull', "Action is incorrect")
|
||||
self.assertEqual(rule.auto, 'manual', "Auto is incorrect")
|
||||
self.assertEqual(rule.route_id.name, 'Replenish on Order (MTO)', "Route name is incorrect")
|
||||
self.assertEqual(rule.location_dest_id.name, 'Production', "Location dest ID is incorrect")
|
||||
self.assertEqual(rule.location_src_id.name, 'Stock', "Location src ID is incorrect")
|
||||
self.assertEqual(rule.picking_type_id.name, 'Repairs', "Picking type ID is incorrect")
|
||||
self.assertTrue(rule.active, "Rule is not active")
|
||||
Loading…
Add table
Add a link
Reference in a new issue