[UPD] Lint
This commit is contained in:
parent
3211159e59
commit
6709021dbc
@ -10,7 +10,13 @@
|
|||||||
"website": "http://rydlab.ru",
|
"website": "http://rydlab.ru",
|
||||||
"category": "Invoicing & Payments",
|
"category": "Invoicing & Payments",
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"depends": ["base", "contacts", "hr", "russian_requisites", "sale",],
|
"depends": [
|
||||||
|
"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,13 +5,22 @@ class ResPartner(models.Model):
|
|||||||
_inherit = "res.partner"
|
_inherit = "res.partner"
|
||||||
|
|
||||||
name_write = fields.Char(
|
name_write = fields.Char(
|
||||||
string="Name in contracts", help="This name uses in contracts",
|
string="Name 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", "partner_id", string="Contracts",
|
"res.partner.contract",
|
||||||
|
"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"
|
||||||
@ -19,19 +28,25 @@ 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("res.partner", string="Actual Address",)
|
street_actual = fields.Many2one(
|
||||||
|
"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", help="Parent Case",
|
string="Representative acts on the basis of",
|
||||||
|
help="Parent Case",
|
||||||
)
|
)
|
||||||
signature = fields.Binary(string="Client signature")
|
signature = fields.Binary(string="Client signature")
|
||||||
whatsapp = fields.Char(
|
whatsapp = fields.Char(
|
||||||
string="WhatsApp", help="If a contact have a WhatsApp number",
|
string="WhatsApp",
|
||||||
|
help="If a contact have a WhatsApp number",
|
||||||
)
|
)
|
||||||
telegram = fields.Char(
|
telegram = fields.Char(
|
||||||
string="Telegram", help="If a contact have a Telegram number or identifier",
|
string="Telegram",
|
||||||
|
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")
|
||||||
|
@ -10,15 +10,29 @@ 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(string="Name",)
|
name = fields.Char(
|
||||||
display_name = fields.Char(compute="_compute_display_name",)
|
string="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", string="Contract", readonly=True,
|
"res.partner.contract",
|
||||||
|
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",
|
||||||
@ -26,29 +40,58 @@ class ContractOrderAnnex(models.Model, IDocument, Extension):
|
|||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
date_conclusion = fields.Date(
|
date_conclusion = fields.Date(
|
||||||
string="Conclusion Date", default=fields.Date.today(),
|
string="Conclusion Date",
|
||||||
|
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(string="Design Period",)
|
design_period = fields.Integer(
|
||||||
design_cost = fields.Monetary(string="Design Cost",)
|
string="Design Period",
|
||||||
|
)
|
||||||
|
design_cost = fields.Monetary(
|
||||||
|
string="Design Cost",
|
||||||
|
)
|
||||||
|
|
||||||
design_doc_period = fields.Integer(string="Documentation Design Period (days)",)
|
design_doc_period = fields.Integer(
|
||||||
design_doc_cost = fields.Monetary(string="Documentation Design Cost",)
|
string="Documentation Design Period (days)",
|
||||||
|
)
|
||||||
|
design_doc_cost = fields.Monetary(
|
||||||
|
string="Documentation Design Cost",
|
||||||
|
)
|
||||||
|
|
||||||
delivery_address = fields.Char(string="Delivery Address",)
|
delivery_address = fields.Char(
|
||||||
|
string="Delivery Address",
|
||||||
|
)
|
||||||
delivery_period = fields.Integer(string="Delivery Period (days)")
|
delivery_period = fields.Integer(string="Delivery Period (days)")
|
||||||
|
|
||||||
installation_address = fields.Char(string="Installation Address",)
|
installation_address = fields.Char(
|
||||||
installation_period = fields.Integer(string="Installation Period (days)",)
|
string="Installation Address",
|
||||||
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(string="Total Cost",)
|
total_cost = fields.Monetary(
|
||||||
|
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(string="Payment 2 Part (%)",)
|
payment_part_two = fields.Float(
|
||||||
payment_part_three = fields.Float(string="Payment 3 Part (%)",)
|
string="Payment 2 Part (%)",
|
||||||
|
)
|
||||||
|
payment_part_three = fields.Float(
|
||||||
|
string="Payment 3 Part (%)",
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends("name")
|
@api.depends("name")
|
||||||
@ -85,7 +128,8 @@ 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, order=order_number,
|
contract=contract_number,
|
||||||
|
order=order_number,
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
@ -6,10 +6,25 @@ class ContractField(models.Model):
|
|||||||
_description = "Contract Field"
|
_description = "Contract Field"
|
||||||
_order = "sequence"
|
_order = "sequence"
|
||||||
|
|
||||||
name = fields.Char(string="Name", required=True, translate=True,)
|
name = fields.Char(
|
||||||
technical_name = fields.Char(
|
string="Name",
|
||||||
string="Technical Name", help="Name uses in template", required=True,
|
required=True,
|
||||||
|
translate=True,
|
||||||
|
)
|
||||||
|
technical_name = fields.Char(
|
||||||
|
string="Technical Name",
|
||||||
|
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,17 +6,33 @@ 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", string="Contract", readonly=True,
|
"res.partner.contract.wizard",
|
||||||
|
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", string="Description", readonly=True,
|
related="contract_field_id.description",
|
||||||
|
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,6 +39,9 @@ class DocumentTemplate(models.Model):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
template_type = fields.Selection(
|
template_type = fields.Selection(
|
||||||
selection=[("contract", "Contract"), ("annex", "Annex"),]
|
selection=[
|
||||||
|
("contract", "Contract"),
|
||||||
|
("annex", "Annex"),
|
||||||
|
]
|
||||||
)
|
)
|
||||||
sequence = fields.Integer()
|
sequence = fields.Integer()
|
||||||
|
@ -6,9 +6,14 @@ from ..utils import MODULE_NAME
|
|||||||
class SaleOrder(models.Model):
|
class SaleOrder(models.Model):
|
||||||
_inherit = "sale.order"
|
_inherit = "sale.order"
|
||||||
|
|
||||||
delivery_time = fields.Integer(string="Delivery Time", default=45,)
|
delivery_time = fields.Integer(
|
||||||
|
string="Delivery Time",
|
||||||
|
default=45,
|
||||||
|
)
|
||||||
contract_annex_id = fields.Many2one(
|
contract_annex_id = fields.Many2one(
|
||||||
"res.partner.contract.annex", string="Contract Annex", readonly=True,
|
"res.partner.contract.annex",
|
||||||
|
string="Contract Annex",
|
||||||
|
readonly=True,
|
||||||
)
|
)
|
||||||
# Extend default field
|
# Extend default field
|
||||||
payment_term_id = fields.Many2one(
|
payment_term_id = fields.Many2one(
|
||||||
|
@ -46,10 +46,14 @@ class ContractWizard(models.TransientModel, Extension):
|
|||||||
default=_default_target,
|
default=_default_target,
|
||||||
)
|
)
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
"res.partner", string="Company", compute="_compute_company_id",
|
"res.partner",
|
||||||
|
string="Company",
|
||||||
|
compute="_compute_company_id",
|
||||||
)
|
)
|
||||||
partner_id = fields.Many2one(
|
partner_id = fields.Many2one(
|
||||||
"res.partner", string="Partner", compute="_compute_partner_id",
|
"res.partner",
|
||||||
|
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"
|
||||||
@ -67,7 +71,8 @@ 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", "_contract_wizard_id",
|
"res.partner.contract.field.transient",
|
||||||
|
"_contract_wizard_id",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends("target")
|
@api.depends("target")
|
||||||
@ -93,7 +98,11 @@ class ContractWizard(models.TransientModel, Extension):
|
|||||||
|
|
||||||
@api.onchange("document_template")
|
@api.onchange("document_template")
|
||||||
def _domain_document_template(self):
|
def _domain_document_template(self):
|
||||||
return {"domain": {"document_template": self._get_template_domain(),}}
|
return {
|
||||||
|
"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):
|
||||||
@ -103,7 +112,9 @@ 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 = {
|
||||||
@ -123,7 +134,10 @@ 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