changes
This commit is contained in:
@@ -1408,10 +1408,10 @@ class SaleOrder(models.Model):
|
||||
pdf_content, _ = inv_report._render_qweb_pdf(
|
||||
inv_report.report_name, [invoice.id]
|
||||
)
|
||||
inv_filename = (
|
||||
f"{self.name} - {type_label} - "
|
||||
f"{invoice.name or 'Draft'}.pdf"
|
||||
)
|
||||
name_parts = (self.partner_id.name or 'Client').strip().split()
|
||||
first = name_parts[0] if name_parts else 'Client'
|
||||
last = name_parts[-1] if len(name_parts) > 1 else ''
|
||||
inv_filename = f"{first}_{last}_{type_label}_{invoice.name or 'Draft'}.pdf"
|
||||
inv_attach = self.env['ir.attachment'].create({
|
||||
'name': inv_filename,
|
||||
'type': 'binary',
|
||||
|
||||
@@ -54,10 +54,17 @@ class SaleOrderLine(models.Model):
|
||||
def unlink(self):
|
||||
deposit_lines = self.env['sale.order.line']
|
||||
for line in self:
|
||||
if not line.exists():
|
||||
continue
|
||||
if line.is_rental and not line.is_security_deposit:
|
||||
deposit_lines |= line.order_id.order_line.filtered(
|
||||
lambda l: l.rental_deposit_source_line_id == line
|
||||
deps = line.order_id.order_line.filtered(
|
||||
lambda l: (
|
||||
l.exists()
|
||||
and l.rental_deposit_source_line_id == line
|
||||
)
|
||||
)
|
||||
deposit_lines |= deps
|
||||
deposit_lines = deposit_lines.exists() - self
|
||||
if deposit_lines:
|
||||
deposit_lines.unlink()
|
||||
return super().unlink()
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
<field name="rental_auto_renew"/>
|
||||
<field name="rental_auto_renew_off_reason"
|
||||
invisible="rental_auto_renew"
|
||||
required="not rental_auto_renew"
|
||||
required="is_rental_order and not rental_auto_renew"
|
||||
placeholder="Reason for disabling auto-renewal..."/>
|
||||
<field name="rental_max_renewals"
|
||||
invisible="not rental_auto_renew"/>
|
||||
|
||||
Reference in New Issue
Block a user