add product_print_category_supermarket
This commit is contained in:
parent
59c8d127a9
commit
0db766645c
12 changed files with 303 additions and 0 deletions
1
product_print_category_supermarket/__init__.py
Normal file
1
product_print_category_supermarket/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import models
|
||||
30
product_print_category_supermarket/__manifest__.py
Normal file
30
product_print_category_supermarket/__manifest__.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright 2022 Criptomart
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Product Labels for supermarkets",
|
||||
"description": """
|
||||
Extends product_print_category adding labels for Supermarkets""",
|
||||
"version": "16.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Criptomart",
|
||||
"website": "https://criptomart.net",
|
||||
"depends": [
|
||||
"product_print_category",
|
||||
"product_origin",
|
||||
"product_template_tags",
|
||||
],
|
||||
"data": [
|
||||
"views/report_pricetag_normal.xml",
|
||||
"views/product_template_tag.xml",
|
||||
"views/product_template.xml",
|
||||
"views/res_config.xml",
|
||||
"data/product_print_category.xml",
|
||||
],
|
||||
"assets": {
|
||||
"web.report_assets_common": [
|
||||
"/product_print_category_supermarket/static/css/pricetag_60x30mm.scss",
|
||||
]
|
||||
},
|
||||
"demo": [],
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="print_category_pricetag_normal" model="product.print.category">
|
||||
<field name="name">Normal pricetag - 60x30mm</field>
|
||||
<field name="qweb_view_id" ref="report_product_label_shelf" />
|
||||
<field
|
||||
name="field_ids"
|
||||
eval="[(6, 0, [
|
||||
ref('product.field_product_template__name'),
|
||||
ref('product.field_product_template__seller_ids'),
|
||||
ref('product.field_product_product__default_code'),
|
||||
ref('product_origin.field_product_template__state_id'),
|
||||
ref('product.field_product_template__list_price')])]"
|
||||
/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
3
product_print_category_supermarket/models/__init__.py
Normal file
3
product_print_category_supermarket/models/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from . import product_template
|
||||
from . import product_template_tag
|
||||
from . import res_config
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
origin = fields.Char()
|
||||
code_balance = fields.Integer("Balance Code")
|
||||
ingredients = fields.Text()
|
||||
expiration_date = fields.Date("Expiration Date")
|
||||
|
||||
@api.model
|
||||
def get_price_member(self):
|
||||
param_value = (
|
||||
self.env["ir.config_parameter"]
|
||||
.sudo()
|
||||
.get_param("report_label_supermarket.label_pricelist")
|
||||
)
|
||||
pricelist = self.env["product.pricelist"].browse(int(param_value))
|
||||
price = pricelist._get_product_price(self, 1)
|
||||
return price
|
||||
|
||||
@api.model
|
||||
def get_price_public(self):
|
||||
pricelist = self.env.ref("product.list0")
|
||||
price = pricelist._get_product_price(self, 1)
|
||||
return price
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProductTemplateTag(models.Model):
|
||||
_inherit = "product.template.tag"
|
||||
|
||||
image = fields.Image("Logo")
|
||||
12
product_print_category_supermarket/models/res_config.py
Normal file
12
product_print_category_supermarket/models/res_config.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = "res.config.settings"
|
||||
|
||||
label_pricelist = fields.Many2one(
|
||||
required=False,
|
||||
comodel_name="product.pricelist",
|
||||
string="Pricelist for members",
|
||||
config_parameter="report_label_supermarket.label_pricelist",
|
||||
)
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
.pricetag_container{
|
||||
height: 3.7cm;
|
||||
width: 7.1cm;
|
||||
border: 2px solid black;
|
||||
text-align: left;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
display: inline-table;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.product_name {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
margin-top: 1mm;
|
||||
margin-left: 1mm;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.product_code {
|
||||
font-size: 0.8em;
|
||||
position: absolute;
|
||||
margin-top: 1.2cm;
|
||||
margin-left: 5.3cm;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.product_state {
|
||||
font-size: 0.8em;
|
||||
position: absolute;
|
||||
margin-top: 1.7cm;
|
||||
right: 0.3cm;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.product_labels {
|
||||
vertical-align:bottom;
|
||||
position: absolute;
|
||||
margin-top: 2cm;
|
||||
margin-left: 0.1cm;
|
||||
width: 35%;
|
||||
|
||||
img {
|
||||
height: 1cm;
|
||||
width: 1cm;
|
||||
float: left;
|
||||
padding: 0.5mm
|
||||
}
|
||||
}
|
||||
|
||||
.product_member_price {
|
||||
font-size: 1.1em;
|
||||
position: absolute;
|
||||
width: 58%;
|
||||
text-align: right;
|
||||
margin-top: 2.2cm;
|
||||
margin-left: 2.8cm;
|
||||
padding-right: 0.2cm;
|
||||
background-color: green;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.product_public_price {
|
||||
font-size: 1em;
|
||||
position: absolute;
|
||||
width: 58%;
|
||||
margin-top: 2.9cm;
|
||||
margin-left: 2.8cm;
|
||||
text-align: right;
|
||||
padding-right: 0.2cm;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="product_template_origin_form_view" model="ir.ui.view">
|
||||
<field
|
||||
name="name"
|
||||
>product.template.origin.form (in report_label_supermarket)</field>
|
||||
<field name="model">product.template</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="product_template_tags.product_template_form_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="tag_ids" position="after">
|
||||
<field name="origin" />
|
||||
<field name="ingredients" />
|
||||
<field name="code_balance" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Filter for products that should update its sales price -->
|
||||
<record id="view_product_search_form_inherit_updated" model="ir.ui.view">
|
||||
<field name="name">view.product.search.form.inherit.updated</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='services']" position="before">
|
||||
<!-- <filter
|
||||
string="To print"
|
||||
name="products_ready_to_print_filter"
|
||||
domain="[('to_print', '=', True)]"
|
||||
/> -->
|
||||
<separator />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="product_template_tag_image_form_view" model="ir.ui.view">
|
||||
<field
|
||||
name="name"
|
||||
>product.template.tag.image.form (in report_label_supermarket)</field>
|
||||
<field name="model">product.template.tag</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="product_template_tags.product_template_tag_form_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="color" position="after">
|
||||
<field name="image" widget="image" options='{"size": [300, 300]}' />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="product_template_tag_config_menu" model="ir.ui.menu">
|
||||
<field name="name">Product Tags</field>
|
||||
<field name="parent_id" ref="stock.menu_stock_config_settings" />
|
||||
<field name="sequence" eval="40" />
|
||||
<field name="action" ref="product_template_tags.product_template_tag_act_window" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template id="report_product_label_shelf" >
|
||||
<t t-name="report_product_label_shelf">
|
||||
<t t-call="web.basic_layout">
|
||||
<t t-foreach="category_data['lines']" t-as="line">
|
||||
<t t-set="product" t-value="line.product_id.product_tmpl_id" />
|
||||
<div class="pricetag_container" >
|
||||
<div class="product_name" >
|
||||
<span t-field="product.name"/>
|
||||
</div>
|
||||
<!-- <t t-if="product.default_code">
|
||||
<div class="product_code" >
|
||||
ref.<span t-field="product.default_code"/>
|
||||
</div>
|
||||
</t> -->
|
||||
<t t-if="product.origin">
|
||||
<div class="product_state" >
|
||||
<span t-field="product.origin"/>
|
||||
</div>
|
||||
</t>
|
||||
<div class="product_labels" >
|
||||
<t t-foreach="product.tag_ids" t-as="label">
|
||||
<img t-attf-src="data:image/*;base64,{{label.image}}" t-att-alt="label.name"/>
|
||||
</t>
|
||||
</div>
|
||||
<div class="product_member_price" >
|
||||
<t t-set="members_price_wo_tax" t-value="round(product.list_price - (product.list_price * 0.15), 2)" />
|
||||
<t t-set="members_price" t-value="round(members_price_wo_tax * (1 + product.taxes_id[0].amount / 100), 2)" />
|
||||
<strong>Socia <span t-esc="members_price"/> €</strong>
|
||||
</div>
|
||||
<div class="product_public_price" >
|
||||
<t t-set="public_price" t-value="round(product.list_price * (1 + product.taxes_id[0].amount / 100), 2)" />
|
||||
<span>No socia</span> <span t-esc="public_price"/> €
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
24
product_print_category_supermarket/views/res_config.xml
Normal file
24
product_print_category_supermarket/views/res_config.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="res_config_settings_view_form_pricelists" model="ir.ui.view">
|
||||
<field name="name">product.print.supermarket.res.config.settings.form</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="priority" eval="100" />
|
||||
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='pricing_setting_container']" position="inside">
|
||||
<div
|
||||
class="col-12 col-lg-6 o_setting_box"
|
||||
name="supermarket_settigs_container"
|
||||
>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="label_pricelist" string="Members Pricelist" />
|
||||
<field name="label_pricelist" />
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue