콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
8198 화면

Hi guys thks for reading my request. Got my odoo v15 upgrade it seem have some changes. Hope looking for a option to change the label size and orientation of the information inside. Any tips.

Here is a link of the image, Hope that help you guys to understand. 

https://ibb.co/pyZL5mZ

아바타
취소
베스트 답변

Hello, David

Odoo has only specific label layouts and sizes, as mentioned in your screenshot. 

You may consider this solution, which will allow you to create and design a product label with your layout: https://apps.odoo.com/apps/modules/15.0/garazd_product_label_pro/


Best regards, Yurii Razumovskyi.

Company Garazd Creation


아바타
취소
베스트 답변

Hi,

In the selection option for the layout, we cant add a particular format manually that need some python code, for getting the particular out we can customize the layout structure

first, we can add the form view for the format type '

In a python file, you can inherit the layout, this comes in the wizard action.

class ProductLabelLayout(models.TransientModel):
_inherit = 'product.label.layout'

print_format = fields.Selection(selection_add=[
('new_fromat', 'Format'), ], ondelete={'new_format': 'set default'})
 
 
def _prepare_report_data(self):
xml_id, data = super()._prepare_report_data()

if 'new_format' in self.print_format:
xml_id = 'report.custom_labels.report_new_fromat'

data = {
'active_model': active_model,
'product_tmpl_name': self.product_tmpl_ids.name,
'product_tmpl_price': price,
#you can add particular data in the label printing
}
return xml_id, data

python file for a report

class ReportProductLabelTag(models.AbstractModel):
_name = 'report.custom_labels.report_new_fromat'
_description = 'Label'

def _get_report_values(self, docids, data):
if data.get('active_model') == 'product.template':
Product = self.env['product.template']
elif data.get('active_model') == 'product.product':
Product = self.env['product.product']
else:
raise UserError(
_('Product model not defined, Please contact your administrator.'))
return {
'doc_ids': docids,
'data': data,
}

report XML

# create the paper format

<record id="paperformat_new_format" model="report.paperformat">


    <field name="name">Label</field>


    <field name="default" eval="True"/>


    <field name="format">custom</field>


    <field name="page_height">267</field>


    <field name="page_width">175</field>


    <field name="orientation">Landscape</field>


    <field name="margin_top">0</field>


    <field name="margin_bottom">0</field>


    <field name="margin_left">0</field>


    <field name="margin_right">0</field>


    <field name="disable_shrinking" eval="True"/>


    <field name="header_line" eval="False"/>


    <field name="header_spacing">0</field>


    <field name="dpi">96</field>


</record>




<record id="report_new_format" model="ir.actions.report">


    <field name="name">New</field>


    <field name="model">product.template</field>


    <field name="report_type">qweb-pdf</field>


    <field name="report_name">module_name.report_new_fromat</field>


    <field name="report_file">module_name.report_new_fromat</field>


    <field name="paperformat_id" ref="paperformat_new_format"/>


</record>


and also you can design your own templates using

<template id="report_new_format">


 # add custom template format


</template


Regards

아바타
취소
관련 게시물 답글 화면 활동
3
8월 25
1581
2
3월 15
5989
5
12월 23
18270
2
7월 25
3423
2
5월 24
3714