[IMP] sale: set default terms and condition for invoice
Purpose: Sales general terms should be printed on the invoices when creating an invoice from scratch. For the moment, the Terms and conditions are linked to the SO. Moreover, Terms and Conditions are not copied for Down Payments invoices Specification: - If the source document is an SO, it should take the Terms and conditions of the SO (in all cases, also with down payments) - If created from scratch, it should take the default Terms and conditions set on the company.
This commit is contained in:
committed by
Yannick Tivisse
parent
db04087b2c
commit
99d5b5afce
@@ -905,7 +905,13 @@ class AccountInvoice(models.Model):
|
||||
def _get_default_team(self):
|
||||
return self.env['crm.team']._get_default_team_id()
|
||||
|
||||
def _default_comment(self):
|
||||
invoice_type = self.env.context.get('type', 'out_invoice')
|
||||
if invoice_type == 'out_invoice':
|
||||
return self.env.user.company_id.sale_note
|
||||
|
||||
team_id = fields.Many2one('crm.team', string='Sales Team', default=_get_default_team, oldname='section_id')
|
||||
comment = fields.Text(default=_default_comment)
|
||||
|
||||
@api.multi
|
||||
def confirm_paid(self):
|
||||
|
||||
@@ -93,6 +93,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
'payment_term_id': order.payment_term_id.id,
|
||||
'fiscal_position_id': order.fiscal_position_id.id or order.partner_id.property_account_position_id.id,
|
||||
'team_id': order.team_id.id,
|
||||
'comment': order.note,
|
||||
})
|
||||
invoice.compute_taxes()
|
||||
invoice.message_post_with_view('mail.message_origin_link',
|
||||
|
||||
Reference in New Issue
Block a user