mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract_layout_category_hide_detail: black, isort, prettier
This commit is contained in:
@@ -7,15 +7,8 @@
|
||||
"version": "12.0.1.0.0",
|
||||
"category": "Contract Management",
|
||||
"website": "https://github.com/OCA/contract",
|
||||
"author": "Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"author": "Tecnativa, " "Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"depends": [
|
||||
"contract",
|
||||
"sale_layout_category_hide_detail",
|
||||
],
|
||||
"data": [
|
||||
"views/abstract_contract_line.xml",
|
||||
"views/contract.xml",
|
||||
],
|
||||
"depends": ["contract", "sale_layout_category_hide_detail"],
|
||||
"data": ["views/abstract_contract_line.xml", "views/contract.xml"],
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
# Copyright 2020 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ContractAbstractContractLine(models.AbstractModel):
|
||||
_inherit = 'contract.abstract.contract.line'
|
||||
_inherit = "contract.abstract.contract.line"
|
||||
|
||||
show_details = fields.Boolean(
|
||||
string="Show details",
|
||||
default=True
|
||||
)
|
||||
show_subtotal = fields.Boolean(
|
||||
string="Show subtotal",
|
||||
default=True
|
||||
)
|
||||
show_details = fields.Boolean(string="Show details", default=True)
|
||||
show_subtotal = fields.Boolean(string="Show subtotal", default=True)
|
||||
|
||||
@@ -6,7 +6,7 @@ from odoo import api, models
|
||||
|
||||
|
||||
class ContractLine(models.Model):
|
||||
_inherit = 'contract.line'
|
||||
_inherit = "contract.line"
|
||||
|
||||
@api.multi
|
||||
def _prepare_invoice_line(self, invoice_id=False, invoice_values=False):
|
||||
@@ -16,7 +16,6 @@ class ContractLine(models.Model):
|
||||
# 'vals' will be equal to {}
|
||||
if vals:
|
||||
vals.update(
|
||||
show_details=self.show_details,
|
||||
show_subtotal=self.show_subtotal,
|
||||
show_details=self.show_details, show_subtotal=self.show_subtotal,
|
||||
)
|
||||
return vals
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="contract_abstract_contract_line_form_view" model="ir.ui.view">
|
||||
<field name="name">contract.abstract.contract.line.hide.details</field>
|
||||
<field name="model">contract.abstract.contract.line</field>
|
||||
<field name="inherit_id" ref="contract.contract_abstract_contract_line_form_view"/>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="contract.contract_abstract_contract_line_form_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<group attrs="{'invisible': [('display_type', '!=', 'line_section')]}">
|
||||
<field name="show_details"/>
|
||||
<field name="show_subtotal"
|
||||
attrs="{'invisible': [('show_details', '!=', True)]}"/>
|
||||
<field name="show_details" />
|
||||
<field
|
||||
name="show_subtotal"
|
||||
attrs="{'invisible': [('show_details', '!=', True)]}"
|
||||
/>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="contract_contract_form_view" model="ir.ui.view">
|
||||
<field name="name">contract.contract.form.hide.details</field>
|
||||
<field name="model">contract.contract</field>
|
||||
<field name="inherit_id" ref="contract.contract_contract_form_view"/>
|
||||
<field name="inherit_id" ref="contract.contract_contract_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='contract_line_ids']/tree" position="inside">
|
||||
<field name="show_details"
|
||||
widget="boolean_fa_icon"
|
||||
options="{
|
||||
<field
|
||||
name="show_details"
|
||||
widget="boolean_fa_icon"
|
||||
options="{
|
||||
'show_in_line_section': true,
|
||||
'fa_icons': {
|
||||
'icon_true': 'fa-eye',
|
||||
@@ -20,10 +20,12 @@
|
||||
'hover_false': 'Switch to: details shown',
|
||||
},
|
||||
}"
|
||||
attrs="{'invisible': [('display_type', '!=', 'line_section')]}"/>
|
||||
<field name="show_subtotal"
|
||||
widget="boolean_fa_icon"
|
||||
options="{
|
||||
attrs="{'invisible': [('display_type', '!=', 'line_section')]}"
|
||||
/>
|
||||
<field
|
||||
name="show_subtotal"
|
||||
widget="boolean_fa_icon"
|
||||
options="{
|
||||
'show_in_line_section': true,
|
||||
'fa_icons': {
|
||||
'icon_true': 'fa-plus-circle',
|
||||
@@ -34,9 +36,9 @@
|
||||
'hover_false': 'Switch to: subtotal shown',
|
||||
},
|
||||
}"
|
||||
attrs="{'invisible': ['|', ('display_type', '!=', 'line_section'), ('show_details', '!=', True)]}"/>
|
||||
attrs="{'invisible': ['|', ('display_type', '!=', 'line_section'), ('show_details', '!=', True)]}"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../contract_layout_category_hide_detail
|
||||
6
setup/contract_layout_category_hide_detail/setup.py
Normal file
6
setup/contract_layout_category_hide_detail/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user