[UPD] Lint
This commit is contained in:
parent
6709021dbc
commit
e21696f67c
@ -10,13 +10,7 @@
|
|||||||
"website": "http://rydlab.ru",
|
"website": "http://rydlab.ru",
|
||||||
"category": "Invoicing & Payments",
|
"category": "Invoicing & Payments",
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"depends": [
|
"depends": ["base", "contacts", "hr", "russian_requisites", "sale", "sale_margin",],
|
||||||
"base",
|
|
||||||
"contacts",
|
|
||||||
"hr",
|
|
||||||
"russian_requisites",
|
|
||||||
"sale",
|
|
||||||
],
|
|
||||||
"data": [
|
"data": [
|
||||||
"data/assets_extension.xml",
|
"data/assets_extension.xml",
|
||||||
"data/fields_default.xml",
|
"data/fields_default.xml",
|
||||||
|
@ -5,22 +5,13 @@ class ResPartner(models.Model):
|
|||||||
_inherit = "res.partner"
|
_inherit = "res.partner"
|
||||||
|
|
||||||
name_write = fields.Char(
|
name_write = fields.Char(
|
||||||
string="Name in contracts",
|
string="Name in contracts", help="This name uses in contracts",
|
||||||
help="This name uses in contracts",
|
|
||||||
)
|
|
||||||
name_genitive = fields.Char(
|
|
||||||
string="Name Genitive",
|
|
||||||
)
|
|
||||||
name_initials = fields.Char(
|
|
||||||
string="Name Initials",
|
|
||||||
)
|
|
||||||
function_genitive = fields.Char(
|
|
||||||
string="Function Genitive",
|
|
||||||
)
|
)
|
||||||
|
name_genitive = fields.Char(string="Name Genitive",)
|
||||||
|
name_initials = fields.Char(string="Name Initials",)
|
||||||
|
function_genitive = fields.Char(string="Function Genitive",)
|
||||||
client_contract_ids = fields.One2many(
|
client_contract_ids = fields.One2many(
|
||||||
"res.partner.contract",
|
"res.partner.contract", "partner_id", string="Contracts",
|
||||||
"partner_id",
|
|
||||||
string="Contracts",
|
|
||||||
)
|
)
|
||||||
contract_count = fields.Integer(
|
contract_count = fields.Integer(
|
||||||
compute="_compute_contract_count", string="# of contracts"
|
compute="_compute_contract_count", string="# of contracts"
|
||||||
@ -28,25 +19,19 @@ class ResPartner(models.Model):
|
|||||||
full_address = fields.Char(
|
full_address = fields.Char(
|
||||||
compute="_compute_full_address"
|
compute="_compute_full_address"
|
||||||
) # Check for res.partner.contact_address in base/res
|
) # Check for res.partner.contact_address in base/res
|
||||||
street_actual = fields.Many2one(
|
street_actual = fields.Many2one("res.partner", string="Actual Address",)
|
||||||
"res.partner",
|
|
||||||
string="Actual Address",
|
|
||||||
)
|
|
||||||
representative_id = fields.Many2one(
|
representative_id = fields.Many2one(
|
||||||
"res.partner", string="Representative", help="Person, who represents company"
|
"res.partner", string="Representative", help="Person, who represents company"
|
||||||
)
|
)
|
||||||
representative_document = fields.Char(
|
representative_document = fields.Char(
|
||||||
string="Representative acts on the basis of",
|
string="Representative acts on the basis of", help="Parent Case",
|
||||||
help="Parent Case",
|
|
||||||
)
|
)
|
||||||
signature = fields.Binary(string="Client signature")
|
signature = fields.Binary(string="Client signature")
|
||||||
whatsapp = fields.Char(
|
whatsapp = fields.Char(
|
||||||
string="WhatsApp",
|
string="WhatsApp", help="If a contact have a WhatsApp number",
|
||||||
help="If a contact have a WhatsApp number",
|
|
||||||
)
|
)
|
||||||
telegram = fields.Char(
|
telegram = fields.Char(
|
||||||
string="Telegram",
|
string="Telegram", help="If a contact have a Telegram number or identifier",
|
||||||
help="If a contact have a Telegram number or identifier",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends("street", "street2", "city", "state_id", "zip", "country_id")
|
@api.depends("street", "street2", "city", "state_id", "zip", "country_id")
|
||||||
|
@ -47,14 +47,9 @@ class PartnerContract(models.Model, IDocument, Extension):
|
|||||||
)
|
)
|
||||||
create_date_ts = fields.Char(default=_get_default_create_date_ts)
|
create_date_ts = fields.Char(default=_get_default_create_date_ts)
|
||||||
res_model = fields.Char(default=lambda self: self._name)
|
res_model = fields.Char(default=lambda self: self._name)
|
||||||
name = fields.Char(
|
name = fields.Char(string="Contract number", default=_get_default_name,)
|
||||||
string="Contract number",
|
|
||||||
default=_get_default_name,
|
|
||||||
)
|
|
||||||
create_date = fields.Datetime(string="Created on")
|
create_date = fields.Datetime(string="Created on")
|
||||||
date_conclusion = fields.Date(
|
date_conclusion = fields.Date(string="Date of system conclusion",)
|
||||||
string="Date of system conclusion",
|
|
||||||
)
|
|
||||||
date_conclusion_fix = fields.Date(
|
date_conclusion_fix = fields.Date(
|
||||||
string="Date of manual conclusion",
|
string="Date of manual conclusion",
|
||||||
help="Field for manual edit when contract is signed or closed",
|
help="Field for manual edit when contract is signed or closed",
|
||||||
@ -70,11 +65,7 @@ class PartnerContract(models.Model, IDocument, Extension):
|
|||||||
default=1, help="Counter for generate Annex name"
|
default=1, help="Counter for generate Annex name"
|
||||||
)
|
)
|
||||||
state = fields.Selection(
|
state = fields.Selection(
|
||||||
[
|
[("draft", "New"), ("sign", "Signed"), ("close", "Closed"),],
|
||||||
("draft", "New"),
|
|
||||||
("sign", "Signed"),
|
|
||||||
("close", "Closed"),
|
|
||||||
],
|
|
||||||
string="Status",
|
string="Status",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
copy=False,
|
copy=False,
|
||||||
|
@ -10,29 +10,15 @@ class ContractOrderAnnex(models.Model, IDocument, Extension):
|
|||||||
_name = "res.partner.contract.annex"
|
_name = "res.partner.contract.annex"
|
||||||
_description = "Contract Annex"
|
_description = "Contract Annex"
|
||||||
|
|
||||||
name = fields.Char(
|
name = fields.Char(string="Name",)
|
||||||
string="Name",
|
display_name = fields.Char(compute="_compute_display_name",)
|
||||||
)
|
specification_name = fields.Char(compute="_compute_specification_name",)
|
||||||
display_name = fields.Char(
|
|
||||||
compute="_compute_display_name",
|
|
||||||
)
|
|
||||||
specification_name = fields.Char(
|
|
||||||
compute="_compute_specification_name",
|
|
||||||
)
|
|
||||||
|
|
||||||
contract_id = fields.Many2one(
|
contract_id = fields.Many2one(
|
||||||
"res.partner.contract",
|
"res.partner.contract", string="Contract", readonly=True,
|
||||||
string="Contract",
|
|
||||||
readonly=True,
|
|
||||||
)
|
|
||||||
company_id = fields.Many2one(
|
|
||||||
"res.partner",
|
|
||||||
related="contract_id.company_id",
|
|
||||||
)
|
|
||||||
partner_id = fields.Many2one(
|
|
||||||
"res.partner",
|
|
||||||
related="contract_id.partner_id",
|
|
||||||
)
|
)
|
||||||
|
company_id = fields.Many2one("res.partner", related="contract_id.company_id",)
|
||||||
|
partner_id = fields.Many2one("res.partner", related="contract_id.partner_id",)
|
||||||
order_id = fields.Many2one(
|
order_id = fields.Many2one(
|
||||||
"sale.order",
|
"sale.order",
|
||||||
string="Order",
|
string="Order",
|
||||||
@ -40,58 +26,29 @@ class ContractOrderAnnex(models.Model, IDocument, Extension):
|
|||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
date_conclusion = fields.Date(
|
date_conclusion = fields.Date(
|
||||||
string="Conclusion Date",
|
string="Conclusion Date", default=fields.Date.today(),
|
||||||
default=fields.Date.today(),
|
|
||||||
)
|
|
||||||
counter = fields.Integer(
|
|
||||||
string="№",
|
|
||||||
help="Counter of Contract Annexes",
|
|
||||||
)
|
|
||||||
currency_id = fields.Many2one(
|
|
||||||
related="company_id.currency_id",
|
|
||||||
readonly=True,
|
|
||||||
)
|
)
|
||||||
|
counter = fields.Integer(string="№", help="Counter of Contract Annexes",)
|
||||||
|
currency_id = fields.Many2one(related="company_id.currency_id", readonly=True,)
|
||||||
|
|
||||||
design_period = fields.Integer(
|
design_period = fields.Integer(string="Design Period",)
|
||||||
string="Design Period",
|
design_cost = fields.Monetary(string="Design Cost",)
|
||||||
)
|
|
||||||
design_cost = fields.Monetary(
|
|
||||||
string="Design Cost",
|
|
||||||
)
|
|
||||||
|
|
||||||
design_doc_period = fields.Integer(
|
design_doc_period = fields.Integer(string="Documentation Design Period (days)",)
|
||||||
string="Documentation Design Period (days)",
|
design_doc_cost = fields.Monetary(string="Documentation Design Cost",)
|
||||||
)
|
|
||||||
design_doc_cost = fields.Monetary(
|
|
||||||
string="Documentation Design Cost",
|
|
||||||
)
|
|
||||||
|
|
||||||
delivery_address = fields.Char(
|
delivery_address = fields.Char(string="Delivery Address",)
|
||||||
string="Delivery Address",
|
|
||||||
)
|
|
||||||
delivery_period = fields.Integer(string="Delivery Period (days)")
|
delivery_period = fields.Integer(string="Delivery Period (days)")
|
||||||
|
|
||||||
installation_address = fields.Char(
|
installation_address = fields.Char(string="Installation Address",)
|
||||||
string="Installation Address",
|
installation_period = fields.Integer(string="Installation Period (days)",)
|
||||||
)
|
installation_cost = fields.Integer(string="Installation Cost",)
|
||||||
installation_period = fields.Integer(
|
|
||||||
string="Installation Period (days)",
|
|
||||||
)
|
|
||||||
installation_cost = fields.Integer(
|
|
||||||
string="Installation Cost",
|
|
||||||
)
|
|
||||||
|
|
||||||
total_cost = fields.Monetary(
|
total_cost = fields.Monetary(string="Total Cost",)
|
||||||
string="Total Cost",
|
|
||||||
)
|
|
||||||
|
|
||||||
payment_part_one = fields.Float(string="Payment 1 Part (%)", default=100)
|
payment_part_one = fields.Float(string="Payment 1 Part (%)", default=100)
|
||||||
payment_part_two = fields.Float(
|
payment_part_two = fields.Float(string="Payment 2 Part (%)",)
|
||||||
string="Payment 2 Part (%)",
|
payment_part_three = fields.Float(string="Payment 3 Part (%)",)
|
||||||
)
|
|
||||||
payment_part_three = fields.Float(
|
|
||||||
string="Payment 3 Part (%)",
|
|
||||||
)
|
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends("name")
|
@api.depends("name")
|
||||||
@ -128,8 +85,7 @@ class ContractOrderAnnex(models.Model, IDocument, Extension):
|
|||||||
order_number = self.order_id.name or "SO###"
|
order_number = self.order_id.name or "SO###"
|
||||||
|
|
||||||
self.name = "{contract}-{order}".format(
|
self.name = "{contract}-{order}".format(
|
||||||
contract=contract_number,
|
contract=contract_number, order=order_number,
|
||||||
order=order_number,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
@ -6,25 +6,10 @@ class ContractField(models.Model):
|
|||||||
_description = "Contract Field"
|
_description = "Contract Field"
|
||||||
_order = "sequence"
|
_order = "sequence"
|
||||||
|
|
||||||
name = fields.Char(
|
name = fields.Char(string="Name", required=True, translate=True,)
|
||||||
string="Name",
|
|
||||||
required=True,
|
|
||||||
translate=True,
|
|
||||||
)
|
|
||||||
technical_name = fields.Char(
|
technical_name = fields.Char(
|
||||||
string="Technical Name",
|
string="Technical Name", help="Name uses in template", required=True,
|
||||||
help="Name uses in template",
|
|
||||||
required=True,
|
|
||||||
)
|
|
||||||
description = fields.Char(
|
|
||||||
string="Description",
|
|
||||||
translate=True,
|
|
||||||
default="",
|
|
||||||
)
|
|
||||||
sequence = fields.Integer(
|
|
||||||
string="Sequence",
|
|
||||||
)
|
|
||||||
visible = fields.Boolean(
|
|
||||||
string="Visible",
|
|
||||||
default=True,
|
|
||||||
)
|
)
|
||||||
|
description = fields.Char(string="Description", translate=True, default="",)
|
||||||
|
sequence = fields.Integer(string="Sequence",)
|
||||||
|
visible = fields.Boolean(string="Visible", default=True,)
|
||||||
|
@ -6,33 +6,17 @@ class ContractFieldTransient(models.TransientModel):
|
|||||||
_description = "Contract Field Transient"
|
_description = "Contract Field Transient"
|
||||||
|
|
||||||
_contract_wizard_id = fields.Many2one(
|
_contract_wizard_id = fields.Many2one(
|
||||||
"res.partner.contract.wizard",
|
"res.partner.contract.wizard", string="Contract", readonly=True,
|
||||||
string="Contract",
|
|
||||||
readonly=True,
|
|
||||||
)
|
|
||||||
contract_field_id = fields.Many2one(
|
|
||||||
"res.partner.contract.field",
|
|
||||||
string="Field",
|
|
||||||
)
|
|
||||||
name = fields.Char(
|
|
||||||
related="contract_field_id.name",
|
|
||||||
string="Name",
|
|
||||||
readonly=True,
|
|
||||||
)
|
)
|
||||||
|
contract_field_id = fields.Many2one("res.partner.contract.field", string="Field",)
|
||||||
|
name = fields.Char(related="contract_field_id.name", string="Name", readonly=True,)
|
||||||
technical_name = fields.Char(
|
technical_name = fields.Char(
|
||||||
related="contract_field_id.technical_name",
|
related="contract_field_id.technical_name",
|
||||||
string="Technical Name",
|
string="Technical Name",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
description = fields.Char(
|
description = fields.Char(
|
||||||
related="contract_field_id.description",
|
related="contract_field_id.description", string="Description", readonly=True,
|
||||||
string="Description",
|
|
||||||
readonly=True,
|
|
||||||
)
|
|
||||||
visible = fields.Boolean(
|
|
||||||
related="contract_field_id.visible",
|
|
||||||
)
|
|
||||||
value = fields.Char(
|
|
||||||
string="Value",
|
|
||||||
default="",
|
|
||||||
)
|
)
|
||||||
|
visible = fields.Boolean(related="contract_field_id.visible",)
|
||||||
|
value = fields.Char(string="Value", default="",)
|
||||||
|
@ -39,9 +39,6 @@ class DocumentTemplate(models.Model):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
template_type = fields.Selection(
|
template_type = fields.Selection(
|
||||||
selection=[
|
selection=[("contract", "Contract"), ("annex", "Annex"),]
|
||||||
("contract", "Contract"),
|
|
||||||
("annex", "Annex"),
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
sequence = fields.Integer()
|
sequence = fields.Integer()
|
||||||
|
@ -6,14 +6,9 @@ from ..utils import MODULE_NAME
|
|||||||
class SaleOrder(models.Model):
|
class SaleOrder(models.Model):
|
||||||
_inherit = "sale.order"
|
_inherit = "sale.order"
|
||||||
|
|
||||||
delivery_time = fields.Integer(
|
delivery_time = fields.Integer(string="Delivery Time", default=45,)
|
||||||
string="Delivery Time",
|
|
||||||
default=45,
|
|
||||||
)
|
|
||||||
contract_annex_id = fields.Many2one(
|
contract_annex_id = fields.Many2one(
|
||||||
"res.partner.contract.annex",
|
"res.partner.contract.annex", string="Contract Annex", readonly=True,
|
||||||
string="Contract Annex",
|
|
||||||
readonly=True,
|
|
||||||
)
|
)
|
||||||
# Extend default field
|
# Extend default field
|
||||||
payment_term_id = fields.Many2one(
|
payment_term_id = fields.Many2one(
|
||||||
|
@ -46,14 +46,10 @@ class ContractWizard(models.TransientModel, Extension):
|
|||||||
default=_default_target,
|
default=_default_target,
|
||||||
)
|
)
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
"res.partner",
|
"res.partner", string="Company", compute="_compute_company_id",
|
||||||
string="Company",
|
|
||||||
compute="_compute_company_id",
|
|
||||||
)
|
)
|
||||||
partner_id = fields.Many2one(
|
partner_id = fields.Many2one(
|
||||||
"res.partner",
|
"res.partner", string="Partner", compute="_compute_partner_id",
|
||||||
string="Partner",
|
|
||||||
compute="_compute_partner_id",
|
|
||||||
)
|
)
|
||||||
document_name = fields.Char(
|
document_name = fields.Char(
|
||||||
string="Document Name", compute="_compute_document_name"
|
string="Document Name", compute="_compute_document_name"
|
||||||
@ -71,8 +67,7 @@ class ContractWizard(models.TransientModel, Extension):
|
|||||||
string="Contract Fields",
|
string="Contract Fields",
|
||||||
)
|
)
|
||||||
transient_field_ids_hidden = fields.One2many(
|
transient_field_ids_hidden = fields.One2many(
|
||||||
"res.partner.contract.field.transient",
|
"res.partner.contract.field.transient", "_contract_wizard_id",
|
||||||
"_contract_wizard_id",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends("target")
|
@api.depends("target")
|
||||||
@ -98,11 +93,7 @@ class ContractWizard(models.TransientModel, Extension):
|
|||||||
|
|
||||||
@api.onchange("document_template")
|
@api.onchange("document_template")
|
||||||
def _domain_document_template(self):
|
def _domain_document_template(self):
|
||||||
return {
|
return {"domain": {"document_template": self._get_template_domain(),}}
|
||||||
"domain": {
|
|
||||||
"document_template": self._get_template_domain(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@api.onchange("document_template")
|
@api.onchange("document_template")
|
||||||
def _onchange_document_template(self):
|
def _onchange_document_template(self):
|
||||||
@ -112,9 +103,7 @@ class ContractWizard(models.TransientModel, Extension):
|
|||||||
|
|
||||||
def get_contract_field(technical_name):
|
def get_contract_field(technical_name):
|
||||||
return self.env["res.partner.contract.field"].search(
|
return self.env["res.partner.contract.field"].search(
|
||||||
[
|
[("technical_name", "=", technical_name),]
|
||||||
("technical_name", "=", technical_name),
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
model_to_action = {
|
model_to_action = {
|
||||||
@ -134,10 +123,7 @@ class ContractWizard(models.TransientModel, Extension):
|
|||||||
4,
|
4,
|
||||||
self.env["res.partner.contract.field.transient"]
|
self.env["res.partner.contract.field.transient"]
|
||||||
.create(
|
.create(
|
||||||
{
|
{"contract_field_id": get_contract_field(field).id, "value": value,}
|
||||||
"contract_field_id": get_contract_field(field).id,
|
|
||||||
"value": value,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
.id,
|
.id,
|
||||||
0,
|
0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user