Merge branch 'development' into 'master'
Development See merge request odoo/client_contracts!11
This commit is contained in:
commit
a8a7e14ed0
@ -196,6 +196,17 @@ ctx = {
|
|||||||
"order_name": self.order_id.name,
|
"order_name": self.order_id.name,
|
||||||
"order_date": "{} {} {}".format(order_date.day, months[order_date.month], order_date.year),
|
"order_date": "{} {} {}".format(order_date.day, months[order_date.month], order_date.year),
|
||||||
|
|
||||||
|
"design_cost": self.to_fixed(self.design_cost),
|
||||||
|
"design_period": self.design_period,
|
||||||
|
"design_doc_cost": self.to_fixed(self.design_doc_cost),
|
||||||
|
"design_doc_period": self.design_doc_period,
|
||||||
|
"delivery_address": self.delivery_address,
|
||||||
|
"delivery_period": self.delivery_period,
|
||||||
|
"installation_address": self.installation_address,
|
||||||
|
"installation_cost": self.to_fixed(self.installation_cost),
|
||||||
|
"installation_period": self.installation_period,
|
||||||
|
"total_cost": self.to_fixed(self.total_cost),
|
||||||
|
|
||||||
"payment_part_one": self.payment_part_one,
|
"payment_part_one": self.payment_part_one,
|
||||||
"payment_part_two": self.payment_part_two,
|
"payment_part_two": self.payment_part_two,
|
||||||
"payment_part_three": self.payment_part_three,
|
"payment_part_three": self.payment_part_three,
|
||||||
@ -331,11 +342,81 @@ action = ctx
|
|||||||
<field name="sequence">4</field>
|
<field name="sequence">4</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_design_cost" model="res.partner.contract.field">
|
||||||
|
<field name="name">Design Cost</field>
|
||||||
|
<field name="technical_name">design_cost</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_design_period" model="res.partner.contract.field">
|
||||||
|
<field name="name">Design Period</field>
|
||||||
|
<field name="technical_name">design_period</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_design_doc_period" model="res.partner.contract.field">
|
||||||
|
<field name="name">Design Documentation Period</field>
|
||||||
|
<field name="technical_name">design_doc_period</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_design_doc_cost" model="res.partner.contract.field">
|
||||||
|
<field name="name">Design Documentation Cost</field>
|
||||||
|
<field name="technical_name">design_doc_cost</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_delivery_address" model="res.partner.contract.field">
|
||||||
|
<field name="name">Delivery Address</field>
|
||||||
|
<field name="technical_name">delivery_address</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_delivery_period" model="res.partner.contract.field">
|
||||||
|
<field name="name">Delivery Period</field>
|
||||||
|
<field name="technical_name">delivery_period</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_installation_address" model="res.partner.contract.field">
|
||||||
|
<field name="name">Installation Address</field>
|
||||||
|
<field name="technical_name">installation_address</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_installation_cost" model="res.partner.contract.field">
|
||||||
|
<field name="name">Installation Cost</field>
|
||||||
|
<field name="technical_name">installation_cost</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_installation_period" model="res.partner.contract.field">
|
||||||
|
<field name="name">Installation Period</field>
|
||||||
|
<field name="technical_name">installation_period</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_total_cost" model="res.partner.contract.field">
|
||||||
|
<field name="name">Total Cost</field>
|
||||||
|
<field name="technical_name">total_cost</field>
|
||||||
|
<field name="description"></field>
|
||||||
|
<field name="visible">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="contract_field_dd" model="res.partner.contract.field">
|
<record id="contract_field_dd" model="res.partner.contract.field">
|
||||||
<field name="name">Day</field>
|
<field name="name">Day</field>
|
||||||
<field name="technical_name">dd</field>
|
<field name="technical_name">dd</field>
|
||||||
<field name="description">Number</field>
|
<field name="description">Number</field>
|
||||||
<field name="sequence">8</field>
|
<field name="sequence">11</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="contract_field_mm" model="res.partner.contract.field">
|
<record id="contract_field_mm" model="res.partner.contract.field">
|
||||||
@ -401,13 +482,6 @@ action = ctx
|
|||||||
<field name="sequence">37</field>
|
<field name="sequence">37</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="contract_field_delivery_period" model="res.partner.contract.field">
|
|
||||||
<field name="name">Delivery Period</field>
|
|
||||||
<field name="technical_name">delivery_period</field>
|
|
||||||
<field name="description"></field>
|
|
||||||
<field name="sequence">38</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Seller -->
|
<!-- Seller -->
|
||||||
|
|
||||||
|
44
i18n/ru.po
44
i18n/ru.po
@ -6,8 +6,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 11.0-20191106\n"
|
"Project-Id-Version: Odoo Server 11.0-20191106\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2020-01-22 11:29+0000\n"
|
"POT-Creation-Date: 2020-01-29 11:03+0000\n"
|
||||||
"PO-Revision-Date: 2020-01-22 11:29+0000\n"
|
"PO-Revision-Date: 2020-01-29 11:03+0000\n"
|
||||||
"Last-Translator: Stepan Savelyev\n"
|
"Last-Translator: Stepan Savelyev\n"
|
||||||
"Language-Team: RYDLAB\n"
|
"Language-Team: RYDLAB\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@ -306,6 +306,7 @@ msgid "Created on"
|
|||||||
msgstr "Создан"
|
msgstr "Создан"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
|
#: model:ir.model.fields,field_description:client_contracts.field_crm_lead_currency_id
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_currency_id
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_currency_id
|
||||||
msgid "Currency"
|
msgid "Currency"
|
||||||
msgstr "Валюта"
|
msgstr "Валюта"
|
||||||
@ -332,6 +333,7 @@ msgstr "Доставка"
|
|||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_delivery_address
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_delivery_address
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_delivery_address
|
||||||
msgid "Delivery Address"
|
msgid "Delivery Address"
|
||||||
msgstr "Адрес доставки"
|
msgstr "Адрес доставки"
|
||||||
|
|
||||||
@ -363,9 +365,26 @@ msgstr "Дизайн"
|
|||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_design_cost
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_design_cost
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_design_cost
|
||||||
msgid "Design Cost"
|
msgid "Design Cost"
|
||||||
msgstr "Стоимость разработки дизайна"
|
msgstr "Стоимость разработки дизайна"
|
||||||
|
|
||||||
|
#. module: client_contracts
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_design_doc_cost
|
||||||
|
msgid "Design Documentation Cost"
|
||||||
|
msgstr "Стоимость разработки КД"
|
||||||
|
|
||||||
|
#. module: client_contracts
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_design_doc_period
|
||||||
|
msgid "Design Documentation Period"
|
||||||
|
msgstr "Срок разработки КД"
|
||||||
|
|
||||||
|
#. module: client_contracts
|
||||||
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_design_period
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_design_period
|
||||||
|
msgid "Design Period"
|
||||||
|
msgstr "Срок разработки дизайна"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_display_name
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_display_name
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_display_name
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_display_name
|
||||||
@ -522,14 +541,21 @@ msgstr "Монтаж"
|
|||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_installation_address
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_installation_address
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_installation_address
|
||||||
msgid "Installation Address"
|
msgid "Installation Address"
|
||||||
msgstr "Монтаж по адресу"
|
msgstr "Монтаж по адресу"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_installation_cost
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_installation_cost
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_installation_cost
|
||||||
msgid "Installation Cost"
|
msgid "Installation Cost"
|
||||||
msgstr "Стоимость монтажа"
|
msgstr "Стоимость монтажа"
|
||||||
|
|
||||||
|
#. module: client_contracts
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_installation_period
|
||||||
|
msgid "Installation Period"
|
||||||
|
msgstr "Срок монтажа изделий"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_installation_period
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_installation_period
|
||||||
msgid "Installation Period (days)"
|
msgid "Installation Period (days)"
|
||||||
@ -834,13 +860,13 @@ msgid "Print"
|
|||||||
msgstr "Печать"
|
msgstr "Печать"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: code:addons/client_contracts/models/res_partner_contract.py:99
|
#: code:addons/client_contracts/models/res_partner_contract.py:98
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Print Form of Contract"
|
msgid "Print Form of Contract"
|
||||||
msgstr "Форма печати договора"
|
msgstr "Форма печати договора"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: code:addons/client_contracts/models/res_partner_contract_annex.py:111
|
#: code:addons/client_contracts/models/res_partner_contract_annex.py:110
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Print Form of Contract Annex"
|
msgid "Print Form of Contract Annex"
|
||||||
msgstr "Форма печати приложения к договору"
|
msgstr "Форма печати приложения к договору"
|
||||||
@ -865,11 +891,6 @@ msgstr "Вложение-шаблон приложения к договору"
|
|||||||
msgid "Private Limited Company"
|
msgid "Private Limited Company"
|
||||||
msgstr "Общество с ограниченной ответственностью"
|
msgstr "Общество с ограниченной ответственностью"
|
||||||
|
|
||||||
#. module: client_contracts
|
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_development_period
|
|
||||||
msgid "Product Development Period (days)"
|
|
||||||
msgstr "Срок разработки изделий"
|
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model,name:client_contracts.model_sale_order
|
#: model:ir.model,name:client_contracts.model_sale_order
|
||||||
msgid "Quotation"
|
msgid "Quotation"
|
||||||
@ -1027,6 +1048,7 @@ msgstr "Наименование, используемое при заполне
|
|||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_total_cost
|
#: model:ir.model.fields,field_description:client_contracts.field_res_partner_contract_annex_total_cost
|
||||||
|
#: model:res.partner.contract.field,name:client_contracts.contract_field_total_cost
|
||||||
msgid "Total Cost"
|
msgid "Total Cost"
|
||||||
msgstr "Общая стоимость"
|
msgstr "Общая стоимость"
|
||||||
|
|
||||||
@ -1091,13 +1113,13 @@ msgid "res.partner.contract.wizard"
|
|||||||
msgstr "res.partner.contract.wizard"
|
msgstr "res.partner.contract.wizard"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: code:addons/client_contracts/models/res_partner_contract_annex.py:64
|
#: code:addons/client_contracts/models/res_partner_contract_annex.py:63
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "{name} from {date}"
|
msgid "{name} from {date}"
|
||||||
msgstr "{name} от {date}"
|
msgstr "{name} от {date}"
|
||||||
|
|
||||||
#. module: client_contracts
|
#. module: client_contracts
|
||||||
#: code:addons/client_contracts/models/res_partner_contract.py:112
|
#: code:addons/client_contracts/models/res_partner_contract.py:111
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "{type} {number} from {date}"
|
msgid "{type} {number} from {date}"
|
||||||
msgstr "{type} {number} от {date}"
|
msgstr "{type} {number} от {date}"
|
||||||
|
@ -31,8 +31,7 @@ class ContractOrderAnnex(models.Model, IDocument, Extension):
|
|||||||
counter = fields.Integer(string="№", help="Counter of Contract Annexes",)
|
counter = fields.Integer(string="№", help="Counter of Contract Annexes",)
|
||||||
currency_id = fields.Many2one(related="company_id.currency_id", readonly=True,)
|
currency_id = fields.Many2one(related="company_id.currency_id", readonly=True,)
|
||||||
|
|
||||||
development_period = fields.Integer("Product Development Period (days)",)
|
design_period = fields.Integer(string="Design Period",)
|
||||||
|
|
||||||
design_cost = fields.Monetary(string="Design Cost",)
|
design_cost = fields.Monetary(string="Design Cost",)
|
||||||
|
|
||||||
design_doc_period = fields.Integer(string="Documentation Design Period (days)",)
|
design_doc_period = fields.Integer(string="Documentation Design Period (days)",)
|
||||||
|
@ -4,7 +4,7 @@ from odoo import _, fields, models
|
|||||||
class DocumentTemplate(models.Model):
|
class DocumentTemplate(models.Model):
|
||||||
_name = "res.partner.document.template"
|
_name = "res.partner.document.template"
|
||||||
_description = "Document Template"
|
_description = "Document Template"
|
||||||
_order = "company_type,document_type,sequence"
|
_order = "template_type desc,company_type,sequence"
|
||||||
|
|
||||||
name = fields.Char()
|
name = fields.Char()
|
||||||
attachment_id = fields.Many2one(
|
attachment_id = fields.Many2one(
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -26,3 +26,8 @@ class Extension(object):
|
|||||||
|
|
||||||
def parse_odoo_datetime(self, datetime: str):
|
def parse_odoo_datetime(self, datetime: str):
|
||||||
return dt.datetime.strptime(datetime, DEFAULT_SERVER_DATETIME_FORMAT)
|
return dt.datetime.strptime(datetime, DEFAULT_SERVER_DATETIME_FORMAT)
|
||||||
|
|
||||||
|
def to_fixed(self, number, digit=2):
|
||||||
|
if isinstance(number, str) and number.isdigit():
|
||||||
|
number = float(number)
|
||||||
|
return format(number, ".{digit}f".format(digit=digit))
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
<field name="date_conclusion"/>
|
<field name="date_conclusion"/>
|
||||||
</group>
|
</group>
|
||||||
<group name="design" string="Design">
|
<group name="design" string="Design">
|
||||||
|
<field name="design_period"/>
|
||||||
<field name="design_cost"/>
|
<field name="design_cost"/>
|
||||||
<field name="design_doc_period"/>
|
<field name="design_doc_period"/>
|
||||||
<field name="design_doc_cost"/>
|
<field name="design_doc_cost"/>
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
import base64
|
import base64
|
||||||
|
import logging
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
from ..utils import MODULE_NAME
|
from ..utils import MODULE_NAME
|
||||||
from ..utils.docxtpl import get_document_from_values_stream
|
from ..utils.docxtpl import get_document_from_values_stream
|
||||||
|
from ..utils.misc import Extension
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ContractWizard(models.TransientModel):
|
class ContractWizard(models.TransientModel, Extension):
|
||||||
_name = "res.partner.contract.wizard"
|
_name = "res.partner.contract.wizard"
|
||||||
|
|
||||||
def _default_target(self):
|
def _default_target(self):
|
||||||
@ -173,7 +177,6 @@ class ContractWizard(models.TransientModel):
|
|||||||
for transient_field in (
|
for transient_field in (
|
||||||
self.transient_field_ids + self.transient_field_ids_hidden
|
self.transient_field_ids + self.transient_field_ids_hidden
|
||||||
)
|
)
|
||||||
if transient_field.technical_name and transient_field.value
|
|
||||||
}
|
}
|
||||||
# Extend with special case
|
# Extend with special case
|
||||||
if self.target._name == "res.partner.contract.annex":
|
if self.target._name == "res.partner.contract.annex":
|
||||||
@ -194,19 +197,21 @@ class ContractWizard(models.TransientModel):
|
|||||||
|
|
||||||
fields.update(
|
fields.update(
|
||||||
{
|
{
|
||||||
"order_products": [
|
"products": [
|
||||||
{
|
{
|
||||||
"number": next(counter),
|
"number": next(counter),
|
||||||
"label": item.product_id.name,
|
"label": item.product_id.name,
|
||||||
|
"description": item.product_id.description_sale,
|
||||||
"count": item.product_uom_qty,
|
"count": item.product_uom_qty,
|
||||||
"unit": item.product_uom.name,
|
"unit": item.product_uom.name,
|
||||||
"cost": item.price_unit,
|
"cost": self.to_fixed(item.price_unit),
|
||||||
"amount": item.price_subtotal,
|
"subtotal": self.to_fixed(item.price_subtotal),
|
||||||
} for item in self.target.order_id.order_line or []
|
} for item in self.target.order_id.order_line or []
|
||||||
]
|
],
|
||||||
|
"total_amount": self.to_fixed(sum(self.target.order_id.order_line.mapped("price_subtotal")))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return fields
|
return self.middleware_fields(fields)
|
||||||
|
|
||||||
def afterload(self, result):
|
def afterload(self, result):
|
||||||
res_id = self.target.id
|
res_id = self.target.id
|
||||||
@ -224,6 +229,18 @@ class ContractWizard(models.TransientModel):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def middleware_fields(self, kv):
|
||||||
|
|
||||||
|
# Debug False values
|
||||||
|
empty = []
|
||||||
|
for k,v in list(kv.items()):
|
||||||
|
if not v:
|
||||||
|
empty.append(k)
|
||||||
|
kv.pop(k)
|
||||||
|
_logger.debug("Empty fields: {}".format(empty))
|
||||||
|
|
||||||
|
return kv
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_model(self):
|
def active_model(self):
|
||||||
return self.env.context.get("active_model")
|
return self.env.context.get("active_model")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user