Skip to content

Commit

Permalink
[IMP] agreement: pre-commit execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Tran committed Nov 28, 2024
1 parent bcb4697 commit a81443c
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 40 deletions.
38 changes: 19 additions & 19 deletions agreement/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ Agreement
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fagreement-lightgray.png?logo=github
:target: https://github.com/OCA/agreement/tree/17.0/agreement
:target: https://github.com/OCA/agreement/tree/18.0/agreement
:alt: OCA/agreement
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/agreement-17-0/agreement-17-0-agreement
:target: https://translation.odoo-community.org/projects/agreement-18-0/agreement-18-0-agreement
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/agreement&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/agreement&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds an *Agreement* object with the following properties:

- code,
- name,
- link to a partner,
- signature date.
- start date.
- end date.
- code,
- name,
- link to a partner,
- signature date.
- start date.
- end date.

Optionally, you can also enable using: \* agreement types \* a flag to
set an agreement as a template agreement
Expand All @@ -53,7 +53,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/agreement/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/agreement/issues/new?body=module:%20agreement%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/agreement/issues/new?body=module:%20agreement%0Aversion:%2018.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.

Expand All @@ -69,21 +69,21 @@ Authors
Contributors
------------

- Alexis de Lattre <[email protected]>
- Alexis de Lattre <[email protected]>

- Yves Goldberg <[email protected]>
- Yves Goldberg <[email protected]>

- Alexandre Fayolle <[email protected]>
- Alexandre Fayolle <[email protected]>

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Sergio Teruel
- Sergio Teruel

- Tharathip Chaweewongphan <[email protected]>
- Tharathip Chaweewongphan <[email protected]>

- `Acsone <https://www.acsone.eu/>`__:
- `Acsone <https://www.acsone.eu/>`__:

- Maxime Franco
- Maxime Franco

Maintainers
-----------
Expand All @@ -109,6 +109,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ygol| |maintainer-alexis-via|

This module is part of the `OCA/agreement <https://github.com/OCA/agreement/tree/17.0/agreement>`_ project on GitHub.
This module is part of the `OCA/agreement <https://github.com/OCA/agreement/tree/18.0/agreement>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 4 additions & 4 deletions agreement/models/agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo import _, api, fields, models
from odoo import api, fields, models


class Agreement(models.Model):
Expand Down Expand Up @@ -51,8 +51,8 @@ class Agreement(models.Model):
@api.model
def _domain_selection(self):
return [
("sale", _("Sale")),
("purchase", _("Purchase")),
("sale", self.env._("Sale")),
("purchase", self.env._("Purchase")),
]

@api.depends("agreement_type_id")
Expand Down Expand Up @@ -85,5 +85,5 @@ def copy(self, default=None):
default = dict(default or {})
if default.get("code", False):
return super().copy(default)
default.setdefault("code", _("%(code)s (copy)", code=self.code))
default.setdefault("code", self.env._("%(code)s (copy)", code=self.code))
return super().copy(default)
6 changes: 3 additions & 3 deletions agreement/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Agreement</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a5e80d1f0971cd20d3ee576f92a2af86742eadaa4eb3f7796912154f6027f802
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/agreement/tree/17.0/agreement"><img alt="OCA/agreement" src="https://img.shields.io/badge/github-OCA%2Fagreement-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/agreement-17-0/agreement-17-0-agreement"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/agreement&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/agreement/tree/18.0/agreement"><img alt="OCA/agreement" src="https://img.shields.io/badge/github-OCA%2Fagreement-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/agreement-18-0/agreement-18-0-agreement"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/agreement&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds an <em>Agreement</em> object with the following properties:</p>
<ul class="simple">
<li>code,</li>
Expand Down Expand Up @@ -399,7 +399,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/agreement/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/agreement/issues/new?body=module:%20agreement%0Aversion:%2017.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/agreement/issues/new?body=module:%20agreement%0Aversion:%2018.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>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -447,7 +447,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/ygol"><img alt="ygol" src="https://github.com/ygol.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/alexis-via"><img alt="alexis-via" src="https://github.com/alexis-via.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/agreement/tree/17.0/agreement">OCA/agreement</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/agreement/tree/18.0/agreement">OCA/agreement</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>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion agreement/tests/test_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ def test_copy(self):
agreement1 = self.agreement.copy(default={"code": "Test Code"})
agreement2 = self.agreement.copy()
self.assertEqual(agreement1.code, "Test Code")
self.assertEqual(agreement2.code, "%s (copy)" % (self.agreement.code))
self.assertEqual(agreement2.code, f"{self.agreement.code} (copy)")
16 changes: 5 additions & 11 deletions agreement/views/agreement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
bg_color="bg-danger"
invisible="active"
/>
<field name="active" invisible="1" />
<div class="oe_title">
<label
for="name"
Expand All @@ -31,7 +30,6 @@
<group name="main">
<group name="left">
<field name="code" />
<field name="is_template" invisible="1" />
<field name="partner_id" required="not is_template" />
<field
name="agreement_type_id"
Expand All @@ -57,19 +55,15 @@
<page name="config" string="Configuration" invisible="True" />
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
<chatter />
</form>
</field>
</record>
<record id="agreement_tree" model="ir.ui.view">
<field name="name">agreement.tree</field>
<field name="name">agreement.list</field>
<field name="model">agreement</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="partner_id" />
<field name="code" />
<field name="name" />
Expand All @@ -78,7 +72,7 @@
<field name="end_date" />
<field name="domain" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</list>
</field>
</record>
<record id="agreement_search" model="ir.ui.view">
Expand Down Expand Up @@ -128,6 +122,6 @@
<record id="agreement_action" model="ir.actions.act_window">
<field name="name">Agreements</field>
<field name="res_model">agreement</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
135 changes: 135 additions & 0 deletions agreement/views/agreement.xml.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
© 2017 Akretion (Alexis de Lattre <[email protected]>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="agreement_form" model="ir.ui.view">
<field name="name">agreement.form</field>
<field name="model">agreement</field>
<field name="arch" type="xml">
<form string="Agreement">
<sheet>
<div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
invisible="active"
/>
<div class="oe_title">
<label
for="name"
class="oe_edit_only"
string="Agreement Name"
/>
<h1>
<field name="name" />
</h1>
</div>
<group name="main">
<group name="left">
<field name="code" />
<field name="partner_id" required="not is_template" />
<field
name="agreement_type_id"
groups="agreement.group_use_agreement_type"
/>
<field name="domain" widget="radio" />
<field
name="is_template"
groups="agreement.group_use_agreement_template"
/>
</group>
<group name="right">
<field name="signature_date" />
<field name="start_date" />
<field name="end_date" />
<field
name="company_id"
groups="base.group_multi_company"
/>
</group>
</group>
<notebook>
<page name="config" string="Configuration" invisible="True" />
</notebook>
</sheet>
<<<<<<< HEAD
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
=======
<chatter />
>>>>>>> 00d357b ([IMP] agreement: pre-commit execution)
</form>
</field>
</record>
<record id="agreement_tree" model="ir.ui.view">
<field name="name">agreement.tree</field>
<field name="model">agreement</field>
<field name="arch" type="xml">
<tree>
<field name="partner_id" />
<field name="code" />
<field name="name" />
<field name="signature_date" />
<field name="start_date" />
<field name="end_date" />
<field name="domain" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</field>
</record>
<record id="agreement_search" model="ir.ui.view">
<field name="name">agreement.search</field>
<field name="model">agreement</field>
<field name="arch" type="xml">
<search string="Search Agreements">
<field
name="name"
filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"
string="Name or Number"
/>
<field name="partner_id" />
<separator />
<filter name="sale" string="Sale" domain="[('domain', '=', 'sale')]" />
<filter
name="purchase"
string="Purchase"
domain="[('domain', '=', 'purchase')]"
/>
<separator />
<filter
name="inactive"
string="Archived"
domain="[('active', '=', False)]"
/>
<group name="groupby">
<filter
name="partner_groupby"
string="Partner"
context="{'group_by': 'partner_id'}"
/>
<filter
name="signature_date_groupby"
string="Signature Date"
context="{'group_by': 'signature_date'}"
/>
<filter
name="domain_groupby"
string="Domain"
context="{'group_by': 'domain'}"
/>
</group>
</search>
</field>
</record>
<record id="agreement_action" model="ir.actions.act_window">
<field name="name">Agreements</field>
<field name="res_model">agreement</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
5 changes: 3 additions & 2 deletions agreement/views/agreement_type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
bg_color="bg-danger"
invisible="active"
/>
<field name="active" invisible="1" />
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" /></h1>
<h1>
<field name="name" />
</h1>
</div>
<group name="main">
<field name="domain" widget="radio" />
Expand Down

0 comments on commit a81443c

Please sign in to comment.