@ -0,0 +1,54 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Customer and Product QR Code Generator |
|||
====================================== |
|||
The Customer and Product QRCode Generator Helps You to Generate Unique |
|||
QR Codes to your Products or Customers |
|||
|
|||
Configuration |
|||
============= |
|||
Need to set the prefix for product and Customer Qr code |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL v3). |
|||
( https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
|
|||
Credits |
|||
------- |
|||
* Developer:(V14) Sarath Suresh , |
|||
(V15) Midilaj V K , |
|||
(V16) Athira P S , |
|||
(V17) Anjhana A K , |
|||
(V18) Ammu raj, Ayana KP, |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Ayana KP(<https://www.cybrosys.com>) |
|||
|
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import models |
|||
from . import report |
|||
|
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Ayana KP(<https://www.cybrosys.com>) |
|||
|
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Customer and Product QR Code Generator', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Extra Tools', |
|||
'summary': 'Generate Unique QR Codes for Customers and Products', |
|||
'description': '''QR Code, QR Code Generator, Odoo QR Code Generator, |
|||
Customer QR Code, Product QR Code, QR, QR Code Odoo''', |
|||
'author': 'Cybrosys Techno solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['base', 'sale_management', 'stock'], |
|||
'data': [ |
|||
'data/sequence.xml', |
|||
'data/ir_actions_server_data.xml', |
|||
'views/res_config_settings_view.xml', |
|||
'views/res_partner_view.xml', |
|||
'views/product_product_view.xml', |
|||
'views/product_template_view.xml', |
|||
'report/paperformat.xml', |
|||
'report/report_action.xml', |
|||
'report/customer_product_qrcode_template.xml', |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
|||
|
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<record id="generate_qr_partner_action" model="ir.actions.server"> |
|||
<field name="name">Generate Qr</field> |
|||
<field name="model_id" ref="customer_product_qrcode.model_res_partner"/> |
|||
<field name="binding_model_id" ref="customer_product_qrcode.model_res_partner"/> |
|||
<field name="binding_view_types">form,list</field> |
|||
<field name="state">code</field> |
|||
<field name="code"> |
|||
for record in records: |
|||
if not record.sequence: |
|||
action = record.generate_sequence() |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="generate_qr_product_action" model="ir.actions.server"> |
|||
<field name="name">Generate Qr</field> |
|||
<field name="model_id" ref="customer_product_qrcode.model_product_product"/> |
|||
<field name="binding_model_id" ref="customer_product_qrcode.model_product_product"/> |
|||
<field name="binding_view_types">form,list</field> |
|||
<field name="state">code</field> |
|||
<field name="code"> |
|||
for record in records: |
|||
if not record.sequence: |
|||
action = record.generate_sequence() |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,19 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<!-- Product sequence for Qr code--> |
|||
<record id="product_sequence_id" model="ir.sequence"> |
|||
<field name="name">product_sequence</field> |
|||
<field name="code">product.product</field> |
|||
<field name="prefix"/> |
|||
<field name="padding">5</field> |
|||
</record> |
|||
<!-- Partner sequence for Qr code--> |
|||
<record id="customer_sequence_id" model="ir.sequence"> |
|||
<field name="name">customer_sequence</field> |
|||
<field name="code">res.partner</field> |
|||
<field name="prefix"/> |
|||
<field name="padding">5</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <customer_product_qrcode> |
|||
|
|||
#### 03.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Customer and Product QR Code Generator |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Ayana KP(<https://www.cybrosys.com>) |
|||
|
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import product_product |
|||
from . import product_template |
|||
from . import res_config_settings |
|||
from . import res_partner |
@ -0,0 +1,111 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Ayana KP(<https://www.cybrosys.com>) |
|||
|
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
try: |
|||
import qrcode |
|||
except ImportError: |
|||
qrcode = None |
|||
try: |
|||
import base64 |
|||
except ImportError: |
|||
base64 = None |
|||
from io import BytesIO |
|||
from odoo import _, api, fields, models |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class ProductProduct(models.Model): |
|||
"""Extends the product model to include QR code functionality.""" |
|||
_inherit = 'product.product' |
|||
|
|||
sequence = fields.Char(string="QR Sequence", readonly=True, |
|||
help='to add sequence') |
|||
qr = fields.Binary(string="QR Code", help='Qr file') |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals_list): |
|||
"""Create a new product and assign a unique QR sequence and QR code |
|||
to it.""" |
|||
for vals in vals_list: |
|||
prefix = self.env['ir.config_parameter'].sudo().get_param( |
|||
'customer_product_qr.config.product_prefix') |
|||
if not prefix: |
|||
raise UserError(_('Set A Product Prefix In General Settings')) |
|||
prefix = str(prefix) |
|||
seq = prefix + self.env['ir.sequence'].next_by_code( |
|||
'product.product') or _('New') |
|||
vals['sequence'] = seq |
|||
qr = qrcode.QRCode( |
|||
version=1, |
|||
error_correction=qrcode.constants.ERROR_CORRECT_L, |
|||
box_size=10, |
|||
border=4, |
|||
) |
|||
qr.add_data(vals['sequence']) |
|||
qr.make(fit=True) |
|||
img = qr.make_image() |
|||
temp = BytesIO() |
|||
img.save(temp, format="PNG") |
|||
qr_image = base64.b64encode(temp.getvalue()) |
|||
vals.update({'qr': qr_image}) |
|||
return super().create(vals_list) |
|||
|
|||
def generate_sequence(self): |
|||
prefix = self.env['ir.config_parameter'].sudo().get_param( |
|||
'customer_product_qr.config.product_prefix') |
|||
if not prefix: |
|||
raise UserError( |
|||
_('Set A Customer Prefix In General Settings')) |
|||
prefix = str(prefix) |
|||
self.sequence = prefix + self.env['ir.sequence'].next_by_code( |
|||
'product.product') or '/' |
|||
|
|||
def generate_qr(self): |
|||
"""Generate a QR code based on the product's sequence and store it in |
|||
the 'qr' field of the product.""" |
|||
if qrcode and base64: |
|||
if not self.sequence: |
|||
self.generate_sequence() |
|||
qr = qrcode.QRCode( |
|||
version=1, |
|||
error_correction=qrcode.constants.ERROR_CORRECT_L, |
|||
box_size=10, |
|||
border=4, |
|||
) |
|||
qr.add_data(self.sequence) |
|||
qr.make(fit=True) |
|||
img = qr.make_image() |
|||
temp = BytesIO() |
|||
img.save(temp, format="PNG") |
|||
qr_image = base64.b64encode(temp.getvalue()) |
|||
self.write({'qr': qr_image}) |
|||
return self.env.ref( |
|||
'customer_product_qrcode.print_qr1').report_action(self, data={ |
|||
'data': self.id, 'type': 'prod'}) |
|||
else: |
|||
raise UserError( |
|||
_('Necessary Requirements To Run This Operation Is Not' |
|||
' Satisfied')) |
|||
|
|||
def get_product_by_qr(self, **args): |
|||
"""Retrieve a product based on the provided QR sequence.""" |
|||
return self.env['product.product'].search( |
|||
[('sequence', '=', self.id), ], limit=1).id |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Ayana KP(<https://www.cybrosys.com>) |
|||
|
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models |
|||
|
|||
|
|||
class ProductTemplate(models.Model): |
|||
"""Extends the product.template model to generate QR codes for all |
|||
related product variants.""" |
|||
_inherit = 'product.template' |
|||
|
|||
def generate_sequence(self): |
|||
for rec in self.product_variant_ids: |
|||
if not rec.sequence: |
|||
rec.generate_sequence() |
|||
|
|||
def generate_qr(self): |
|||
"""Generate QR codes for all product variants associated with the |
|||
product template.""" |
|||
for rec in self.product_variant_ids: |
|||
return rec.generate_qr() |
@ -0,0 +1,55 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Ayana KP(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
"""Extends the res.config.settings model to include configuration |
|||
settings for QR code prefixes.""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
customer_prefix = fields.Char(string="Customer QR Prefix", |
|||
help='Customer Qr prefix') |
|||
product_prefix = fields.Char(string="Product QR Prefix", |
|||
help='Product Qr prefix') |
|||
|
|||
def get_values(self): |
|||
"""fRetrieve the current configuration values for QR code prefixes.""" |
|||
res = super().get_values() |
|||
customer_prefix = self.env["ir.config_parameter"].get_param( |
|||
"customer_product_qr.config.customer_prefix") |
|||
product_prefix = self.env["ir.config_parameter"].get_param( |
|||
"customer_product_qr.config.product_prefix") |
|||
res.update({ |
|||
'customer_prefix': customer_prefix if type( |
|||
customer_prefix) else False, |
|||
'product_prefix': product_prefix if type(product_prefix) else False |
|||
} |
|||
) |
|||
return res |
|||
|
|||
def set_values(self): |
|||
"""Set the configuration values for QR code prefixes.""" |
|||
self.env['ir.config_parameter'].sudo().set_param( |
|||
'customer_product_qr.config.customer_prefix', self.customer_prefix) |
|||
self.env['ir.config_parameter'].sudo().set_param( |
|||
'customer_product_qr.config.product_prefix', self.product_prefix) |
|||
super().set_values() |
@ -0,0 +1,111 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Ayana KP(<https://www.cybrosys.com>) |
|||
|
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
try: |
|||
import qrcode |
|||
except ImportError: |
|||
qrcode = None |
|||
try: |
|||
import base64 |
|||
except ImportError: |
|||
base64 = None |
|||
from io import BytesIO |
|||
|
|||
from odoo import api, fields, models, _ |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class ResPartners(models.Model): |
|||
"""Extends the res partner model to include QR code functionality.""" |
|||
_inherit = 'res.partner' |
|||
|
|||
sequence = fields.Char(string="QR Sequence", readonly=True) |
|||
qr = fields.Binary(string="QR Code", help='Used for Qr code') |
|||
|
|||
def init(self): |
|||
"""Initialize the QR sequence for customer partners with a combination |
|||
of 'DEF', partner's name (without spaces), and partner's ID.""" |
|||
for record in self.env['res.partner'].search( |
|||
[('customer_rank', '=', True)]): |
|||
name = record.name.replace(" ", "") |
|||
record.sequence = 'DEF' + name.upper() + str(record.id) |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals_list): |
|||
"""Create a new partner record and assign a unique QR sequence to |
|||
it.""" |
|||
for vals in vals_list: |
|||
prefix = self.env['ir.config_parameter'].sudo().get_param( |
|||
'customer_product_qr.config.customer_prefix') |
|||
if not prefix: |
|||
raise UserError(_('Set A Customer Prefix In General Settings')) |
|||
prefix = str(prefix) |
|||
seq = prefix + self.env['ir.sequence'].next_by_code( |
|||
'res.partner') or '/' |
|||
vals['sequence'] = seq |
|||
return super().create(vals_list) |
|||
|
|||
@api.model |
|||
def write(self, vals): |
|||
""" this fn is to write vals""" |
|||
return super().write(vals) |
|||
|
|||
def generate_sequence(self): |
|||
prefix = self.env['ir.config_parameter'].sudo().get_param( |
|||
'customer_product_qr.config.customer_prefix') |
|||
if not prefix: |
|||
raise UserError( |
|||
_('Set A Customer Prefix In General Settings')) |
|||
prefix = str(prefix) |
|||
self.sequence = prefix + self.env['ir.sequence'].next_by_code( |
|||
'res.partner') or '/' |
|||
|
|||
def generate_qr(self): |
|||
"""Generate a QR code based on the partner's sequence and store it in |
|||
the 'qr' field of the partner record.""" |
|||
if qrcode and base64: |
|||
if not self.sequence: |
|||
self.generate_sequence() |
|||
qr = qrcode.QRCode( |
|||
version=1, |
|||
error_correction=qrcode.constants.ERROR_CORRECT_L, |
|||
box_size=10, |
|||
border=4, |
|||
) |
|||
qr.add_data(self.sequence) |
|||
qr.make(fit=True) |
|||
img = qr.make_image() |
|||
temp = BytesIO() |
|||
img.save(temp, format="PNG") |
|||
qr_image = base64.b64encode(temp.getvalue()) |
|||
self.write({'qr': qr_image}) |
|||
return self.env.ref( |
|||
'customer_product_qrcode.print_qr').report_action(self, data={ |
|||
'data': self.id, 'type': 'cust'}) |
|||
else: |
|||
raise UserError( |
|||
_('Necessary Requirements To Run This Operation Is Not ' |
|||
'Satisfied')) |
|||
|
|||
def get_partner_by_qr(self, **args): |
|||
"""THis fn is to get partner by qr """ |
|||
return self.env['res.partner'].search([('sequence', '=', self.id), ], |
|||
limit=1).id |
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import parser |
@ -0,0 +1,52 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<data> |
|||
<!-- report template--> |
|||
<template id="customer_qr_template"> |
|||
<t t-foreach="data" t-as="records"> |
|||
<t t-foreach="records" t-as="record"> |
|||
<t t-call="web.html_container"> |
|||
<t t-call="web.internal_layout"> |
|||
<style> |
|||
table{ |
|||
border:1px solid black !important; |
|||
height:370px; |
|||
width:370px; |
|||
} |
|||
tr{ |
|||
border:1px solid black !important; |
|||
} |
|||
td{ |
|||
border:1px solid black !important; |
|||
font-size:30px; |
|||
} |
|||
</style> |
|||
<div class="page"> |
|||
<center> |
|||
<table> |
|||
<tr> |
|||
<td style="text-align:center;"> |
|||
<span t-esc="record.name" |
|||
style="float:center;"/> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td> |
|||
<center> |
|||
<span t-field="record.qr" |
|||
t-options="{'widget': 'image'}"/> |
|||
<span t-esc="record.sequence" |
|||
style="float:center;"/> |
|||
</center> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</center> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Customer product qrcode paperformat--> |
|||
<record id="customer_product_qrcode.customer_badge_paperformat" |
|||
model="report.paperformat"> |
|||
<field name="name">PDF Report</field> |
|||
<field name="default" eval="False"/> |
|||
<field name="format">custom</field> |
|||
<field name="page_height">100</field> |
|||
<field name="page_width">100</field> |
|||
<field name="orientation">Portrait</field> |
|||
<field name="margin_top">10</field> |
|||
<field name="margin_bottom">0</field> |
|||
<field name="margin_left">10</field> |
|||
<field name="margin_right">10</field> |
|||
<field name="header_line" eval="False"/> |
|||
<field name="header_spacing">80</field> |
|||
<field name="dpi">90</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,41 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Anjhana A K(<https://www.cybrosys.com>) |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import models, api |
|||
from odoo.http import request |
|||
|
|||
|
|||
class CustomerQrTemplate(models.AbstractModel): |
|||
"""Abstract model for generating the customer QR template report.""" |
|||
_name = 'report.customer_product_qrcode.customer_qr_template' |
|||
|
|||
@api.model |
|||
def _get_report_values(self, docids, data=None): |
|||
"""Get the report values for generating the customer QR template.""" |
|||
if data['type'] == 'cust': |
|||
dat = [request.env['res.partner'].browse(data['data'])] |
|||
elif data['type'] == 'all': |
|||
dat = [request.env['product.product'].search( |
|||
[('product_tmpl_id', '=', data['data'])])] |
|||
else: |
|||
dat = request.env['product.product'].browse(data['data']) |
|||
return { |
|||
'data': dat, |
|||
} |
@ -0,0 +1,29 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<data> |
|||
<!-- report action for partner--> |
|||
<record id="customer_product_qrcode.print_qr" model="ir.actions.report"> |
|||
<field name="name"> QR code</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">customer_product_qrcode.customer_qr_template</field> |
|||
<field name="report_file">customer_product_qrcode.customer_qr_template</field> |
|||
<field name="paperformat_id" ref="customer_product_qrcode.customer_badge_paperformat"/> |
|||
<field name="print_report_name">'%s - Badge' % object.name</field> |
|||
<field name="binding_model_id" ref="model_res_partner"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
<!-- report action for product--> |
|||
<record id="customer_product_qrcode.print_qr1" model="ir.actions.report"> |
|||
<field name="name">QR code</field> |
|||
<field name="model">product.product</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">customer_product_qrcode.customer_qr_template</field> |
|||
<field name="report_file">customer_product_qrcode.customer_qr_template</field> |
|||
<field name="paperformat_id" ref="customer_product_qrcode.customer_badge_paperformat"/> |
|||
<field name="print_report_name">'%s - Badge' % object.name</field> |
|||
<field name="binding_model_id" ref="model_product_product"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 201 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 8.6 KiB |