mirror of
https://github.com/bringout/oca-ocb-mrp.git
synced 2026-04-26 00:52:05 +02:00
19.0 vanilla
This commit is contained in:
parent
accf5918df
commit
6e65e8c877
688 changed files with 225434 additions and 199401 deletions
|
|
@ -1,41 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.tests.common import Form, TransactionCase
|
||||
from odoo.tests import Form, TransactionCase
|
||||
|
||||
|
||||
class TestMrpSubcontractingCommon(TransactionCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestMrpSubcontractingCommon, cls).setUpClass()
|
||||
super().setUpClass()
|
||||
cls.env.ref('base.group_user').write({'implied_ids': [(4, cls.env.ref('stock.group_production_lot').id)]})
|
||||
# 1: Create a subcontracting partner
|
||||
main_partner = cls.env['res.partner'].create({'name': 'main_partner'})
|
||||
cls.subcontractor_partner1 = cls.env['res.partner'].create({
|
||||
'name': 'subcontractor_partner',
|
||||
'parent_id': main_partner.id,
|
||||
'company_id': cls.env.ref('base.main_company').id,
|
||||
})
|
||||
|
||||
# 2. Create a BOM of subcontracting type
|
||||
cls.product_category = cls.env.ref('product.product_category_goods')
|
||||
cls.comp1 = cls.env['product.product'].create({
|
||||
'name': 'Component1',
|
||||
'type': 'product',
|
||||
'categ_id': cls.env.ref('product.product_category_all').id,
|
||||
'is_storable': True,
|
||||
'categ_id': cls.product_category.id,
|
||||
})
|
||||
cls.comp2 = cls.env['product.product'].create({
|
||||
'name': 'Component2',
|
||||
'type': 'product',
|
||||
'categ_id': cls.env.ref('product.product_category_all').id,
|
||||
'is_storable': True,
|
||||
'categ_id': cls.product_category.id,
|
||||
})
|
||||
cls.finished = cls.env['product.product'].create({
|
||||
'name': 'finished',
|
||||
'type': 'product',
|
||||
'categ_id': cls.env.ref('product.product_category_all').id,
|
||||
'is_storable': True,
|
||||
'categ_id': cls.product_category.id,
|
||||
})
|
||||
bom_form = Form(cls.env['mrp.bom'])
|
||||
bom_form.type = 'subcontract'
|
||||
bom_form.consumption = 'strict'
|
||||
bom_form.product_tmpl_id = cls.finished.product_tmpl_id
|
||||
bom_form.subcontractor_ids.add(cls.subcontractor_partner1)
|
||||
with bom_form.bom_line_ids.new() as bom_line:
|
||||
|
|
@ -46,11 +43,16 @@ class TestMrpSubcontractingCommon(TransactionCase):
|
|||
bom_line.product_qty = 1
|
||||
cls.bom = bom_form.save()
|
||||
|
||||
cls.env['product.supplierinfo'].create({
|
||||
'product_tmpl_id': cls.finished.product_tmpl_id.id,
|
||||
'partner_id': cls.subcontractor_partner1.id,
|
||||
})
|
||||
|
||||
# Create a BoM for cls.comp2
|
||||
cls.comp2comp = cls.env['product.product'].create({
|
||||
'name': 'component for Component2',
|
||||
'type': 'product',
|
||||
'categ_id': cls.env.ref('product.product_category_all').id,
|
||||
'is_storable': True,
|
||||
'categ_id': cls.product_category.id,
|
||||
})
|
||||
bom_form = Form(cls.env['mrp.bom'])
|
||||
bom_form.product_tmpl_id = cls.comp2.product_tmpl_id
|
||||
|
|
@ -59,4 +61,20 @@ class TestMrpSubcontractingCommon(TransactionCase):
|
|||
bom_line.product_qty = 1
|
||||
cls.comp2_bom = bom_form.save()
|
||||
|
||||
cls.warehouse = cls.env['stock.warehouse'].search([], limit=1)
|
||||
def _setup_category_stock_journals(self):
|
||||
"""
|
||||
Sets up the all category with some stock accounts.
|
||||
"""
|
||||
a_val = self.env['account.account'].create([{
|
||||
'name': 'VALU Account',
|
||||
'code': '000003',
|
||||
'account_type': 'asset_current',
|
||||
}])
|
||||
stock_journal = self.env['account.journal'].create({
|
||||
'name': 'Stock Journal',
|
||||
'code': 'STJTEST',
|
||||
'type': 'general',
|
||||
})
|
||||
product_category_all = self.env.ref('product.product_category_goods')
|
||||
product_category_all.property_stock_valuation_account_id = a_val
|
||||
product_category_all.property_stock_journal = stock_journal
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -18,7 +18,7 @@ class TestSubcontractingPortalUi(HttpCase):
|
|||
'email': 'georges@project.portal',
|
||||
'signature': 'SignGeorges',
|
||||
'notification_type': 'email',
|
||||
'groups_id': [Command.set([cls.env.ref('base.group_portal').id])],
|
||||
'group_ids': [Command.set([cls.env.ref('base.group_portal').id])],
|
||||
})
|
||||
|
||||
cls.partner_portal = cls.env['res.partner'].with_context({'mail_create_nolog': True}).create({
|
||||
|
|
@ -30,16 +30,15 @@ class TestSubcontractingPortalUi(HttpCase):
|
|||
# 2. Create a BOM of subcontracting type
|
||||
cls.comp = cls.env['product.product'].create({
|
||||
'name': 'Component',
|
||||
'type': 'product',
|
||||
'is_storable': True,
|
||||
})
|
||||
|
||||
cls.finished_product = cls.env['product.product'].create({
|
||||
'name': 'Finished',
|
||||
'type': 'product',
|
||||
'is_storable': True,
|
||||
})
|
||||
bom_form = Form(cls.env['mrp.bom'])
|
||||
bom_form.type = 'subcontract'
|
||||
bom_form.consumption = 'warning'
|
||||
bom_form.subcontractor_ids.add(cls.partner_portal)
|
||||
bom_form.product_tmpl_id = cls.finished_product.product_tmpl_id
|
||||
with bom_form.bom_line_ids.new() as bom_line:
|
||||
|
|
@ -52,7 +51,7 @@ class TestSubcontractingPortalUi(HttpCase):
|
|||
picking_form = Form(self.env['stock.picking'])
|
||||
picking_form.picking_type_id = self.env.ref('stock.picking_type_in')
|
||||
picking_form.partner_id = self.partner_portal
|
||||
with picking_form.move_ids_without_package.new() as move:
|
||||
with picking_form.move_ids.new() as move:
|
||||
move.product_id = self.finished_product
|
||||
move.product_uom_qty = 2
|
||||
picking_receipt = picking_form.save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue