Skip to content

Commit

Permalink
[ADD] beverage_distributor: add module for beverage distributor
Browse files Browse the repository at this point in the history
Odoo for Beverages Distributors
This industry package includes everything you need to run your company
efficiently with Odoo.

Discover everything you need to know about this package by visiting
the Knowledge App after installing it.

Basics
- Use the Inventory app as your central hub for managing stock,
consignments, and warehouse operations.
- Employ the Sales app to handle client orders and manage your product
catalog.
- Utilize the CRM to track leads, manage your sales pipeline, and
nurture client relationships.
- Use the Purchase app to order from suppliers and manage your supply
chain.
- Leverage the Point of Sale app for efficient B2C sales at your
distribution center.
- Streamline operations with the Barcode app for quick and accurate
inventory management.
- Expand your reach with a B2B eCommerce website for online ordering.
- Use the Contacts app to maintain a comprehensive database of clients
and suppliers.

Included customizations
- Additional fields on Product to manage deposit (Deposit product,
Quantity by deposit product, Unit sale product and Empty deposit
product)
- Auto-addition of taxes from Deposit product to main product.
- Auto-creation of a 00 reordering rule for each product selected in
the Unit sale product field, with manufacturing route.
- Auto-creation of a Bill of Material based on Unit sale product field.
This BOM will create as many units of the Unit sale product as
precised in the Quantity by deposit field from a single unit of the
main product.
- Additional "Auto-production" field on Bill of Material. This field
will ensure that any manufacture order for this Bill of Material will
be automatically produced.

task-4194448
  • Loading branch information
dhrs-odoo authored and vava-odoo committed Sep 30, 2024
1 parent 141b3cb commit c45c8e5
Show file tree
Hide file tree
Showing 103 changed files with 4,896 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ resource_name = bar_industry
replace_edited_strings = false
keep_translations = false

[o:odoo:p:odoo-18:r:beverage_distributor]
file_filter = beverage_distributor/i18n/<lang>.po
source_file = beverage_distributor/i18n/beverage_distributor.pot
type = PO
minimum_perc = 0
resource_name = beverage_distributor
replace_edited_strings = false
keep_translations = false

[o:odoo:p:odoo-18:r:bike_leasing]
file_filter = bike_leasing/i18n/<lang>.po
source_file = bike_leasing/i18n/bike_leasing.pot
Expand Down
Binary file modified bar_industry/images/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bar_industry/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions beverage_distributor/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
'name': 'Beverage Distributor',
'version': '1.0',
'category': 'Supply Chain',
'description': "",
'depends': [
'base_automation',
'calendar',
'knowledge',
'mrp',
'pos_loyalty',
'product_barcodelookup',
'sale_crm',
'sale_management',
'sale_purchase',
'sale_service',
'web_studio',
'website_crm',
'website_sale',
'website_sale_stock',
'theme_bistro',
],
'data': [
'data/product_category.xml',
'data/ir_attachment_pre.xml',
'data/ir_model_fields.xml',
'data/ir_ui_view.xml',
'data/ir_actions_server.xml',
'data/base_automation.xml',
'data/ir_default.xml',
'data/product_public_category.xml',
'data/pos_category.xml',
'data/account_tax.xml',
'data/product_template.xml',
'data/product_attribute.xml',
'data/product_attribute_value.xml',
'data/product_pricelist.xml',
'data/product_template_attribute_line.xml',
'data/product_template_attribute_value.xml',
'data/product_product.xml',
'data/product_template_package.xml',
'data/ptal.xml',
'data/knowledge_cover.xml',
'data/knowledge_article.xml',
'data/knowledge_article_favorite.xml',
'data/mail_message.xml',
'data/delivery_carrier.xml',
'data/ir_model_data.xml',
'data/ir_attachment_post.xml',
'data/pos_config.xml',
'data/res_config_settings.xml',
],
'demo': [
'demo/website.xml',
'demo/res_partner.xml',
'demo/crm_lead.xml',
'demo/product_template.xml',
'demo/product_supplierinfo.xml',
'demo/sale_order.xml',
'demo/sale_order_line.xml',
'demo/sale_order_confirm.xml',
'demo/website_attachment.xml',
'demo/website_view.xml',
'demo/website_theme_apply.xml',
'demo/website_page.xml',
'demo/website_menu.xml',
'demo/purchase_order.xml',
'demo/purchase_order_line.xml',
'demo/purchase_order_confirm.xml',
'demo/validate_deliveries.xml',
'demo/validate_receipts.xml',
'demo/stock_quant.xml',
'demo/mail_activity.xml',
'demo/delivery_carrier.xml',
'demo/payment_provider_demo_post.xml',
],
'license': 'OPL-1',
'author': 'Odoo S.A.',
'images': ['images/main.png'],
}
75 changes: 75 additions & 0 deletions beverage_distributor/data/account_tax.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id='deposit_tax_group' model='account.tax.group'>
<field name='name'>Deposit</field>
</record>

<record id="account_tax_01_sale" model="account.tax">
<field name="amount">0.1</field>
<field name="amount_type">fixed</field>
<field name="name">DEP 0.1</field>
<field name="type_tax_use">sale</field>
<field name="tax_group_id" ref="deposit_tax_group"/>
</record>
<record id="account_tax_21_sale" model="account.tax">
<field name="amount">2.1</field>
<field name="amount_type">fixed</field>
<field name="name">DEP 2.1</field>
<field name="type_tax_use">sale</field>
<field name="tax_group_id" ref="deposit_tax_group"/>
</record>
<record id="account_tax_24_sale" model="account.tax">
<field name="amount">2.4</field>
<field name="amount_type">fixed</field>
<field name="name">DEP 2.4</field>
<field name="type_tax_use">sale</field>
<field name="tax_group_id" ref="deposit_tax_group"/>
</record>
<record id="account_tax_45_sale" model="account.tax">
<field name="amount">4.5</field>
<field name="amount_type">fixed</field>
<field name="name">DEP 4.5</field>
<field name="type_tax_use">sale</field>
<field name="tax_group_id" ref="deposit_tax_group"/>
</record>
<record id="account_tax_01_purchase" model="account.tax">
<field name="amount">0.1</field>
<field name="amount_type">fixed</field>
<field name="name">DEP 0.1</field>
<field name="type_tax_use">purchase</field>
<field name="tax_group_id" ref="deposit_tax_group"/>
</record>
<record id="account_tax_24_purchase" model="account.tax">
<field name="amount">2.4</field>
<field name="amount_type">fixed</field>
<field name="name">DEP 2.4</field>
<field name="type_tax_use">purchase</field>
<field name="tax_group_id" ref="deposit_tax_group"/>
</record>
<record id="account_tax_45_purchase" model="account.tax">
<field name="amount">4.5</field>
<field name="amount_type">fixed</field>
<field name="name">DEP 4.5</field>
<field name="type_tax_use">purchase</field>
<field name="tax_group_id" ref="deposit_tax_group"/>
</record>

<record id='excises_tax_group' model='account.tax.group'>
<field name='name'>Excises</field>
</record>

<record id="account_tax_exc_coca_sale" model="account.tax">
<field name="amount">1.21</field>
<field name="amount_type">fixed</field>
<field name="name">EXC COCA</field>
<field name="type_tax_use">sale</field>
<field name="tax_group_id" ref="excises_tax_group"/>
</record>
<record id="account_tax_exc_21676_sale" model="account.tax">
<field name="amount">2.1676</field>
<field name="amount_type">fixed</field>
<field name="name">EXC 2.1676</field>
<field name="type_tax_use">sale</field>
<field name="tax_group_id" ref="excises_tax_group"/>
</record>
</odoo>
36 changes: 36 additions & 0 deletions beverage_distributor/data/base_automation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="auto_production" model="base.automation">
<field name="name">Auto Production</field>
<field name="action_server_ids" eval="[(6, 0, [ref('update_state')])]"/>
<field name="trigger_field_ids" eval="[(6, 0, [ref('mrp.field_mrp_production__state')])]"/>
<field name="model_id" ref="mrp.model_mrp_production"/>
<field name="trigger">on_state_set</field>
<field name="filter_domain">[('state', '=', 'confirmed')]</field>
<field name="filter_pre_domain">[("bom_id.x_auto_production", "=", True)]</field>
</record>
<record id="bom_automation" model="base.automation">
<field name="name">Automated BoM</field>
<field name="action_server_ids" eval="[(6, 0, [ref('bom_server_action')])]"/>
<field name="model_id" ref="product.model_product_template"/>
<field name="trigger_field_ids" eval="[(6, 0, [ref('field_empty_deposit'), ref('field_quantity_by_deposit_product'), ref('field_unit_sale_product')])]"/>
<field name="trigger">on_create_or_write</field>
</record>
<record id="update_sales_taxes" model="base.automation">
<field name="name">Update Taxes</field>
<field name="action_server_ids" eval="[(6, 0, [ref('update_sales_taxes_server_action')])]"/>
<field name="model_id" ref="product.model_product_template"/>
<field name="trigger_field_ids" eval="[(6, 0, [ref('field_deposit_product_1')])]"/>
<field name="filter_domain">[('x_is_a_deposit', '=', False)]</field>
<field name="trigger">on_create_or_write</field>
</record>
<record id="make_deposit_storable_delivery_invoice" model="base.automation">
<field name="name">Default fields for deposits</field>
<field name="action_server_ids" eval="[(6, 0, [ref('action_make_deposit_storable_delivery_invoice')])]"/>
<field name="model_id" ref="product.model_product_template"/>
<field name="trigger_field_ids" eval="[(6, 0, [ref('product.field_product_template__categ_id')])]"/>
<field name="on_change_field_ids" eval="[(6, 0, [ref('product.field_product_template__categ_id')])]"/>
<field name="filter_domain">[('x_is_a_deposit', '=', False)]</field>
<field name="trigger">on_change</field>
</record>
</odoo>
19 changes: 19 additions & 0 deletions beverage_distributor/data/delivery_carrier.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="product_product_delivery" model="product.product">
<field name="name">Take Away</field>
<field name="default_code">Delivery_008</field>
<field name="type">service</field>
<field name="categ_id" ref="delivery.product_category_deliveries"/>
<field name="sale_ok" eval="False"/>
<field name="purchase_ok" eval="False"/>
<field name="list_price">0.0</field>
</record>
<record id="delivery_carrier_1" model="delivery.carrier">
<field name="name">Take Away</field>
<field name="fixed_price">0.0</field>
<field name="sequence">1</field>
<field name="delivery_type">fixed</field>
<field name="product_id" ref="product_product_delivery"/>
</record>
</odoo>
81 changes: 81 additions & 0 deletions beverage_distributor/data/ir_actions_server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="bom_server_action" model="ir.actions.server">
<field name="code"><![CDATA[
if record.x_quantity_by_deposit_product == 1 and record.x_unit_sale_product.id:
raise UserError("Unit sale product should be undefined if this product can not be sold in a smaller unit.")
if record.x_unit_sale_product:
existing_bom = env['mrp.bom'].search([('product_tmpl_id', '=',record.x_unit_sale_product.product_tmpl_id.id)], limit=1)
reordering_rule = env['stock.warehouse.orderpoint'].search_count([('product_id', '=', record.x_unit_sale_product.id)], limit=1)
bom_vals = {
'product_qty': record.x_quantity_by_deposit_product,
'type': 'normal',
'x_parent_product': record.id,
'x_auto_production': True,
'bom_line_ids': [(5, 0), (0, 0, {
'product_id': record.product_variant_id.id,
'product_qty': 1,
})],
}
if record.x_deposit_product:
bom_vals['byproduct_ids'] = [(5, 0), (0, 0, {
'product_id': record.x_deposit_product.product_variant_id.id,
'product_qty': 1.0,
})]
if existing_bom:
existing_bom.write(bom_vals)
else:
bom_vals['product_tmpl_id'] = record.x_unit_sale_product.product_tmpl_id.id
env['mrp.bom'].create(bom_vals)
if not reordering_rule:
env['stock.warehouse.orderpoint'].create({
'product_id': record.x_unit_sale_product.id,
'x_parent_product': record.id,
'product_min_qty': 0,
'product_max_qty': 0,
'qty_multiple': record.x_quantity_by_deposit_product or 1,
'route_id': env.ref('mrp.route_warehouse0_manufacture').id,
'location_id': env.ref('stock.stock_location_stock').id,
})
else:
existing_bom = env['mrp.bom'].search([('x_parent_product', '=',record.id)], limit=1)
reordering_rule = env['stock.warehouse.orderpoint'].search([('x_parent_product', '=', record.id)], limit=1)
if existing_bom:
existing_bom.unlink()
if reordering_rule:
reordering_rule.unlink()
]]></field>
<field name="model_id" ref="product.model_product_template"/>
<field name="state">code</field>
<field name="name">Execute Code</field>
</record>
<record id="update_sales_taxes_server_action" model="ir.actions.server">
<field name="code"><![CDATA[
product_taxe = record.taxes_id.filtered(lambda t: t.tax_group_id.name != 'Deposit')
supplier_taxe = record.supplier_taxes_id.filtered(lambda t: t.tax_group_id.name != 'Deposit')
if record.x_deposit_product_1:
product_taxe += record.x_deposit_product_1.taxes_id
supplier_taxe += record.x_deposit_product_1.supplier_taxes_id
record['taxes_id'] = [(6, 0, (product_taxe).ids)]
record['supplier_taxes_id'] = [(6, 0, (supplier_taxe).ids)]
]]></field>
<field name="model_id" ref="product.model_product_template"/>
<field name="state">code</field>
<field name="name">Execute Code</field>
</record>
<record id="update_state" model="ir.actions.server">
<field name="child_ids" eval="[(6, 0, [ref('mrp.action_production_order_mark_done')])]"/>
<field name="model_id" ref="mrp.model_mrp_production"/>
<field name="state">multi</field>
<field name="name">Execute Existing Actions</field>
</record>
<record id="action_make_deposit_storable_delivery_invoice" model="ir.actions.server">
<field name="code"><![CDATA[
if record.x_is_a_deposit:
record.write({'invoice_policy':'delivery', 'type': 'consu', 'is_storable': True})
]]></field>
<field name="model_id" ref="product.model_product_template"/>
<field name="state">code</field>
<field name="name">Execute Code</field>
</record>
</odoo>
38 changes: 38 additions & 0 deletions beverage_distributor/data/ir_attachment_post.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="ir_attachment_1073" model="ir.attachment">
<field name="name">unsplash_r4UGyzh_8Ik_beers.jpg</field>
<field name="datas" type="base64" file="beverage_distributor/static/src/binary/ir_attachment/1073-unsplash_r4UGyzh_8Ik_beers.jpg"/>
<field name="url">/unsplash/r4UGyzh_8Ik/beers.jpg</field>
<field name="res_model">ir.ui.view</field>
<field name="website_id" ref="website.default_website"/>
</record>
<record id="ir_attachment_1074" model="ir.attachment">
<field name="name">unsplash_y2Vw5Tgtk5s_wines.jpg</field>
<field name="datas" type="base64" file="beverage_distributor/static/src/binary/ir_attachment/1074-unsplash_y2Vw5Tgtk5s_wines.jpg"/>
<field name="url">/unsplash/y2Vw5Tgtk5s/wines.jpg</field>
<field name="res_model">ir.ui.view</field>
<field name="website_id" ref="website.default_website"/>
</record>
<record id="ir_attachment_1075" model="ir.attachment">
<field name="name">unsplash_y2Vw5Tgtk5s_wines.webp</field>
<field name="datas" type="base64" file="beverage_distributor/static/src/binary/ir_attachment/1075-unsplash_y2Vw5Tgtk5s_wines.webp"/>
<field name="url">/unsplash/y2Vw5Tgtk5s/1075/wines.jpg</field>
<field name="res_model">ir.ui.view</field>
<field name="website_id" ref="website.default_website"/>
</record>
<record id="ir_attachment_1076" model="ir.attachment">
<field name="name">unsplash_r4UGyzh_8Ik_beers.webp</field>
<field name="datas" type="base64" file="beverage_distributor/static/src/binary/ir_attachment/1076-unsplash_r4UGyzh_8Ik_beers.webp"/>
<field name="url">/unsplash/r4UGyzh_8Ik/1076/beers.jpg</field>
<field name="res_model">ir.ui.view</field>
<field name="website_id" ref="website.default_website"/>
</record>
<record id="ir_attachment_1077" model="ir.attachment">
<field name="name">unsplash_7dpHzyA7rb8_beverages.webp</field>
<field name="datas" type="base64" file="beverage_distributor/static/src/binary/ir_attachment/1077-unsplash_7dpHzyA7rb8_beverages.webp"/>
<field name="url">/unsplash/7dpHzyA7rb8/1077/beverages.jpg</field>
<field name="res_model">ir.ui.view</field>
<field name="website_id" ref="website.default_website"/>
</record>
</odoo>
8 changes: 8 additions & 0 deletions beverage_distributor/data/ir_attachment_pre.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="ir_attachment_829" model="ir.attachment">
<field name="name">unsplash_7dpHzyA7rb8_.jpg</field>
<field name="datas" type="base64" file="beverage_distributor/static/src/binary/ir_attachment/1077-unsplash_7dpHzyA7rb8_beverages.webp"/>
<field name="url">/unsplash/7dpHzyA7rb8/.jpg</field>
</record>
</odoo>
7 changes: 7 additions & 0 deletions beverage_distributor/data/ir_default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="ir_default_1" model="ir.default">
<field name="field_id" ref="field_quantity_by_deposit_product"/>
<field name="json_value">"1"</field>
</record>
</odoo>
9 changes: 9 additions & 0 deletions beverage_distributor/data/ir_model_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="cloc_exclude_welcome_article_body" model="ir.model.data">
<field name="name">cloc_exclude_welcome_article_body</field>
<field name="model">ir.ui.view</field>
<field name="module">__cloc_exclude__</field>
<field name="res_id" eval="ref('welcome_article_body')"/>
</record>
</odoo>
Loading

0 comments on commit c45c8e5

Please sign in to comment.