mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 17:31:59 +02:00
Initial commit: Sale packages
This commit is contained in:
commit
14e3d26998
6469 changed files with 2479670 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': "Sale Mrp Margin",
|
||||
'category': 'Sales/Sales',
|
||||
'version': '0.1',
|
||||
'description': 'Handle BoM prices to compute sale margin.',
|
||||
'depends': ['sale_mrp', 'sale_stock_margin'],
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-02-06 13:32+0000\n"
|
||||
"PO-Revision-Date: 2024-02-06 13:32+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_sale_mrp_flow
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.addons.sale_mrp.tests import test_sale_mrp_flow
|
||||
from odoo.tests import common, Form
|
||||
|
||||
|
||||
@common.tagged('post_install', '-at_install')
|
||||
class TestSaleMrpFlow(test_sale_mrp_flow.TestSaleMrpFlowCommon):
|
||||
|
||||
def test_kit_cost_calculation(self):
|
||||
""" Check that the average cost price is computed correctly after SO confirmation:
|
||||
BOM 1:
|
||||
- 1 unit of “super kit”:
|
||||
- 2 units of “component a”
|
||||
BOM 2:
|
||||
- 1 unit of “component a”:
|
||||
- 3 units of "component b"
|
||||
1 unit of "component b" = $10
|
||||
1 unit of "super kit" = 2 * 3 * $10 = *$60
|
||||
"""
|
||||
super_kit = self._cls_create_product('Super Kit', self.uom_unit)
|
||||
(super_kit + self.component_a + self.component_b).categ_id.property_cost_method = 'average'
|
||||
self.env['mrp.bom'].create({
|
||||
'product_tmpl_id': self.component_a.product_tmpl_id.id,
|
||||
'product_qty': 1.0,
|
||||
'type': 'phantom',
|
||||
'bom_line_ids': [(0, 0, {
|
||||
'product_id': self.component_b.id,
|
||||
'product_qty': 3.0,
|
||||
})]
|
||||
})
|
||||
self.env['mrp.bom'].create({
|
||||
'product_tmpl_id': super_kit.product_tmpl_id.id,
|
||||
'product_qty': 1.0,
|
||||
'type': 'phantom',
|
||||
'bom_line_ids': [(0, 0, {
|
||||
'product_id': self.component_a.id,
|
||||
'product_qty': 2.0,
|
||||
})]
|
||||
})
|
||||
self.component_b.standard_price = 10
|
||||
self.component_a.button_bom_cost()
|
||||
super_kit.button_bom_cost()
|
||||
so_form = Form(self.env['sale.order'])
|
||||
so_form.partner_id = self.partner_a
|
||||
with so_form.order_line.new() as line:
|
||||
line.product_id = super_kit
|
||||
so = so_form.save()
|
||||
self.assertEqual(so.order_line.purchase_price, 60)
|
||||
so.action_confirm()
|
||||
self.assertEqual(so.order_line.purchase_price, 60)
|
||||
Loading…
Add table
Add a link
Reference in a new issue