diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py
index ee22f64f699..6e5e55328a9 100644
--- a/addons/account/models/account_invoice.py
+++ b/addons/account/models/account_invoice.py
@@ -97,6 +97,11 @@ class AccountInvoice(models.Model):
journal = self._default_journal()
return journal.currency_id or journal.company_id.currency_id or self.env.user.company_id.currency_id
+ def _default_comment(self):
+ invoice_type = self.env.context.get('type', 'out_invoice')
+ if invoice_type == 'out_invoice' and self.env['ir.config_parameter'].sudo().get_param('account.use_invoice_terms'):
+ return self.env.user.company_id.invoice_terms
+
@api.one
@api.depends(
'state', 'currency_id', 'invoice_line_ids.price_subtotal',
@@ -255,7 +260,7 @@ class AccountInvoice(models.Model):
help="Technical field holding the number given to the invoice, automatically set when the invoice is validated then stored to set the same number again if the invoice is cancelled, set to draft and re-validated.")
reference = fields.Char(string='Payment Ref.', copy=False, readonly=True, states={'draft': [('readonly', False)]},
help='The payment communication that will be automatically populated once the invoice validation. You can also write a free communication.')
- comment = fields.Text('Additional Information', readonly=True, states={'draft': [('readonly', False)]})
+ comment = fields.Text('Additional Information', readonly=True, states={'draft': [('readonly', False)]}, default=_default_comment)
state = fields.Selection([
('draft','Draft'),
diff --git a/addons/account/models/company.py b/addons/account/models/company.py
index 3ddd4881f66..45f5934d497 100644
--- a/addons/account/models/company.py
+++ b/addons/account/models/company.py
@@ -104,6 +104,7 @@ Best Regards,'''))
# account dashboard onboarding
account_invoice_onboarding_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done"), ('closed', "Closed")], string="State of the account invoice onboarding panel", default='not_done')
account_dashboard_onboarding_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done"), ('closed', "Closed")], string="State of the account dashboard onboarding panel", default='not_done')
+ invoice_terms = fields.Text(string='Default Terms and Conditions', translate=True)
@api.constrains('account_opening_date', 'fiscalyear_last_day', 'fiscalyear_last_month')
def _check_fiscalyear_last_day(self):
diff --git a/addons/account/models/res_config_settings.py b/addons/account/models/res_config_settings.py
index d3b118c4c2d..38b9d4e8647 100644
--- a/addons/account/models/res_config_settings.py
+++ b/addons/account/models/res_config_settings.py
@@ -91,6 +91,11 @@ class ResConfigSettings(models.TransientModel):
invoice_is_print = fields.Boolean(string='Print', related='company_id.invoice_is_print', readonly=False)
invoice_is_email = fields.Boolean(string='Send Email', related='company_id.invoice_is_email', readonly=False)
incoterm_id = fields.Many2one('account.incoterms', string='Default incoterm', related='company_id.incoterm_id', help='International Commercial Terms are a series of predefined commercial terms used in international transactions.', readonly=False)
+ invoice_terms = fields.Text(related='company_id.invoice_terms', string="Terms & Conditions", readonly=False)
+ use_invoice_terms = fields.Boolean(
+ string='Default Terms & Conditions',
+ oldname='default_use_sale_note',
+ config_parameter='account.use_invoice_terms')
@api.multi
def set_values(self):
diff --git a/addons/account/views/res_config_settings_views.xml b/addons/account/views/res_config_settings_views.xml
index 7d2847ed404..fb263e4be5a 100644
--- a/addons/account/views/res_config_settings_views.xml
+++ b/addons/account/views/res_config_settings_views.xml
@@ -486,6 +486,23 @@
+
+
+
+
+
+
+
+
+ Show standard terms & conditions on invoices/orders
+
+
+
+
diff --git a/addons/sale/models/account_invoice.py b/addons/sale/models/account_invoice.py
index b0df38a6a53..29fa6b64f1b 100644
--- a/addons/sale/models/account_invoice.py
+++ b/addons/sale/models/account_invoice.py
@@ -11,13 +11,7 @@ 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' and self.env['ir.config_parameter'].sudo().get_param('sale.use_sale_note'):
- 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)
partner_shipping_id = fields.Many2one(
'res.partner',
string='Delivery Address',
@@ -48,7 +42,7 @@ class AccountInvoice(models.Model):
self.partner_shipping_id = addr and addr.get('delivery')
if self.env.context.get('type', 'out_invoice') == 'out_invoice':
company = self.company_id or self.env.user.company_id
- self.comment = company.with_context(lang=self.partner_id.lang).sale_note
+ self.comment = company.with_context(lang=self.partner_id.lang).invoice_terms
@api.multi
def action_invoice_open(self):
diff --git a/addons/sale/models/res_company.py b/addons/sale/models/res_company.py
index 75df3b56ea1..6d6cfccc87c 100644
--- a/addons/sale/models/res_company.py
+++ b/addons/sale/models/res_company.py
@@ -7,7 +7,6 @@ from odoo import api, fields, models, _
class ResCompany(models.Model):
_inherit = "res.company"
- sale_note = fields.Text(string='Default Terms and Conditions', translate=True)
portal_confirmation_sign = fields.Boolean(string='Online Signature')
portal_confirmation_pay = fields.Boolean(string='Online Payment')
quotation_validity_days = fields.Integer(default=30, string="Default Quotation Validity (Days)")
diff --git a/addons/sale/models/res_config_settings.py b/addons/sale/models/res_config_settings.py
index 0a5060483a4..27315c8d5a2 100644
--- a/addons/sale/models/res_config_settings.py
+++ b/addons/sale/models/res_config_settings.py
@@ -7,11 +7,6 @@ from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
- sale_note = fields.Text(related='company_id.sale_note', string="Terms & Conditions", readonly=False)
- use_sale_note = fields.Boolean(
- string='Default Terms & Conditions',
- oldname='default_use_sale_note',
- config_parameter='sale.use_sale_note')
group_discount_per_so_line = fields.Boolean("Discounts", implied_group='sale.group_discount_per_so_line')
module_sale_margin = fields.Boolean("Margins")
quotation_validity_days = fields.Integer(related='company_id.quotation_validity_days', string="Default Quotation Validity (Days)", readonly=False)
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py
index c0444d4391c..951ca60d204 100644
--- a/addons/sale/models/sale.py
+++ b/addons/sale/models/sale.py
@@ -101,7 +101,7 @@ class SaleOrder(models.Model):
@api.model
def _default_note(self):
- return self.env['ir.config_parameter'].sudo().get_param('sale.use_sale_note') and self.env.user.company_id.sale_note or ''
+ return self.env['ir.config_parameter'].sudo().get_param('account.use_invoice_terms') and self.env.user.company_id.invoice_terms or ''
@api.model
def _get_default_team(self):
@@ -306,8 +306,8 @@ class SaleOrder(models.Model):
'partner_shipping_id': addr['delivery'],
'user_id': self.partner_id.user_id.id or self.env.uid
}
- if self.env['ir.config_parameter'].sudo().get_param('sale.use_sale_note') and self.env.user.company_id.sale_note:
- values['note'] = self.with_context(lang=self.partner_id.lang).env.user.company_id.sale_note
+ if self.env['ir.config_parameter'].sudo().get_param('account.use_invoice_terms') and self.env.user.company_id.invoice_terms:
+ values['note'] = self.with_context(lang=self.partner_id.lang).env.user.company_id.invoice_terms
# Use team of saleman before to fallback on team of partner.
values['team_id'] = self.partner_id.user_id and self.partner_id.user_id.sale_team_id.id or self.partner_id.team_id.id
diff --git a/addons/sale/views/res_config_settings_views.xml b/addons/sale/views/res_config_settings_views.xml
index fccc6ac8d53..eaa3333f9d1 100644
--- a/addons/sale/views/res_config_settings_views.xml
+++ b/addons/sale/views/res_config_settings_views.xml
@@ -177,23 +177,6 @@
-
-
-
-
-
-
-
-
- Show standard terms & conditions on orders
-
-
-
-
diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml
index 3b6598fb00b..4ab035c4d46 100644
--- a/addons/website_sale/views/templates.xml
+++ b/addons/website_sale/views/templates.xml
@@ -1695,7 +1695,7 @@