mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-26 16:12:08 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -16,20 +16,21 @@ class ProductLabelLayout(models.TransientModel):
|
|||
('4x7xprice', '4 x 7 with price'),
|
||||
('4x12', '4 x 12'),
|
||||
('4x12xprice', '4 x 12 with price')], string="Format", default='2x7xprice', required=True)
|
||||
custom_quantity = fields.Integer('Quantity', default=1, required=True)
|
||||
custom_quantity = fields.Integer('Copies', default=1, required=True)
|
||||
product_ids = fields.Many2many('product.product')
|
||||
product_tmpl_ids = fields.Many2many('product.template')
|
||||
extra_html = fields.Html('Extra Content', default='')
|
||||
rows = fields.Integer(compute='_compute_dimensions')
|
||||
columns = fields.Integer(compute='_compute_dimensions')
|
||||
pricelist_id = fields.Many2one('product.pricelist', string="Pricelist")
|
||||
|
||||
@api.depends('print_format')
|
||||
def _compute_dimensions(self):
|
||||
for wizard in self:
|
||||
if 'x' in wizard.print_format:
|
||||
columns, rows = wizard.print_format.split('x')[:2]
|
||||
wizard.columns = int(columns)
|
||||
wizard.rows = int(rows)
|
||||
wizard.columns = columns.isdigit() and int(columns) or 1
|
||||
wizard.rows = rows.isdigit() and int(rows) or 1
|
||||
else:
|
||||
wizard.columns, wizard.rows = 1, 1
|
||||
|
||||
|
|
@ -41,7 +42,9 @@ class ProductLabelLayout(models.TransientModel):
|
|||
if self.print_format == 'dymo':
|
||||
xml_id = 'product.report_product_template_label_dymo'
|
||||
elif 'x' in self.print_format:
|
||||
xml_id = 'product.report_product_template_label'
|
||||
xml_id = 'product.report_product_template_label_%sx%s' % (self.columns, self.rows)
|
||||
if 'xprice' not in self.print_format:
|
||||
xml_id += '_noprice'
|
||||
else:
|
||||
xml_id = ''
|
||||
|
||||
|
|
@ -69,6 +72,6 @@ class ProductLabelLayout(models.TransientModel):
|
|||
xml_id, data = self._prepare_report_data()
|
||||
if not xml_id:
|
||||
raise UserError(_('Unable to find report template for %s format', self.print_format))
|
||||
report_action = self.env.ref(xml_id).report_action(None, data=data)
|
||||
report_action = self.env.ref(xml_id).report_action(None, data=data, config=False)
|
||||
report_action.update({'close_on_report_download': True})
|
||||
return report_action
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue