Skip to content

Commit

Permalink
[IMP] mrp_food_menu documentation and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinDupont committed Feb 28, 2025
1 parent 74bdd10 commit c15bb47
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 107 deletions.
10 changes: 6 additions & 4 deletions mrp_food_menu/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@

{
"name": "MRP Food Menu",
"summary": "todo",
"version": "16.0.1.0.1",
"summary": "Base model to create Menu and its components.",
"version": "16.0.1.0.0",
"category": "GRAP - Custom",
"author": "GRAP",
"website": "https://github.com/grap/grap-odoo-custom",
"license": "AGPL-3",
"depends": [
"mrp",
"account",
# OCA
# GRAP
],
"demo": [
"demo/product_product.xml",
"demo/mrp_food_menu.xml",
],
"data": [
"security/ir_rule.xml",
Expand Down
25 changes: 25 additions & 0 deletions mrp_food_menu/demo/mrp_food_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2025 - Today: GRAP (http://www.grap.coop)
@author: Quentin DUPONT ([email protected])
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo noupdate="1">

<record model="mrp.food.menu" id="demo_menu_french_revolution">
<field name="name">Menu to celebrate French New Revolution</field>
</record>

<record model="mrp.food.menu.line" id="demo_menu_revolution_houmous">
<field name="menu_id" ref="demo_menu_french_revolution"/>
<field name="product_id" ref="mrp_food_menu.demo_houmous"/>
<field name="product_uom_qty">2</field>
</record>

<record model="mrp.food.menu.line" id="demo_menu_revolution_quiche">
<field name="menu_id" ref="demo_menu_french_revolution"/>
<field name="product_id" ref="mrp_food_menu.demo_quiche"/>
<field name="product_uom_qty">3</field>
</record>

</odoo>
27 changes: 27 additions & 0 deletions mrp_food_menu/demo/product_product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2025 - Today: GRAP (http://www.grap.coop)
@author: Quentin DUPONT ([email protected])
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo noupdate="1">

<record model="product.product" id="demo_houmous">
<field name="name">Houmous</field>
<field name="uom_id" ref="uom.product_uom_gram" />
<field name="uom_po_id" ref="uom.product_uom_gram" />
<field name="weight">0.410</field>
<field name="standard_price">1.97</field>
<field name="list_price">2.70</field>
</record>

<record model="product.product" id="demo_quiche">
<field name="name">Quiche</field>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
<field name="weight">0.600</field>
<field name="standard_price">5</field>
<field name="list_price">12</field>
</record>

</odoo>
24 changes: 4 additions & 20 deletions mrp_food_menu/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
Quickly manage sales and linked manufacturing orders.
For example : a Week Production for a Bakery based on its Grocery sales.
Base model to create Menu, its components, add section (like Main meal, Dessert etc.)
You can choose BoM linked to products.

.. figure:: ../static/description/mrp_sale_grouped.png
.. figure:: ../static/description/mrp_food_menu.jpeg

1 : Choose or create sales
2 : Act on sales : adjust quantities with Matrix2D view, and confirme
all at once
3 : Quick buttons : Products without BoM, Sales, Manufacturing Orders
4 : Print PDF that sum up sales by product and sale
5 : Act on Manufacturing Orders
6 : Handle your production with wizard assistant, you can handle what components
you have to buy, intermediate and finished products you have to produce.
See dedicated module mrp_wizard_production

.. figure:: ../static/description/report_sales_sum_up.png
.. figure:: ../static/description/mrp_sale_grouped_sales_matrix2d.png
.. figure:: ../static/description/mrp_sale_grouped.jpeg

Quickly see what's going on for your sales and production on tree view

.. figure:: ../static/description/mrp_sale_grouped_tree_view.jpeg
This module is a base for other module (handling sales, production, tags, allergens etc.)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion mrp_food_menu/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import test_mrp_sale_grouped
from . import test_food_menu
41 changes: 41 additions & 0 deletions mrp_food_menu/tests/test_food_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (C) 2023 - Today: GRAP (http://www.grap.coop)
# @author: Quentin DUPONT ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase


class TestFoodMenu(TransactionCase):
def setUp(self):
super().setUp()
# Objects
self.food_menu_obj = self.env["mrp.food.menu"]
self.food_menu_line_obj = self.env["mrp.food.menu.line"]
self.product_product_obj = self.env["product.product"]
self.mrp_bom_obj = self.env["mrp.bom"]
# Datas
self.uom_kg = self.env.ref("uom.product_uom_kgm")
self.uom_unit = self.env.ref("uom.product_uom_unit")
# Demo datas
self.menu_revolution = self.env.ref("mrp_food_menu.demo_menu_french_revolution")
# Creating Products
self.product_seitan_bourguignon = self.product_product_obj.create(
{
"name": "Seitan bourguignon",
"type": "product",
"uom_id": self.uom_kg.id,
"uom_po_id": self.uom_kg.id,
}
)

def test_01_get_menu_info(self):
self.assertEqual(self.menu_revolution.product_wo_bom_qty, 2)

self.food_menu_line_obj.create(
{
"menu_id": self.menu_revolution.id,
"product_id": self.product_seitan_bourguignon.id,
"product_uom_qty": 3,
}
)
self.assertEqual(self.menu_revolution.product_wo_bom_qty, 3)
62 changes: 0 additions & 62 deletions mrp_food_menu/tests/test_mrp_sale_grouped.py

This file was deleted.

2 changes: 1 addition & 1 deletion mrp_food_menu_tag/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"depends": [
"mrp",
],
"demo": ["demo/mrp_food_menu.xml", "demo/mrp_food_menu_tag.xml"],
"demo": ["demo/mrp_food_menu_tag.xml"],
"data": [
"security/ir_rule.xml",
"security/ir.model.access.csv",
Expand Down
14 changes: 0 additions & 14 deletions mrp_food_menu_tag/demo/mrp_food_menu.xml

This file was deleted.

4 changes: 2 additions & 2 deletions mrp_food_menu_tag/demo/mrp_food_menu_tag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright (C) 2025 - Today: GRAP (http://www.grap.coop)
@author: Quentin DUPONT ([email protected])
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<odoo noupdate="1">

<record model="mrp.food.menu.tag" id="demo_tag_ecological">
<field name="name">Ecological</field>
Expand All @@ -17,7 +17,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="parent_id" ref="mrp_food_menu_tag.demo_tag_ecological" />
<field
name="food_menu_ids"
eval="[(4, ref('mrp_food_menu_tag.demo_menu_french_revolution')),]"
eval="[(4, ref('mrp_food_menu.demo_menu_french_revolution')),]"
/>
</record>

Expand Down
4 changes: 1 addition & 3 deletions mrp_food_menu_tag/tests/test_food_menu_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def setUp(self):
self.tag_parent = self.env.ref("mrp_food_menu_tag.demo_tag_ecological")
self.tag_vegan = self.env.ref("mrp_food_menu_tag.demo_tag_vegan")
self.tag_halal = self.env.ref("mrp_food_menu_tag.demo_tag_halal")
self.menu_revolution = self.env.ref(
"mrp_food_menu_tag.demo_menu_french_revolution"
)
self.menu_revolution = self.env.ref("mrp_food_menu.demo_menu_french_revolution")

def test_01_bom_qty(self):
self.assertEqual(
Expand Down

0 comments on commit c15bb47

Please sign in to comment.