[FIX+IMP] contract: several things

[FIX] - as date_start is required, constraints on it become useless
[FIX] - for finished contract _get_lines_to_invoice should return False
[FIX] - default value for active field in contract line
[FIX] - fix flake8
[IMP] - check invoice line vals before assignment
[FIX] - Fix unit tests.
[FIX] - do not copy last_date_invoiced on plan_successor
[FIX] - renew only recurring_invoices contract
[FIX] - filter by termination_notice for contract line to renew
[IMP] - Improve inprogress search filter
[IMP] - Link invoice line to contract lines
[IMP] - Add index on contract line
[IMP] - Add is_suspended flag and _search_state
[IMP] - Add is_suspended flag to stop contract line
[MV] - move onchange method to contract_product module
[IMP] - Replace is_suspended flag by manual_renew_needed
  Add a computed field for the first date of the termination notice period
  Adapt state compute and search method
[IMP] - Improve unit tests
This commit is contained in:
sbejaoui
2018-12-20 21:50:30 +01:00
committed by Pedro M. Baeza
parent 9d07a8608b
commit 36d4d0e949
14 changed files with 843 additions and 341 deletions

View File

@@ -13,16 +13,26 @@ class AccountAnalyticInvoiceLineWizard(models.TransientModel):
date_end = fields.Date(string='Date End')
recurring_next_date = fields.Date(string='Next Invoice Date')
is_auto_renew = fields.Boolean(string="Auto Renew", default=False)
manual_renew_needed = fields.Boolean(
string="Manual renew needed",
default=False,
help="This flag is used to make a difference between a definitive stop"
"and temporary one for which a user is not able to plan a"
"successor in advance",
)
contract_line_id = fields.Many2one(
comodel_name="account.analytic.invoice.line",
string="Contract Line",
required=True,
index=True,
)
@api.multi
def stop(self):
for wizard in self:
wizard.contract_line_id.stop(wizard.date_end)
wizard.contract_line_id.stop(
wizard.date_end, manual_renew_needed=wizard.manual_renew_needed
)
return True
@api.multi

View File

@@ -12,6 +12,7 @@
<group>
<field name="contract_line_id" invisible="True"/>
<field string="Stop Date" name="date_end" required="True"/>
<field string="Is a suspension" name="manual_renew_needed"/>
</group>
<footer>
<button name="stop"