mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MV] - move onchange method to contract_product module
[RMV] - Remove useless check
This commit is contained in:
@@ -205,23 +205,3 @@ class AccountAbstractAnalyticContractLine(models.AbstractModel):
|
||||
vals['price_unit'] = product.price
|
||||
self.update(vals)
|
||||
return {'domain': domain}
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id_recurring_info(self):
|
||||
for rec in self:
|
||||
rec.date_start = fields.Date.today()
|
||||
if rec.product_id.is_contract:
|
||||
rec.recurring_rule_type = rec.product_id.recurring_rule_type
|
||||
rec.recurring_invoicing_type = (
|
||||
rec.product_id.recurring_invoicing_type
|
||||
)
|
||||
rec.recurring_interval = rec.product_id.recurring_interval
|
||||
rec.is_auto_renew = rec.product_id.is_auto_renew
|
||||
rec.auto_renew_interval = rec.product_id.auto_renew_interval
|
||||
rec.auto_renew_rule_type = rec.product_id.auto_renew_rule_type
|
||||
rec.termination_notice_interval = (
|
||||
rec.product_id.termination_notice_interval
|
||||
)
|
||||
rec.termination_notice_rule_type = (
|
||||
rec.product_id.termination_notice_rule_type
|
||||
)
|
||||
|
||||
@@ -157,7 +157,7 @@ class AccountAnalyticAccount(models.Model):
|
||||
for contract in self.filtered('recurring_invoices'):
|
||||
if not contract.partner_id:
|
||||
raise ValidationError(
|
||||
_("You must supply a customer for the contract '%s'")
|
||||
_("You must supply a partner for the contract '%s'")
|
||||
% contract.name
|
||||
)
|
||||
|
||||
@@ -180,17 +180,6 @@ class AccountAnalyticAccount(models.Model):
|
||||
@api.multi
|
||||
def _prepare_invoice(self, date_invoice, journal=None):
|
||||
self.ensure_one()
|
||||
if not self.partner_id:
|
||||
if self.contract_type == 'purchase':
|
||||
raise ValidationError(
|
||||
_("You must first select a Supplier for Contract %s!")
|
||||
% self.name
|
||||
)
|
||||
else:
|
||||
raise ValidationError(
|
||||
_("You must first select a Customer for Contract %s!")
|
||||
% self.name
|
||||
)
|
||||
if not journal:
|
||||
journal = (
|
||||
self.journal_id
|
||||
|
||||
Reference in New Issue
Block a user