diff --git a/models/__init__.py b/models/__init__.py index 9be2ae2..7656172 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -3,4 +3,5 @@ from . import res_partner_contract from . import res_partner_contract_annex from . import res_partner_contract_field from . import res_partner_contract_field_transient +from . import res_partner_document_template from . import sale_order diff --git a/models/res_partner_contract.py b/models/res_partner_contract.py index 73f6dc2..c836640 100644 --- a/models/res_partner_contract.py +++ b/models/res_partner_contract.py @@ -125,42 +125,3 @@ class PartnerContract(models.Model): arg {str} -- String to translate """ return _(arg) - - -class DocumentTemplate(models.Model): - _name = "res.partner.document.template" - _description = "Document Template" - _order = "template_type desc,company_type,sequence" - - name = fields.Char() - attachment_id = fields.Many2one( - "ir.attachment", string="Template Attachment", ondelete="cascade", required=True, - ) - document_type = fields.Selection( - string="Type of document", - selection=[ - ("contract", _("Contract")), - ("annex", _("Annex")), - ("addition", _("Addition")), - ] - ) - document_type_name = fields.Selection( - string="Document", - selection=[ - ("specification", _("Specification")), - ("approval_list", _("Approval List")), - ("act_at", _("Act of Acceptance and Transfer")), - ("act_ad", _("Act of Acceptance and Delivery")), - ] - ) - company_type = fields.Selection( - selection=[ - ("person", "Individual"), - ("sp", "Sole Proprietor"), - ("plc", "Private Limited Company"), - ] - ) - template_type = fields.Selection( - selection=[("contract", "Contract"), ("annex", "Annex"),] - ) - sequence = fields.Integer() diff --git a/models/res_partner_document_template.py b/models/res_partner_document_template.py new file mode 100644 index 0000000..7b391d7 --- /dev/null +++ b/models/res_partner_document_template.py @@ -0,0 +1,40 @@ +from odoo import _, fields, models + + +class DocumentTemplate(models.Model): + _name = "res.partner.document.template" + _description = "Document Template" + _order = "template_type desc,company_type,sequence" + + name = fields.Char() + attachment_id = fields.Many2one( + "ir.attachment", string="Template Attachment", ondelete="cascade", required=True, + ) + document_type = fields.Selection( + string="Type of document", + selection=[ + ("contract", _("Contract")), + ("annex", _("Annex")), + ("addition", _("Addition")), + ] + ) + document_type_name = fields.Selection( + string="Document", + selection=[ + ("specification", _("Specification")), + ("approval_list", _("Approval List")), + ("act_at", _("Act of Acceptance and Transfer")), + ("act_ad", _("Act of Acceptance and Delivery")), + ] + ) + company_type = fields.Selection( + selection=[ + ("person", "Individual"), + ("sp", "Sole Proprietor"), + ("plc", "Private Limited Company"), + ] + ) + template_type = fields.Selection( + selection=[("contract", "Contract"), ("annex", "Annex"),] + ) + sequence = fields.Integer()