Merge pull request #4080 from expsa/younes_dev_odex25_sales
Improve: membership card printing
This commit is contained in:
commit
accd3184c5
|
|
@ -38,8 +38,7 @@ class ResPartner(models.Model):
|
||||||
|
|
||||||
def server_action_get_card(self):
|
def server_action_get_card(self):
|
||||||
""" Used to fetch data from res. partner to pass in template"""
|
""" Used to fetch data from res. partner to pass in template"""
|
||||||
partner_id = self.env['res.partner'] \
|
partner_id = self.env['res.partner'].sudo().browse(self.env.context.get('active_ids'))
|
||||||
.browse(self.env.context.get('active_ids'))
|
|
||||||
company_id = self.env.company
|
company_id = self.env.company
|
||||||
if self.is_member:
|
if self.is_member:
|
||||||
data = {
|
data = {
|
||||||
|
|
@ -55,6 +54,6 @@ class ResPartner(models.Model):
|
||||||
image_url = base_url + '/web/image?' + 'model=product.product&id=' + str(partner_id.product_id.id) + '&field=card_background_image'
|
image_url = base_url + '/web/image?' + 'model=product.product&id=' + str(partner_id.product_id.id) + '&field=card_background_image'
|
||||||
data['background_src'] = image_url or ''
|
data['background_src'] = image_url or ''
|
||||||
return self.env.ref('membership_card_odoo.action_membership'
|
return self.env.ref('membership_card_odoo.action_membership'
|
||||||
'_card').report_action(None, data=data)
|
'_card').sudo().report_action(None, data=data)
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
'Need to buy membership inorder to print membership card')
|
'Need to buy membership inorder to print membership card')
|
||||||
|
|
|
||||||
|
|
@ -30,36 +30,22 @@
|
||||||
<template id="print_member_ship_card">
|
<template id="print_member_ship_card">
|
||||||
<t t-call="web.html_container">
|
<t t-call="web.html_container">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<style>
|
<div t-attf-style="background-image: url('#{background_src}');background-size: 100% 100%; background-repeat: no-repeat; background-position: 0 0; height: 280mm; width: 450mm;" class="page">
|
||||||
@font-face {font-family: "Sakkal Majalla"; src:
|
|
||||||
url("/membership_card_odoo/static/fonts/ce7b5754581057e6f7444e2192850cc8.eot"); src:
|
|
||||||
url("/membership_card_odoo/static/fonts/ce7b5754581057e6f7444e2192850cc8.eot?#iefix")
|
|
||||||
format("embedded-opentype"),
|
|
||||||
url("/membership_card_odoo/static/fonts/ce7b5754581057e6f7444e2192850cc8.woff2") format("woff2"),
|
|
||||||
url("/membership_card_odoo/static/fonts/ce7b5754581057e6f7444e2192850cc8.woff") format("woff"),
|
|
||||||
url("/membership_card_odoo/static/fonts/ce7b5754581057e6f7444e2192850cc8.ttf") format("truetype");
|
|
||||||
}
|
|
||||||
.content{
|
|
||||||
font-family: 'Sakkal Majalla'!important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div t-attf-style="background-image: url('#{background_src}');background-size: 100% 100%; background-repeat: no-repeat; background-position: 0 0; height: 280mm; width: 450mm;"
|
|
||||||
style="font-family:'Sakkal Majalla'!important;" id="font" class="page content">
|
|
||||||
<div>
|
<div>
|
||||||
<div t-if="name"
|
<div t-if="name"
|
||||||
style="position: absolute; top: 70mm; right: 160mm; font-family:'Sakkal Majalla'!important; font-size: 80px; font-weight: bold; text-align: right; direction: rtl;">
|
style="position: absolute; top: 70mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
|
||||||
<t t-esc="name"/>
|
<t t-esc="name"/>
|
||||||
</div>
|
</div>
|
||||||
<div t-if="membrship_no"
|
<div t-if="membrship_no"
|
||||||
style="position: absolute; top: 95mm; right: 160mm; font-family:'Sakkal Majalla'!important; font-size: 80px; font-weight: bold; text-align: right; direction: rtl;">
|
style="position: absolute; top: 95mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
|
||||||
<t t-esc="membrship_no"/>
|
<t t-esc="membrship_no"/>
|
||||||
</div>
|
</div>
|
||||||
<div t-if="start_date"
|
<div t-if="start_date"
|
||||||
style="position: absolute; top: 120mm; right: 160mm; font-family:'Sakkal Majalla'!important; font-size: 80px; font-weight: bold; text-align: right; direction: rtl;">
|
style="position: absolute; top: 120mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
|
||||||
<t t-esc="start_date"/>
|
<t t-esc="start_date"/>
|
||||||
</div>
|
</div>
|
||||||
<div t-if="end_date"
|
<div t-if="end_date"
|
||||||
style="position: absolute; top: 145mm; right: 160mm; font-family:'Sakkal Majalla'!important; font-size: 80px; font-weight: bold; text-align: right; direction: rtl;">
|
style="position: absolute; top: 145mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
|
||||||
<t t-esc="end_date"/>
|
<t t-esc="end_date"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue