Skip to content

Commit

Permalink
[ADD] product_print_category : new module to set print categories on …
Browse files Browse the repository at this point in the history
…product and allow to print various format of labels
  • Loading branch information
legalsylvain committed Dec 9, 2022
1 parent b38f581 commit 2fe368b
Show file tree
Hide file tree
Showing 43 changed files with 1,432 additions and 0 deletions.
Empty file.
3 changes: 3 additions & 0 deletions product_print_category/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models
from . import wizard
from . import report
45 changes: 45 additions & 0 deletions product_print_category/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (C) 2012-Today GRAP (http://www.grap.coop)
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# Copyright (C) 2021-Today: Coop IT Easy (<http://coopiteasy.be/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# @author: Rémy TAYMANS (<[email protected]>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Product - Print Categories",
"summary": "Define print categories for products"
"and automate products print, when data has changed",
"version": "16.0.1.0.1",
"category": "Product",
"license": "AGPL-3",
"website": "https://github.com/OCA/product-attribute",
"maintainers": ["legalsylvain"],
"author": "GRAP, "
"La Louve, "
"Coop IT Easy SC, "
"Odoo Community Association (OCA)",
"depends": [
"sale_management",
"product",
],
"demo": [
"demo/res_groups.xml",
"demo/qweb_template.xml",
"demo/product_print_category.xml",
"demo/product_product.xml",
],
"data": [
"security/ir_module_category.xml",
"security/res_groups.xml",
"security/ir.model.access.csv",
"data/report_paperformat.xml",
"report/report_pricetag.xml",
"report/ir_actions_report.xml",
"wizard/view_product_print_wizard.xml",
"views/view_product_product.xml",
"views/view_product_template.xml",
"views/view_res_company.xml",
"views/view_product_print_category.xml",
],
"installable": True,
}
24 changes: 24 additions & 0 deletions product_print_category/data/report_paperformat.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="paper_format" model="report.paperformat">
<field name="name">Products Print Format</field>
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">5</field>
<field name="margin_bottom">5</field>
<field name="margin_left">2</field>
<field name="margin_right">2</field>
<field name="header_line" eval="False" />
<field name="header_spacing">10</field>
<field name="dpi">90</field>
</record>

</odoo>
32 changes: 32 additions & 0 deletions product_print_category/demo/product_print_category.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" ?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record model="product.print.category" id="demo_category_1">
<field name="name">Demo Category 1</field>
<field
name="product_ids"
eval="[(4, ref('product.product_product_4')),(4, ref('product.product_product_5'))]"
/>
<field name="qweb_view_id" ref="qweb_template_demo_1" />
<field
name="field_ids"
eval="[(4, ref('product.field_product_product__name')),(4, ref('product.field_product_product__list_price'))]"
/>
</record>

<record model="product.print.category" id="demo_category_2">
<field name="name">Demo Category 2</field>
<field name="product_ids" eval="[(4, ref('product.product_product_3'))]" />
<field name="qweb_view_id" ref="qweb_template_demo_2" />
<field
name="field_ids"
eval="[(4, ref('product.field_product_product__name')),(4, ref('product.field_product_product__list_price'))]"
/>
</record>

</odoo>
19 changes: 19 additions & 0 deletions product_print_category/demo/product_product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" ?>
<!--
Copyright (C) 2018-Today: GRAP (<http://www.grap.coop>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record model="product.product" id="demo_product_1">
<field name="name">Demo Product With Print category 1</field>
<field name="print_category_id" ref="demo_category_1" />
</record>

<record model="product.product" id="demo_product_2">
<field name="name">Demo Product With Print category 2</field>
<field name="print_category_id" ref="demo_category_2" />
</record>

</odoo>
61 changes: 61 additions & 0 deletions product_print_category/demo/qweb_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" ?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<template id="qweb_template_demo_1">
<t t-foreach="category_data['lines']" t-as="line">

<t t-foreach="line.quantity" t-as="q">
<div
style="border: 1px solid; background-color:#eee; display: inline-block; width: 200px; height: 100px; margin: 1em;"
>
<div>
<b><span t-field="line.product_id.name" /></b>
</div>
<div>
<t t-if="line.product_id.code">
<span style="color: #555;">Code:</span>
<span t-field="line.product_id.code" />
<br />
</t>
</div>
<div class="product_price">
<span style="color: #555;">Price:</span>
<span t-field="line.product_id.list_price" />
</div>
</div>
</t>
</t>
</template>

<template id="qweb_template_demo_2">
<t t-foreach="category_data['lines']" t-as="line">

<t t-foreach="line.quantity" t-as="q">
<div
style="border: 1px solid; background-color:#ee2; display: inline-block; width: 200px; height: 100px; margin: 1em;"
>
<div>
<b><span t-field="line.product_id.name" /></b>
</div>
<div>
<t t-if="line.product_id.code">
<span style="color: #555;">Code:</span>
<span t-field="line.product_id.code" />
<br />
</t>
</div>
<div class="product_price">
<span style="color: #555;">Price:</span>
<span t-field="line.product_id.list_price" />
</div>
</div>
</t>
</t>
</template>

</odoo>
25 changes: 25 additions & 0 deletions product_print_category/demo/res_groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record model="res.groups" id="sales_team.group_sale_manager">
<field name="users" eval="[(4, ref('base.user_admin'))]" />
</record>

<record model="res.groups" id="base.group_multi_company">
<field name="users" eval="[(4, ref('base.user_admin'))]" />
</record>

<record model="res.groups" id="base.group_no_one">
<field name="users" eval="[(4, ref('base.user_admin'))]" />
</record>

<record model="res.groups" id="manager">
<field name="users" eval="[(4, ref('base.user_admin'))]" />
</record>

</odoo>
Loading

0 comments on commit 2fe368b

Please sign in to comment.