Browse Source

[IMP] Allow to specify margin for each side (top, bottom, ...)

14.0
Benjamin Willig 7 years ago
committed by Alexei Rivera
parent
commit
75bfb9aeda
  1. 17
      partner_label/models/base_config_settings.py
  2. 25
      partner_label/models/res_company.py
  3. 5
      partner_label/reports/res_partner.xml
  4. 9
      partner_label/views/base_config_settings.xml

17
partner_label/models/base_config_settings.py

@ -16,8 +16,21 @@ class BaseConfigSettings(models.TransientModel):
partner_labels_padding = fields.Float( partner_labels_padding = fields.Float(
related='company_id.partner_labels_padding', required=True, related='company_id.partner_labels_padding', required=True,
) )
partner_labels_margin = fields.Float(
related='company_id.partner_labels_margin', required=True,
partner_labels_margin_top = fields.Float(
related='company_id.partner_labels_margin_top',
required=True,
)
partner_labels_margin_bottom = fields.Float(
related='company_id.partner_labels_margin_bottom',
required=True,
)
partner_labels_margin_left = fields.Float(
related='company_id.partner_labels_margin_left',
required=True,
)
partner_labels_margin_right = fields.Float(
related='company_id.partner_labels_margin_right',
required=True,
) )
partner_labels_paperformat_id = fields.Many2one( partner_labels_paperformat_id = fields.Many2one(
'report.paperformat', string='Paperformat', required=True, 'report.paperformat', string='Paperformat', required=True,

25
partner_label/models/res_company.py

@ -16,6 +16,27 @@ class ResCompany(models.Model):
partner_labels_padding = fields.Float( partner_labels_padding = fields.Float(
'Padding', default=5, help='Padding in millimeters', required=True, 'Padding', default=5, help='Padding in millimeters', required=True,
) )
partner_labels_margin = fields.Float(
'Margin', default=1, help='Margin in millimeters', required=True,
partner_labels_margin_top = fields.Float(
string="Margin Top",
default=1,
help="Margin top in millimeters",
required=True,
)
partner_labels_margin_bottom = fields.Float(
string="Margin Bottom",
default=1,
help="Margin bottom in millimeters",
required=True,
)
partner_labels_margin_left = fields.Float(
string="Margin Left",
default=1,
help="Margin left in millimeters",
required=True,
)
partner_labels_margin_right = fields.Float(
string="Margin Right",
default=1,
help="Margin right in millimeters",
required=True,
) )

5
partner_label/reports/res_partner.xml

@ -13,7 +13,10 @@
<div t-attf-style="height: {{this.company_id.partner_labels_height}}mm; <div t-attf-style="height: {{this.company_id.partner_labels_height}}mm;
width: {{this.company_id.partner_labels_width}}mm; width: {{this.company_id.partner_labels_width}}mm;
padding: {{this.company_id.partner_labels_padding}}mm; padding: {{this.company_id.partner_labels_padding}}mm;
margin: {{this.company_id.partner_labels_margin}}mm;
margin-top: {{this.company_id.partner_labels_margin_top}}mm;
margin-bottom: {{this.company_id.partner_labels_margin_bottom}}mm;
margin-left: {{this.company_id.partner_labels_margin_left}}mm;
margin-right: {{this.company_id.partner_labels_margin_right}}mm;
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
float:left; float:left;

9
partner_label/views/base_config_settings.xml

@ -10,8 +10,13 @@
<div><field name="partner_labels_width" class="oe_inline" /> mm</div> <div><field name="partner_labels_width" class="oe_inline" /> mm</div>
<label for="partner_labels_height" /> <label for="partner_labels_height" />
<div><field name="partner_labels_height" class="oe_inline" /> mm</div> <div><field name="partner_labels_height" class="oe_inline" /> mm</div>
<label for="partner_labels_margin" />
<div><field name="partner_labels_margin" class="oe_inline" /> mm</div>
<label string="Margin"/>
<div class="oe_inline">
Top: <field name="partner_labels_margin_top" string="Top" class="oe_inline"/>mm,
Bottom: <field name="partner_labels_margin_bottom" string="Bottom" class="oe_inline"/>mm,
Left: <field name="partner_labels_margin_left" string="Left" class="oe_inline"/>mm,
Right: <field name="partner_labels_margin_right" string="Right" class="oe_inline"/>mm
</div>
<label for="partner_labels_padding" /> <label for="partner_labels_padding" />
<div><field name="partner_labels_padding" class="oe_inline" /> mm</div> <div><field name="partner_labels_padding" class="oe_inline" /> mm</div>
<label for="partner_labels_paperformat_id" /> <label for="partner_labels_paperformat_id" />

Loading…
Cancel
Save