[IMP] move some notions from agreement_legal to agreement

we move the is_template field definition and the agreement.type model from
the agreement_legal module to the agreement module.

The fields are not displayed by default, unless the feature is enabled through a
technical feature group, this is configurable in the agreement_sale module (because agreement
in itself has no UI, and agreement_legal enables the feature by default)
This commit is contained in:
黎伟杰
2019-09-03 11:36:40 +00:00
committed by newtratip
parent 00a3db7fc9
commit 1e48c0a54d
10 changed files with 259 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'security/agreement_security.xml', 'security/agreement_security.xml',
'views/agreement.xml', 'views/agreement.xml',
'views/agreement_type.xml',
], ],
'demo': ['demo/demo.xml'], 'demo': ['demo/demo.xml'],
'development_status': 'Beta', 'development_status': 'Beta',

157
agreement/i18n/zh_CN.po Normal file
View File

@@ -0,0 +1,157 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * agreement
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-09-04 18:23+0000\n"
"Last-Translator: 黎伟杰 <674416404@qq.com>\n"
"Language-Team: none\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 3.8\n"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__active
msgid "Active"
msgstr "有效"
#. module: agreement
#: model:ir.model,name:agreement.model_agreement
#: model_terms:ir.ui.view,arch_db:agreement.agreement_form
msgid "Agreement"
msgstr "协议"
#. module: agreement
#: model:ir.actions.act_window,name:agreement.agreement_action
#: model:ir.ui.menu,name:agreement.agreement_menu
#: model_terms:ir.ui.view,arch_db:agreement.agreement_tree
msgid "Agreements"
msgstr "协议"
#. module: agreement
#: model_terms:ir.ui.view,arch_db:agreement.agreement_search
msgid "Archived"
msgstr "已归档"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__company_id
msgid "Company"
msgstr "公司"
#. module: agreement
#: model_terms:ir.ui.view,arch_db:agreement.agreement_form
msgid "Configuration"
msgstr "配置"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__create_uid
msgid "Created by"
msgstr "创建者"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__create_date
msgid "Created on"
msgstr "创建时间"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__display_name
msgid "Display Name"
msgstr "显示名称"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__end_date
msgid "End Date"
msgstr "结束日期"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__id
msgid "ID"
msgstr "ID"
#. module: agreement
#: model:ir.model.fields,help:agreement.field_agreement__code
msgid "ID used for internal contract tracking."
msgstr "用于内部合同跟踪的ID。"
#. module: agreement
#: model:ir.model.fields,help:agreement.field_agreement__active
msgid "If unchecked, it will allow you to hide the agreement without removing it."
msgstr "如果不选中,它将允许您隐藏协议而不删除它。"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement____last_update
msgid "Last Modified on"
msgstr "最后修改时间"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__write_uid
msgid "Last Updated by"
msgstr "最后更新者"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__write_date
msgid "Last Updated on"
msgstr "最后更新时间"
#. module: agreement
#: model_terms:ir.ui.view,arch_db:agreement.agreement_search
msgid "Name or Number"
msgstr "姓名或号码"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__partner_id
#: model_terms:ir.ui.view,arch_db:agreement.agreement_search
msgid "Partner"
msgstr "业务伙伴"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__code
msgid "Reference"
msgstr "参考"
#. module: agreement
#: model_terms:ir.ui.view,arch_db:agreement.agreement_search
msgid "Search Agreements"
msgstr "搜索协议"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__signature_date
#: model_terms:ir.ui.view,arch_db:agreement.agreement_search
msgid "Signature Date"
msgstr "签名日期"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__start_date
msgid "Start Date"
msgstr "开始日期"
#. module: agreement
#: model:ir.model.fields,help:agreement.field_agreement__partner_id
msgid "The customer or vendor this agreement is related to."
msgstr "与本协议相关的客户或供应商。"
#. module: agreement
#: sql_constraint:agreement:0
msgid "This agreement code already exists for this partner!"
msgstr "此合作伙伴的协议代码已存在!"
#. module: agreement
#: model:ir.model.fields,field_description:agreement.field_agreement__name
msgid "Title"
msgstr "标题"
#. module: agreement
#: model:ir.model.fields,help:agreement.field_agreement__end_date
msgid "When the agreement ends."
msgstr "协议结束时。"
#. module: agreement
#: model:ir.model.fields,help:agreement.field_agreement__start_date
msgid "When the agreement starts."
msgstr "协议开始时。"

View File

@@ -1 +1,2 @@
from . import agreement from . import agreement
from . import agreement_type

View File

@@ -12,11 +12,23 @@ class Agreement(models.Model):
code = fields.Char(required=True, copy=False) code = fields.Char(required=True, copy=False)
name = fields.Char(required=True) name = fields.Char(required=True)
partner_id = fields.Many2one( partner_id = fields.Many2one(
'res.partner', string='Partner', ondelete='restrict', required=True, 'res.partner', string='Partner', ondelete='restrict',
domain=[('parent_id', '=', False)]) domain=[('parent_id', '=', False)])
company_id = fields.Many2one( company_id = fields.Many2one(
'res.company', string='Company', 'res.company', string='Company',
default=lambda self: self.env['res.company']._company_default_get()) default=lambda self: self.env['res.company']._company_default_get())
is_template = fields.Boolean(
string="Is a Template?",
default=False,
copy=False,
help="Set if the agreement is a template. "
"Template agreements don't require a partner."
)
agreement_type_id = fields.Many2one(
'agreement.type',
string="Agreement Type",
help="Select the type of agreement",
)
active = fields.Boolean(default=True) active = fields.Boolean(default=True)
signature_date = fields.Date() signature_date = fields.Date()
start_date = fields.Date() start_date = fields.Date()

View File

@@ -0,0 +1,12 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class AgreementType(models.Model):
_name = "agreement.type"
_description = "Agreement Types"
name = fields.Char(string="Name", required=True)
active = fields.Boolean(default=True)

View File

@@ -1,2 +1,3 @@
* Alexis de Lattre <alexis.delattre@akretion.com> * Alexis de Lattre <alexis.delattre@akretion.com>
* Yves Goldberg <yves@ygol.com> * Yves Goldberg <yves@ygol.com>
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>

View File

@@ -6,3 +6,9 @@ This module adds an *Agreement* object with the following properties:
* signature date. * signature date.
* start date. * start date.
* end date. * end date.
Optionally, you can also enable using:
* agreement types
* a flag to set an agreement as a template agreement
(Install agreement_sale to get the configuration settings for these).

View File

@@ -13,5 +13,14 @@
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
</record> </record>
<record id="group_use_agreement_type" model="res.groups">
<field name="name">Use agreement type</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_use_agreement_template" model="res.groups">
<field name="name">Use agreement template</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
</odoo> </odoo>

View File

@@ -21,7 +21,11 @@
</div> </div>
<group name="main"> <group name="main">
<group name="left"> <group name="left">
<field name="partner_id"/> <field name="agreement_type_id"
groups="agreement.group_use_agreement_type"/>
<field name="is_template" groups="agreement.group_use_agreement_template"/>
<field name="partner_id"
attrs="{'required': [('is_template', '=', False)]}"/>
<field name="name"/> <field name="name"/>
<field name="signature_date"/> <field name="signature_date"/>
</group> </group>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Type List View-->
<record model="ir.ui.view" id="agreement_type_list_view">
<field name="name">Agreement Type List</field>
<field name="model">agreement.type</field>
<field name="arch" type="xml">
<tree string="Agreement Types" default_order="name">
<field name="name" string="Type Name"/>
</tree>
</field>
</record>
<!-- Agreement Type Form View -->
<record model="ir.ui.view" id="agreement_type_form_view">
<field name="name">Agreement Type Form</field>
<field name="model">agreement.type</field>
<field name="arch" type="xml">
<form string="Agreement Type">
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
</div>
</sheet>
</form>
</field>
</record>
<record id="agreement_type_search" model="ir.ui.view">
<field name="name">agreement.type.search</field>
<field name="model">agreement.type</field>
<field name="arch" type="xml">
<search string="Agreement Type">
<field name="name"/>
<filter name="archived" string="Archived" domain="[('active', '=', False)]"/>
</search>
</field>
</record>
<!-- Actions opening views on models -->
<record model="ir.actions.act_window" id="agreement_type_action">
<field name="name">Agreement Types</field>
<field name="res_model">agreement.type</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>