Initial commit

This commit is contained in:
gsinghpal
2026-02-22 01:22:18 -05:00
commit 5200d5baf0
2394 changed files with 386834 additions and 0 deletions

View File

@@ -0,0 +1,215 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="print_product_label_section_view_form" model="ir.ui.view">
<field name="name">print.product.label.section.view.form</field>
<field name="model">print.product.label.section</field>
<field name="arch" type="xml">
<form>
<sheet>
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" invisible="active"/>
<field name="template_preview_html" class="oe_avatar" invisible="not preview"/>
<div class="oe_title">
<h1><div class="d-flex">
<field name="display_name" class="text-break"/>
</div></h1>
</div>
<div name="options">
<div class="d-inline-block">
<label for="preview" class="mr8"/>
<field name="preview" widget="boolean_toggle"/>
<button name="action_pdf_preview" type="object" string="PDF Preview" icon="fa-file-pdf-o" class="border btn btn-sm btn-light ms-2"/>
</div>
</div>
<field name="active" invisible="1"/> <!-- Technical field for the web ribbon -->
<field name="field_ttype" invisible="1"/> <!-- Technical field for domain -->
<field name="field_ids" invisible="1"/> <!-- Technical field for domain " TODO: remove ? -->
<field name="relation_model_id" invisible="1"/> <!-- Technical field for domain -->
<field name="relation_field_ttype" invisible="1"/> <!-- Technical field for domain -->
<field name="nested_relation_model_id" invisible="1"/> <!-- Technical field for domain -->
<group>
<group string="Data">
<field name="type" />
<field name="value" invisible="type != 'text'"/>
<field name="image" invisible="type != 'image'" required="type == 'image'"/>
<field name="field_id"
invisible="type != 'field'"
options="{'no_open': True, 'no_create': True}"/>
<label for="relation_field_id" invisible="type != 'field' or type == 'field' and field_ttype not in ['many2one', 'many2many', 'one2many']" required="type == 'field' and field_ttype in ['many2one', 'many2many', 'one2many']"/>
<div class="o_row" invisible="type != 'field' or type == 'field' and field_ttype not in ['many2one', 'many2many', 'one2many']" required="type == 'field' and field_ttype in ['many2one', 'many2many', 'one2many']">
<field name="relation_field_id"
domain="[('model_id', '=', relation_model_id), ('ttype', 'in', ['binary', 'char', 'text', 'html', 'selection', 'float', 'monetary', 'integer', 'date', 'datetime', 'many2one'])]"
options="{'no_open': True, 'no_create': True}"/>
<field name="nested_relation_field_id"
invisible="type != 'field' or type == 'field' and relation_field_ttype not in ['many2one']"
required="type == 'field' and relation_field_ttype in ['many2one']"
domain="[('model_id', '=', nested_relation_model_id), ('ttype', 'in', ['binary', 'char', 'text', 'html', 'selection', 'float', 'monetary', 'integer', 'date', 'datetime'])]"
options="{'no_open': True, 'no_create': True}"/>
</div>
<!-- Options for section types -->
<field name="currency_position" invisible="type not in ['price', 'promo_price', 'multi_price']"/>
<field name="multi_price_order" string="Order" invisible="type != 'multi_price'"/>
<field name="multi_price_limit" string="Limit" invisible="type != 'multi_price'"/>
<field name="with_product_attribute_name" widget="boolean_toggle" invisible="type != 'product_attributes'"/>
<field name="attribute_ids" widget="many2many_tags" invisible="type != 'product_attributes'" options="{'no_open': True, 'no_create': True}"/>
</group>
<group string="Design">
<field name="height"/>
<field name="position"/>
<label for="width" invisible="position == 'none'"/>
<div class="o_row" invisible="position == 'none'">
<field name="width" required="position != 'none'"/>
<field name="width_measure" />
</div>
<label for="widget" invisible="type not in ['text', 'field', 'product_attributes']"/>
<div class="o_row" invisible="type not in ['text', 'field', 'product_attributes']">
<field name="widget"/>
<label for="barcode_is_humanreadable" string="human-readable" invisible="widget != 'barcode'" class="ms-2"/>
<field name="barcode_is_humanreadable" widget="boolean_toggle" invisible="widget != 'barcode'"/>
<label for="barcode_symbology" string="type" invisible="widget != 'barcode'" class="ms-1"/>
<field name="barcode_symbology" widget="selection" invisible="widget != 'barcode'"/>
</div>
</group>
</group>
<notebook>
<page string="Text" name="text_setting">
<group>
<group>
<field name="align" widget="radio" options="{'horizontal': true}"/>
<field name="font_weight" widget="radio" options="{'horizontal': true}"/>
<field name="font_name" string="Font"/>
<small class="o_row alert alert-info" colspan="2" role="alert" invisible="not font_name">Note: Fonts are not applied on the sample label. Use the PDF Preview to see the actual generated labels.</small>
<label for="font_size"/>
<div class="o_row">
<field name="font_size" />
<field name="font_size_measure" />
</div>
<field name="line_height"/>
<field name="letter_spacing"/>
<field name="text_color" string="Color" widget="color"/>
</group>
<group>
<field name="value_format" invisible="type not in ['field', 'price', 'promo_price', 'multi_price'] or widget != False"/>
<field name="text_decoration"/>
<separator string="URL values" colspan="2"/>
<field name="make_url_absolute" widget="boolean_toggle" invisible="type not in ['text', 'field']"/>
<field name="shorten_url" widget="boolean_toggle" invisible="type not in ['text', 'field']"/>
</group>
</group>
</page>
<page string="Paddings" name="padding">
<group col="4" colspan="2">
<group col="2" colspan="2">
<label for="padding_top" string="Top"/>
<div>
<field name="padding_top" class="oe_inline"/> mm
</div>
<label for="padding_bottom" string="Bottom"/>
<div>
<field name="padding_bottom" class="oe_inline"/> mm
</div>
</group>
<group col="2" colspan="2">
<label for="padding_left" string="Left"/>
<div>
<field name="padding_left" class="oe_inline"/> mm
</div>
<label for="padding_right" string="Right"/>
<div>
<field name="padding_right" class="oe_inline"/> mm
</div>
</group>
</group>
</page>
<page string="Margins" name="margin">
<group col="4" colspan="2">
<group col="2" colspan="2">
<label for="margin_top" string="Top"/>
<div>
<field name="margin_top" class="oe_inline"/> mm
</div>
<label for="margin_bottom" string="Bottom"/>
<div>
<field name="margin_bottom" class="oe_inline"/> mm
</div>
</group>
<group col="2" colspan="2">
<label for="margin_left" string="Left"/>
<div>
<field name="margin_left" class="oe_inline"/> mm
</div>
<label for="margin_right" string="Right"/>
<div>
<field name="margin_right" class="oe_inline"/> mm
</div>
</group>
</group>
</page>
<page string="Borders" name="border">
<group col="4" colspan="2">
<group col="2" colspan="2">
<field name="with_border_top" string="Top" widget="boolean_toggle"/>
<field name="with_border_bottom" string="Bottom" widget="boolean_toggle"/>
</group>
<group col="2" colspan="2">
<field name="with_border_left" string="Left" widget="boolean_toggle"/>
<field name="with_border_right" string="Right" widget="boolean_toggle"/>
</group>
<group col="2" colspan="2" invisible="not with_border_top and not with_border_left and not with_border_right and not with_border_bottom">
<field name="border_width" string="Width, px"/>
</group>
</group>
</page>
<page string="Background" name="background">
<group>
<group>
<field name="with_background" widget="boolean_toggle"/>
<field name="background_color" widget="color" invisible="not with_background"/>
</group>
</group>
</page>
<page string="Value Processing" name="post_processing">
<group>
<group>
<field name="value_prefix"/>
<field name="value_suffix"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="print_product_label_section_view_tree" model="ir.ui.view">
<field name="name">print.product.label.section.view.list</field>
<field name="model">print.product.label.section</field>
<field name="arch" type="xml">
<list decoration-info="type=='text' and not widget"
decoration-danger="widget=='price' or type=='promo_price'"
decoration-success="widget in ['barcode', 'qr_code']"
decoration-warning="type=='image' or widget=='image'"
decoration-muted="not active">
<field name="sequence" widget="handle"/>
<field name="display_name"/>
<field name="font_name" string="Font" optional="hide"/>
<field name="position" optional="show"/>
<field name="type" optional="hide"/>
<field name="field_id" optional="hide"/>
<field name="relation_field_id" optional="hide"/>
<field name="widget" optional="hide"/>
<field name="value_format" optional="hide"/>
<field name="align" optional="show"/>
<field name="font_size" optional="show"/>
<field name="font_size_measure" optional="hide"/>
<field name="line_height" optional="show"/>
<field name="font_weight" optional="show"/>
<field name="height" sum="Total Label Height" optional="show"/>
<field name="active" widget="boolean_toggle" optional="show"/>
</list>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_product_label_section_list" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="name">Sections</field>
<field name="res_model">print.product.label.section</field>
<field name="view_mode">list,form</field>
<field name="context">{'default_template_id': active_id, 'active_test': False}</field>
<field name="domain">[('template_id', '=', active_id)]</field>
</record>
<record id="print_product_label_template_view_form" model="ir.ui.view">
<field name="name">print.product.label.template.view.form</field>
<field name="model">print.product.label.template</field>
<field name="arch" type="xml">
<form create="false" duplicate="false">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="%(action_product_label_section_list)d"
type="action"
class="oe_stat_button"
icon="fa-bars"
title="Sections"
>
<field name="section_count" string="Sections" widget="statinfo"/>
</button>
</div>
<field name="active" invisible="1"/> <!-- Technical field for the web ribbon -->
<field name="format" invisible="1"/> <!-- Technical field for domain -->
<field name="is_oversized" invisible="1"/> <!-- Technical field for domain -->
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" invisible="active"/>
<field name="preview_html" class="oe_avatar" invisible="not preview"/>
<div class="oe_title">
<h1>
<div class="d-flex">
<field class="text-break" name="name"/>
</div>
</h1>
<div>
<label for="type_id" class="mr16"/>
<field name="type_id" widget="selection"/>
</div>
</div>
<div name="options">
<h2 class="d-flex gap-3 g-0 align-items-end">
<div>
<label for="width" string="Width" class="mr16"/>
<field name="width"/>
</div>
<div>
<label for="height" string="Height" class="mr16"/>
<field name="height"/>
</div>
</h2>
<div class="d-inline-block">
<label for="preview" class="mr8"/>
<field name="preview" widget="boolean_toggle"/>
<button name="action_pdf_preview" type="object" string="PDF Preview" icon="fa-file-pdf-o" class="border btn btn-sm btn-light rounded ms-2"/>
</div>
</div>
<notebook>
<page string="Sections" name="sections">
<field name="section_ids" mode="list">
<list create="false"
decoration-info="type=='text' and not widget"
decoration-danger="widget=='price' or type=='promo_price'"
decoration-success="widget in ['barcode', 'qr_code']"
decoration-warning="type=='image' or widget=='image'">
<field name="sequence" widget="handle"/>
<field name="display_name" string="Name"/>
<field name="font_name" string="Font" optional="hide"/>
<field name="widget" optional="hide"/>
<field name="position" optional="show"/>
<field name="type" optional="show"/>
<field name="field_name" invisible="type != 'field'" optional="hide"/>
<field name="value" invisible="type != 'text'" optional="hide"/>
<field name="with_background" optional="hide" width="0.5"/>
<field name="height" sum="Total Label Height" width="0.5" optional="show"/>
</list>
</field>
</page>
<page string="Page" name="page_settings">
<group col="4" colspan="2">
<group string="General" name="general" col="2" colspan="2">
<field name="paperformat_id" options="{'no_create': True}"/>
<field name="orientation" groups="base.group_system"/>
</group>
<group string="Margins, mm" name="page_margin_settings" col="2" colspan="2" groups="base.group_system">
<group>
<field name="margin_top" string="Top"/>
<field name="margin_bottom" string="Bottom"/>
</group>
<group>
<field name="margin_left" string="Left"/>
<field name="margin_right" string="Right"/>
</group>
</group>
<group string="Layout" col="2" colspan="2">
<field name="cols"/>
<field name="rows"/>
</group>
<group string="Gap between labels, mm" col="2" colspan="2">
<field name="col_gap" invisible="cols &lt;= 1"/>
<field name="row_gap" invisible="rows &lt;= 1"/>
</group>
</group>
</page>
<page string="Paddings" name="padding">
<group col="4" colspan="2">
<group col="2" colspan="2">
<label for="padding_top" string="Top"/>
<div><field name="padding_top" class="oe_inline"/> mm</div>
<label for="padding_bottom" string="Bottom"/>
<div><field name="padding_bottom" class="oe_inline"/> mm</div>
</group>
<group col="2" colspan="2">
<label for="padding_left" string="Left"/>
<div><field name="padding_left" class="oe_inline"/> mm</div>
<label for="padding_right" string="Right"/>
<div><field name="padding_right" class="oe_inline"/> mm</div>
</group>
</group>
</page>
<page string="Technical" name="technical" groups="base.group_no_one">
<group class="o_label_nowrap">
<div class="oe_row text-warning" colspan="2">Be aware specifying custom HTML styles, it can break the label generation!</div>
<field name="label_style" placeholder="For example, background-color: #FFFF00; border: 2px solid #000;"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="print_product_label_template_view_tree" model="ir.ui.view">
<field name="name">print.product.label.template.view.list</field>
<field name="model">print.product.label.template</field>
<field name="arch" type="xml">
<list create="false" decoration-muted="not active">
<field name="sequence" widget="handle"/>
<field name="type_id" optional="show"/>
<field name="name"/>
<field name="preview_html" string="Preview" optional="hide"/>
<field name="orientation" optional="hide"/>
<field name="width" optional="show"/>
<field name="height" optional="show"/>
<field name="paperformat_id" optional="show"/>
<field name="cols" optional="show"/>
<field name="rows" optional="show"/>
<field name="section_count" sum="Total" optional="show"/>
<field name="active" widget="boolean_toggle" optional="show"/>
</list>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.garazd_product_label_pro</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="garazd_product_label.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//setting[@id='product_label_printing_wizard']" position="after">
<setting id="product_label_preview_product_setting" string="Label Template Preview" help="Define default values to preview label templates">
<div class="content-group">
<div class="mt16">
<label for="print_label_preview_type" string="Use in Preview" class="col-3 col-lg-3 o_light_label"/>
<field name="print_label_preview_type" class="o_light_label" required="True" widget="radio"/>
</div>
<div class="mt16" invisible="print_label_preview_type != 'demo_product'">
<label for="print_label_preview_product_id" string="Demo Product" class="col-3 col-lg-3 o_light_label"/>
<field name="print_label_preview_product_id" class="o_light_label" required="print_label_preview_type == 'demo_product'"/>
</div>
<div class="mt16">
<label for="print_label_preview_pricelist_id" string="Pricelist" class="col-3 col-lg-3 o_light_label"/>
<field name="print_label_preview_pricelist_id" class="o_light_label" options="{'no_create': True}"/>
</div>
<div class="mt16">
<label for="print_label_preview_sale_pricelist_id" string="Promo Pricelist" class="col-3 col-lg-3 o_light_label"/>
<field name="print_label_preview_sale_pricelist_id" class="o_light_label" options="{'no_create': True}"/>
</div>
</div>
</setting>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_users_form" model="ir.ui.view">
<field name="name">res.users.form.inherit.garazd_product_label_pro</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="inside">
<group string="Product Labels">
<field name="print_label_template_id" options="{'no_create': True}" required="print_label_directly"/>
<field name="print_label_allowed_template_ids" widget="many2many_tags"/>
<field name="print_label_directly" widget="boolean_toggle"/>
</group>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="label_preview" name="Product Label Preview">
<div t-att-style="back_style">
<div t-att-style="label_style">
<div name="transform_div">
<t t-foreach="sections" t-as="section">
<t t-set="value" t-value="section.get_value(label)"/>
<t t-set="section_height" t-value="section.height - section.padding_top - section.padding_bottom"/>
<div t-att-style="'%s%s' % (section.get_html_style(), 'opacity: 0.3;' if editable_section_id and section.id != editable_section_id else '')">
<t t-if="section.type == 'product_attributes'">
<t t-if="section.widget == 'attribute_list'">
<div t-foreach="section.get_attribute_data(label)" t-as="attr">
<span t-if="section.with_product_attribute_name" t-out="attr['name']" class="mx-1"/>
<t t-foreach="attr['values']" t-as="attr_value">
<span t-att-class="'badge rounded bg-%s text-%s mr-1' % ('dark' if attr_value['active'] else 'light', 'light' if attr_value['active'] else 'dark')">
<t t-out="attr_value['name']"/>
</span>
</t>
</div>
</t>
<div t-else="" t-foreach="section.get_attribute_data(label)" t-as="attr" class="d-inline-flex flex-wrap">
<span class="mw-100 mx-1">
<t t-if="section.with_product_attribute_name" class="mr-1"><t t-out="attr['name']"/>: </t>
<t t-foreach="attr['values']" t-as="attr_value">
<span t-if="attr_value['active']" t-out="attr_value['name']" style="padding-left: 3px;"/>
</t>
</span>
</div>
</t>
<div t-if="section.type == 'multi_price'">
<t t-foreach="value" t-as="price">
<t t-out="price['amount']"/>
<small>(from <t t-out="price['qty']"/> <t t-out="label.product_id.uom_id.name"/>)</small>
<br/>
</t>
</div>
<t t-elif="section.widget == 'barcode'">
<img t-if="value" t-att-src="'/report/barcode/%s/%s?quiet=0&amp;humanreadable=%d' % (section.barcode_symbology, value, int(section.barcode_is_humanreadable))" style="width:85%;height:100%;"/>
<div t-else="" t-attf-style="width:100%;height:{{ section_height }}mm;background-image:url(/garazd_product_label_pro/static/img/no-barcode.png);background-size:contain;background-repeat:no-repeat;background-position:center;"/>
</t>
<t t-elif="section.widget == 'price'">
<div>
<t t-esc="label.currency_id.symbol"/>&amp;nbsp;
<span class="oe_currency_value" t-esc="'%.0f.' % label.price"/><span class="oe_currency_value" style="font-size:0.5em">00</span>
</div>
</t>
<t t-elif="section.widget == 'qr_code'">
<t t-set="qr_code_size_px" t-value="section.height * section.template_id.ratio_px_in_mm"/>
<img t-att-src="'/report/barcode/?barcode_type=QR&amp;value=%s&amp;width=%d&amp;height=%d'%(value, qr_code_size_px, qr_code_size_px)" t-attf-style="display: block; height: 100%; width: {{ section_height }}mm;"/>
</t>
<t t-elif="section.widget == 'image'">
<div t-attf-style="width:100%;height:100%;background-image:url({{ section.get_image_url(label) }});background-size:contain;background-repeat:no-repeat;background-position:center;"/>
</t>
<t t-elif="section.type == 'image'">
<div t-attf-style="width:100%;height:100%;background-image:url(/web/image/print.product.label.section/{{ section.id }}/image);background-size:contain;background-repeat:no-repeat;background-position:center;"/>
</t>
<t t-else="">
<div t-esc="value" style="white-space:normal" t-att-title="value"/>
</t>
</div>
</t>
</div>
</div>
</div>
</template>
</odoo>