[MIG] contract: Migration to 14.0

This commit is contained in:
Francisco Ivan Anton Prieto
2021-04-02 13:49:16 +02:00
committed by Christopher Rogos
parent cddd13cf5c
commit 6965b755e0
22 changed files with 62 additions and 127 deletions

View File

@@ -14,13 +14,13 @@ Recurring - Contracts Management
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/13.0/contract :target: https://github.com/OCA/contract/tree/14.0/contract
:alt: OCA/contract :alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract :target: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/110/13.0 :target: https://runbot.odoo-community.org/runbot/110/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -73,12 +73,7 @@ Usage
#. Contract templates can be created from the Configuration -> Contracts -> Contract Templates menu. #. Contract templates can be created from the Configuration -> Contracts -> Contract Templates menu.
They allow to define default journal, price list and lines when creating a contract. They allow to define default journal, price list and lines when creating a contract.
To use it, just select the template on the contract and fields will be filled automatically. To use it, just select the template on the contract and fields will be filled automatically.
#. Contracts are displayed into followers' user portal.
* Contracts appear in portal to following users in every contract:
.. image:: https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-my.png
.. image:: https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-list.png
.. image:: https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-detail.png
Known issues / Roadmap Known issues / Roadmap
====================== ======================
@@ -92,7 +87,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@@ -123,6 +118,7 @@ Contributors
* Vicent Cubells * Vicent Cubells
* Rafael Blasco * Rafael Blasco
* Víctor Martínez * Víctor Martínez
* Iván Antón <ozono@ozonomultimedia.com>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -137,6 +133,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/13.0/contract>`_ project on GitHub. This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/14.0/contract>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -11,7 +11,7 @@
{ {
"name": "Recurring - Contracts Management", "name": "Recurring - Contracts Management",
"version": "13.0.2.3.7", "version": "14.0.1.0.0",
"category": "Contract Management", "category": "Contract Management",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)", "author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)",

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding='UTF-8' ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1"> <odoo noupdate="1">
<record model="ir.cron" id="contract_cron_for_invoice"> <record model="ir.cron" id="contract_cron_for_invoice">
<field name="name">Generate Recurring Invoices from Contracts</field> <field name="name">Generate Recurring Invoices from Contracts</field>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding='UTF-8' ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1"> <odoo noupdate="1">
<record model="ir.cron" id="contract_line_cron_for_renew"> <record model="ir.cron" id="contract_line_cron_for_renew">
<field name="name">Renew Contract lines</field> <field name="name">Renew Contract lines</field>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1"> <odoo noupdate="1">
<record id="mail_message_subtype_invoice_created" model="mail.message.subtype"> <record id="mail_message_subtype_invoice_created" model="mail.message.subtype">
<field name="name">Invoice created</field> <field name="name">Invoice created</field>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1"> <odoo noupdate="1">
<record id="email_contract_template" model="mail.template"> <record id="email_contract_template" model="mail.template">
<field name="name">Email Contract Template</field> <field name="name">Email Contract Template</field>

View File

@@ -1,28 +0,0 @@
<?xml version='1.0' encoding='utf-8' ?>
<odoo>
<record id="rule_contract_contract_multi_company" model="ir.rule">
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
</record>
<record id="rule_contract_line_multi_company" model="ir.rule">
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
</record>
<record id="rule_contract_template_multi_company" model="ir.rule">
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
</record>
<record id="rule_contract_template_line_multi_company" model="ir.rule">
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
</record>
<record id="contract_tag_multi_company_rule" model="ir.rule">
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
</record>
</odoo>

View File

@@ -1,33 +0,0 @@
# Copyright 2020-2021 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade # pylint: disable=W7936
@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move am
SET old_contract_id = ai.old_contract_id
FROM account_invoice ai
WHERE ai.id = am.old_invoice_id
AND ai.old_contract_id IS NOT NULL""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move_line aml
SET contract_line_id = ail.contract_line_id
FROM account_invoice_line ail
WHERE ail.id = aml.old_invoice_line_id
AND ail.contract_line_id IS NOT NULL""",
)
openupgrade.load_data(
env.cr, "contract", "migrations/13.0.1.0.0/noupdate_changes.xml"
)
# Don't alter line recurrence v12 behavior
contracts = env["contract.contract"].search([])
contracts.write({"line_recurrence": True})

View File

@@ -186,8 +186,8 @@ class ContractAbstractContractLine(models.AbstractModel):
if line.automatic_price: if line.automatic_price:
pricelist = ( pricelist = (
line.contract_id.pricelist_id line.contract_id.pricelist_id
or line.contract_id.partner_id.with_context( or line.contract_id.partner_id.with_company(
force_company=line.contract_id.company_id.id, line.contract_id.company_id
).property_product_pricelist ).property_product_pricelist
) )
product = line.product_id.with_context( product = line.product_id.with_context(

View File

@@ -239,8 +239,8 @@ class ContractContract(models.Model):
# Use pricelist currency # Use pricelist currency
currency = ( currency = (
self.pricelist_id.currency_id self.pricelist_id.currency_id
or self.partner_id.with_context( or self.partner_id.with_company(
force_company=self.company_id.id, self.company_id
).property_product_pricelist.currency_id ).property_product_pricelist.currency_id
) )
return currency or self.journal_id.currency_id or self.company_id.currency_id return currency or self.journal_id.currency_id or self.company_id.currency_id
@@ -360,7 +360,7 @@ class ContractContract(models.Model):
partner = ( partner = (
self.partner_id self.partner_id
if not self.company_id if not self.company_id
else self.partner_id.with_context(force_company=self.company_id.id) else self.partner_id.with_company(self.company_id)
) )
self.pricelist_id = partner.property_product_pricelist.id self.pricelist_id = partner.property_product_pricelist.id
self.fiscal_position_id = partner.env[ self.fiscal_position_id = partner.env[
@@ -423,9 +423,9 @@ class ContractContract(models.Model):
if self.contract_type == "purchase": if self.contract_type == "purchase":
invoice_type = "in_invoice" invoice_type = "in_invoice"
move_form = Form( move_form = Form(
self.env["account.move"].with_context( self.env["account.move"]
force_company=self.company_id.id, default_type=invoice_type .with_company(self.company_id)
) .with_context(default_move_type=invoice_type)
) )
move_form.partner_id = self.invoice_partner_id move_form.partner_id = self.invoice_partner_id
if self.payment_term_id: if self.payment_term_id:
@@ -491,11 +491,11 @@ class ContractContract(models.Model):
""" """
self.ensure_one() self.ensure_one()
def can_be_invoiced(l): def can_be_invoiced(contract_line):
return ( return (
not l.is_canceled not contract_line.is_canceled
and l.recurring_next_date and contract_line.recurring_next_date
and l.recurring_next_date <= date_ref and contract_line.recurring_next_date <= date_ref
) )
lines2invoice = previous = self.env["contract.line"] lines2invoice = previous = self.env["contract.line"]

View File

@@ -382,7 +382,10 @@ class ContractLine(models.Model):
@api.constrains("predecessor_contract_line_id", "date_start") @api.constrains("predecessor_contract_line_id", "date_start")
def _check_overlap_predecessor(self): def _check_overlap_predecessor(self):
for rec in self: for rec in self:
if rec.predecessor_contract_line_id: if (
rec.predecessor_contract_line_id
and rec.predecessor_contract_line_id.date_end
):
if rec.date_start <= rec.predecessor_contract_line_id.date_end: if rec.date_start <= rec.predecessor_contract_line_id.date_end:
raise ValidationError( raise ValidationError(
_("Contract line and its predecessor overlapped") _("Contract line and its predecessor overlapped")

View File

@@ -71,10 +71,10 @@ class ResPartner(models.Model):
def _get_act_window_contract_xml(self, contract_type): def _get_act_window_contract_xml(self, contract_type):
if contract_type == "purchase": if contract_type == "purchase":
return self.env["ir.actions.act_window"].for_xml_id( return self.env["ir.actions.act_window"]._for_xml_id(
"contract", "action_supplier_contract" "contract.action_supplier_contract"
) )
else: else:
return self.env["ir.actions.act_window"].for_xml_id( return self.env["ir.actions.act_window"]._for_xml_id(
"contract", "action_customer_contract" "contract.action_customer_contract"
) )

View File

@@ -13,3 +13,4 @@
* Vicent Cubells * Vicent Cubells
* Rafael Blasco * Rafael Blasco
* Víctor Martínez * Víctor Martínez
* Iván Antón <ozono@ozonomultimedia.com>

View File

@@ -23,9 +23,4 @@
#. Contract templates can be created from the Configuration -> Contracts -> Contract Templates menu. #. Contract templates can be created from the Configuration -> Contracts -> Contract Templates menu.
They allow to define default journal, price list and lines when creating a contract. They allow to define default journal, price list and lines when creating a contract.
To use it, just select the template on the contract and fields will be filled automatically. To use it, just select the template on the contract and fields will be filled automatically.
#. Contracts are displayed into followers' user portal.
* Contracts appear in portal to following users in every contract:
.. image:: ../static/src/screenshots/portal-my.png
.. image:: ../static/src/screenshots/portal-list.png
.. image:: ../static/src/screenshots/portal-detail.png

View File

@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<report
id="report_contract" <record id="report_contract" model="ir.actions.report">
model="contract.contract" <field name="name">Contract</field>
string="Contract" <field name="model">contract.contract</field>
report_type="qweb-pdf" <field name="report_type">qweb-pdf</field>
name="contract.report_contract_document" <field name="report_name">contract.report_contract_document</field>
file="contract.report_contract" <field name="report_file">contract.report_contract</field>
/> <field name="binding_model_id" ref="model_contract_contract" />
<field name="binding_type">report</field>
</record>
</odoo> </odoo>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<template id="report_contract_document"> <template id="report_contract_document">
<t t-call="web.html_container"> <t t-call="web.html_container">
@@ -30,7 +30,6 @@
<div class="row" id="invoice_info"> <div class="row" id="invoice_info">
<t t-set="total" t-value="0" /> <t t-set="total" t-value="0" />
<div class="col-12"> <div class="col-12">
<t t-set="total" t-value="0" />
<p id="services_info"> <p id="services_info">
<strong>Recurring Items</strong> <strong>Recurring Items</strong>
</p> </p>

View File

@@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8' ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1"> <odoo noupdate="1">
<record id="rule_contract_contract_multi_company" model="ir.rule"> <record id="rule_contract_contract_multi_company" model="ir.rule">
<field name="name">Contract contract multi-company</field> <field name="name">Contract contract multi-company</field>

View File

@@ -11,3 +11,6 @@
"contract_template_line_user","Recurring user","model_contract_template_line","account.group_account_invoice",1,0,0,0 "contract_template_line_user","Recurring user","model_contract_template_line","account.group_account_invoice",1,0,0,0
"contract_modification_user","Contract modifications - User","model_contract_modification","account.group_account_invoice",1,1,1,1 "contract_modification_user","Contract modifications - User","model_contract_modification","account.group_account_invoice",1,1,1,1
"contract_modification_portal","Contract modifications - Portal","model_contract_modification","base.group_portal",1,0,0,0 "contract_modification_portal","Contract modifications - Portal","model_contract_modification","base.group_portal",1,0,0,0
"contract_line_wizard","contract_line_wizard","model_contract_line_wizard","account.group_account_manager",1,1,1,1
"contract_manually_create_invoice_wizard","contract_manually_create_invoice_wizard","model_contract_manually_create_invoice","account.group_account_invoice",1,1,1,1
"contract_contract_terminate_wizard","contract_contract_terminate_wizard","model_contract_contract_terminate","contract.can_terminate_contract",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
11 contract_template_line_user Recurring user model_contract_template_line account.group_account_invoice 1 0 0 0
12 contract_modification_user Contract modifications - User model_contract_modification account.group_account_invoice 1 1 1 1
13 contract_modification_portal Contract modifications - Portal model_contract_modification base.group_portal 1 0 0 0
14 contract_line_wizard contract_line_wizard model_contract_line_wizard account.group_account_manager 1 1 1 1
15 contract_manually_create_invoice_wizard contract_manually_create_invoice_wizard model_contract_manually_create_invoice account.group_account_invoice 1 1 1 1
16 contract_contract_terminate_wizard contract_contract_terminate_wizard model_contract_contract_terminate contract.can_terminate_contract 1 1 1 1

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Recurring - Contracts Management</title> <title>Recurring - Contracts Management</title>
<style type="text/css"> <style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/contract/tree/13.0/contract"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/110/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/contract/tree/14.0/contract"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/110/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module enables contracts management with recurring <p>This module enables contracts management with recurring
invoicing functions. Also you can print and send by email contract report.</p> invoicing functions. Also you can print and send by email contract report.</p>
<p>It works for customer contract and supplier contracts.</p> <p>It works for customer contract and supplier contracts.</p>
@@ -421,13 +421,8 @@ contract.</li>
<li>Contract templates can be created from the Configuration -&gt; Contracts -&gt; Contract Templates menu. <li>Contract templates can be created from the Configuration -&gt; Contracts -&gt; Contract Templates menu.
They allow to define default journal, price list and lines when creating a contract. They allow to define default journal, price list and lines when creating a contract.
To use it, just select the template on the contract and fields will be filled automatically.</li> To use it, just select the template on the contract and fields will be filled automatically.</li>
<li>Contracts are displayed into followers user portal.</li>
</ol> </ol>
<ul class="simple">
<li>Contracts appear in portal to following users in every contract:</li>
</ul>
<img alt="https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-my.png" src="https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-my.png" />
<img alt="https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-list.png" src="https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-list.png" />
<img alt="https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-detail.png" src="https://raw.githubusercontent.com/OCA/contract/13.0/contract/static/src/screenshots/portal-detail.png" />
</div> </div>
<div class="section" id="known-issues-roadmap"> <div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id3">Known issues / Roadmap</a></h1> <h1><a class="toc-backref" href="#id3">Known issues / Roadmap</a></h1>
@@ -441,7 +436,7 @@ To use it, just select the template on the contract and fields will be filled au
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -481,6 +476,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</ul> </ul>
</blockquote> </blockquote>
</li> </li>
<li><p class="first">Iván Antón &lt;<a class="reference external" href="mailto:ozono&#64;ozonomultimedia.com">ozono&#64;ozonomultimedia.com</a>&gt;</p>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@@ -490,7 +487,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/13.0/contract">OCA/contract</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/14.0/contract">OCA/contract</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@@ -119,7 +119,6 @@ class TestContractBase(common.SavepointCase):
"is_auto_renew": False, "is_auto_renew": False,
} }
cls.acct_line = cls.env["contract.line"].create(cls.line_vals) cls.acct_line = cls.env["contract.line"].create(cls.line_vals)
cls.acct_line.product_id.is_auto_renew = True
cls.contract.company_id.create_new_line_at_contract_line_renew = True cls.contract.company_id.create_new_line_at_contract_line_renew = True
cls.terminate_reason = cls.env["contract.terminate.reason"].create( cls.terminate_reason = cls.env["contract.terminate.reason"].create(
{"name": "terminate_reason"} {"name": "terminate_reason"}
@@ -566,7 +565,7 @@ class TestContract(TestContractBase):
self.contract._onchange_contract_type() self.contract._onchange_contract_type()
self.assertEqual(self.contract.journal_id.type, "sale") self.assertEqual(self.contract.journal_id.type, "sale")
self.assertEqual(self.contract.journal_id.company_id, self.contract.company_id) self.assertEqual(self.contract.journal_id.company_id, self.contract.company_id)
self.contract.type = "purchase" self.contract.contract_type = "purchase"
self.contract._onchange_contract_type() self.contract._onchange_contract_type()
self.assertFalse(any(self.contract.contract_line_ids.mapped("automatic_price"))) self.assertFalse(any(self.contract.contract_line_ids.mapped("automatic_price")))
@@ -2211,8 +2210,8 @@ class TestContract(TestContractBase):
# Assume contract 2 is for company 2 # Assume contract 2 is for company 2
self.contract2.company_id = company2 self.contract2.company_id = company2
# Update the partner attached to both contracts # Update the partner attached to both contracts
self.partner.with_user(unprivileged_user).with_context( self.partner.with_user(unprivileged_user).with_company(company2).with_context(
company_id=company2.id, force_company=company2.id company_id=company2.id
).write({"is_company": False, "parent_id": parent_partner.id}) ).write({"is_company": False, "parent_id": parent_partner.id})
def test_sale_fields_view_get(self): def test_sale_fields_view_get(self):

View File

@@ -14,7 +14,7 @@ class TestContractPortal(odoo.tests.HttpCase):
) )
user_portal = self.env.ref("base.demo_user0") user_portal = self.env.ref("base.demo_user0")
contract.message_subscribe(partner_ids=user_portal.partner_id.ids) contract.message_subscribe(partner_ids=user_portal.partner_id.ids)
self.phantom_js( self.browser_js(
"/", "/",
"odoo.__DEBUG__.services['web_tour.tour'].run('contract_portal_tour')", "odoo.__DEBUG__.services['web_tour.tour'].run('contract_portal_tour')",
"odoo.__DEBUG__.services['web_tour.tour'].tours.contract_portal_tour.ready", "odoo.__DEBUG__.services['web_tour.tour'].tours.contract_portal_tour.ready",

View File

@@ -25,7 +25,7 @@
contract to invoice contract to invoice
</span> </span>
<span <span
attrs="{'invisible': [('contract_to_invoice_count', '&lt;', 1)]}" attrs="{'invisible': [('contract_to_invoice_count', '&lt;=', 1)]}"
> >
contracts to invoice contracts to invoice
</span> </span>