diff --git a/__manifest__.py b/__manifest__.py index 58443d0..e33eb37 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -10,13 +10,7 @@ "website": "http://rydlab.ru", "category": "Invoicing & Payments", "version": "0.2.0", - "depends": [ - "base", - "contacts", - "hr", - "russian_requisites", - "sale", - ], + "depends": ["base", "contacts", "hr", "russian_requisites", "sale", "sale_margin",], "data": [ "data/assets_extension.xml", "data/fields_default.xml", diff --git a/models/res_partner.py b/models/res_partner.py index f9fad93..7a9f426 100755 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -5,22 +5,13 @@ class ResPartner(models.Model): _inherit = "res.partner" name_write = fields.Char( - 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", + 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",) client_contract_ids = fields.One2many( - "res.partner.contract", - "partner_id", - string="Contracts", + "res.partner.contract", "partner_id", string="Contracts", ) contract_count = fields.Integer( compute="_compute_contract_count", string="# of contracts" @@ -28,25 +19,19 @@ class ResPartner(models.Model): full_address = fields.Char( compute="_compute_full_address" ) # 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( "res.partner", string="Representative", help="Person, who represents company" ) 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") 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( - 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") diff --git a/models/res_partner_contract.py b/models/res_partner_contract.py index 4155df9..139e8f6 100755 --- a/models/res_partner_contract.py +++ b/models/res_partner_contract.py @@ -47,14 +47,9 @@ class PartnerContract(models.Model, IDocument, Extension): ) create_date_ts = fields.Char(default=_get_default_create_date_ts) res_model = fields.Char(default=lambda self: self._name) - name = fields.Char( - string="Contract number", - default=_get_default_name, - ) + name = fields.Char(string="Contract number", default=_get_default_name,) create_date = fields.Datetime(string="Created on") - date_conclusion = fields.Date( - string="Date of system conclusion", - ) + date_conclusion = fields.Date(string="Date of system conclusion",) date_conclusion_fix = fields.Date( string="Date of manual conclusion", 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" ) state = fields.Selection( - [ - ("draft", "New"), - ("sign", "Signed"), - ("close", "Closed"), - ], + [("draft", "New"), ("sign", "Signed"), ("close", "Closed"),], string="Status", readonly=True, copy=False, diff --git a/models/res_partner_contract_annex.py b/models/res_partner_contract_annex.py index a17c248..2f58012 100755 --- a/models/res_partner_contract_annex.py +++ b/models/res_partner_contract_annex.py @@ -10,29 +10,15 @@ class ContractOrderAnnex(models.Model, IDocument, Extension): _name = "res.partner.contract.annex" _description = "Contract Annex" - name = fields.Char( - string="Name", - ) - display_name = fields.Char( - compute="_compute_display_name", - ) - specification_name = fields.Char( - compute="_compute_specification_name", - ) + name = fields.Char(string="Name",) + display_name = fields.Char(compute="_compute_display_name",) + specification_name = fields.Char(compute="_compute_specification_name",) contract_id = fields.Many2one( - "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", + "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",) order_id = fields.Many2one( "sale.order", string="Order", @@ -40,58 +26,29 @@ class ContractOrderAnnex(models.Model, IDocument, Extension): required=True, ) date_conclusion = fields.Date( - 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, + 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,) - design_period = fields.Integer( - string="Design Period", - ) - design_cost = fields.Monetary( - string="Design Cost", - ) + design_period = fields.Integer(string="Design Period",) + design_cost = fields.Monetary(string="Design Cost",) - design_doc_period = fields.Integer( - string="Documentation Design Period (days)", - ) - design_doc_cost = fields.Monetary( - string="Documentation Design Cost", - ) + design_doc_period = fields.Integer(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)") - installation_address = fields.Char( - string="Installation Address", - ) - installation_period = fields.Integer( - string="Installation Period (days)", - ) - installation_cost = fields.Integer( - string="Installation Cost", - ) + installation_address = fields.Char(string="Installation Address",) + 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_two = fields.Float( - string="Payment 2 Part (%)", - ) - payment_part_three = fields.Float( - string="Payment 3 Part (%)", - ) + payment_part_two = fields.Float(string="Payment 2 Part (%)",) + payment_part_three = fields.Float(string="Payment 3 Part (%)",) @api.multi @api.depends("name") @@ -128,8 +85,7 @@ class ContractOrderAnnex(models.Model, IDocument, Extension): order_number = self.order_id.name or "SO###" self.name = "{contract}-{order}".format( - contract=contract_number, - order=order_number, + contract=contract_number, order=order_number, ) @api.model diff --git a/models/res_partner_contract_field.py b/models/res_partner_contract_field.py index 127f0df..3737af8 100755 --- a/models/res_partner_contract_field.py +++ b/models/res_partner_contract_field.py @@ -6,25 +6,10 @@ class ContractField(models.Model): _description = "Contract Field" _order = "sequence" - name = fields.Char( - string="Name", - required=True, - translate=True, - ) + name = fields.Char(string="Name", 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, + 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,) diff --git a/models/res_partner_contract_field_transient.py b/models/res_partner_contract_field_transient.py index efbff8e..07f043c 100755 --- a/models/res_partner_contract_field_transient.py +++ b/models/res_partner_contract_field_transient.py @@ -6,33 +6,17 @@ class ContractFieldTransient(models.TransientModel): _description = "Contract Field Transient" _contract_wizard_id = fields.Many2one( - "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, + "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,) technical_name = fields.Char( related="contract_field_id.technical_name", string="Technical Name", readonly=True, ) description = fields.Char( - related="contract_field_id.description", - string="Description", - readonly=True, - ) - visible = fields.Boolean( - related="contract_field_id.visible", - ) - value = fields.Char( - string="Value", - default="", + related="contract_field_id.description", string="Description", readonly=True, ) + visible = fields.Boolean(related="contract_field_id.visible",) + value = fields.Char(string="Value", default="",) diff --git a/models/res_partner_document_template.py b/models/res_partner_document_template.py index 65f9961..7de7d06 100755 --- a/models/res_partner_document_template.py +++ b/models/res_partner_document_template.py @@ -39,9 +39,6 @@ class DocumentTemplate(models.Model): ] ) template_type = fields.Selection( - selection=[ - ("contract", "Contract"), - ("annex", "Annex"), - ] + selection=[("contract", "Contract"), ("annex", "Annex"),] ) sequence = fields.Integer() diff --git a/models/sale_order.py b/models/sale_order.py index 24c6eed..ecf4788 100755 --- a/models/sale_order.py +++ b/models/sale_order.py @@ -6,14 +6,9 @@ from ..utils import MODULE_NAME class SaleOrder(models.Model): _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( - "res.partner.contract.annex", - string="Contract Annex", - readonly=True, + "res.partner.contract.annex", string="Contract Annex", readonly=True, ) # Extend default field payment_term_id = fields.Many2one( diff --git a/wizard/res_partner_contract_wizard.py b/wizard/res_partner_contract_wizard.py index ca12ab1..0394cc1 100755 --- a/wizard/res_partner_contract_wizard.py +++ b/wizard/res_partner_contract_wizard.py @@ -46,14 +46,10 @@ class ContractWizard(models.TransientModel, Extension): default=_default_target, ) company_id = fields.Many2one( - "res.partner", - string="Company", - compute="_compute_company_id", + "res.partner", string="Company", compute="_compute_company_id", ) partner_id = fields.Many2one( - "res.partner", - string="Partner", - compute="_compute_partner_id", + "res.partner", string="Partner", compute="_compute_partner_id", ) document_name = fields.Char( string="Document Name", compute="_compute_document_name" @@ -71,8 +67,7 @@ class ContractWizard(models.TransientModel, Extension): string="Contract Fields", ) 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") @@ -98,11 +93,7 @@ class ContractWizard(models.TransientModel, Extension): @api.onchange("document_template") 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") def _onchange_document_template(self): @@ -112,9 +103,7 @@ class ContractWizard(models.TransientModel, Extension): def get_contract_field(technical_name): return self.env["res.partner.contract.field"].search( - [ - ("technical_name", "=", technical_name), - ] + [("technical_name", "=", technical_name),] ) model_to_action = { @@ -134,10 +123,7 @@ class ContractWizard(models.TransientModel, Extension): 4, self.env["res.partner.contract.field.transient"] .create( - { - "contract_field_id": get_contract_field(field).id, - "value": value, - } + {"contract_field_id": get_contract_field(field).id, "value": value,} ) .id, 0,