docs creating works except ir.actions.run, 615 str

This commit is contained in:
Alexandr 2021-05-03 23:17:54 +05:00
parent cd2bdd2748
commit 60d415192b
9 changed files with 24 additions and 26 deletions

View File

@ -187,7 +187,7 @@ MM = months[mm]
dd = dd if dd // 10 else '0{}'.format(dd)
mm = mm if mm // 10 else '0{}'.format(mm)
order_date = self.parse_odoo_datetime(self.order_id.date_order)
order_date = self.order_id.date_order
# ctx keys must be decalared in this xml with id equal to "contract_field_{technical_name}"
ctx = {

View File

@ -7,6 +7,6 @@ class ProductProduct(models.Model):
description_sale = fields.Text(
"Sale Description",
translate=True,
help="A product's description you want to inform to your customers.\n"
help="A product's description you want to tell to your customers.\n"
"This description will be copied to every Sales Order, Delivery Order and Customer Invoice/Credit Note",
)

View File

@ -15,7 +15,7 @@ class ResPartner(models.Model):
string="Name Initials",
)
function_genitive = fields.Char(
string="Function Genitive",
string="Job position genitive",
)
client_contract_ids = fields.One2many(
"res.partner.contract",
@ -33,7 +33,7 @@ class ResPartner(models.Model):
string="Actual Address",
)
representative_id = fields.Many2one(
"res.partner", string="Representative", help="Person, who represents company"
"res.partner", string="Representative", help="Person representing company"
)
representative_document = fields.Char(
string="Representative acts on the basis of",

View File

@ -36,7 +36,8 @@ class PartnerContract(models.Model): # , IDocument, Extension):
return contract_date
def _get_default_create_date_ts(self):
@staticmethod
def _get_default_create_date_ts():
"""Returns timestamp of now by local datetime"""
return datetime.datetime.now().timestamp()
@ -59,11 +60,11 @@ class PartnerContract(models.Model): # , IDocument, Extension):
)
create_date = fields.Datetime(string="Created on")
date_conclusion = fields.Date(
string="Date of system conclusion",
string="Signing date in system",
)
date_conclusion_fix = fields.Date(
string="Date of manual conclusion",
help="Field for manual edit when contract is signed or closed",
string="Actual signing date",
help="Field for pointing out manually when contract is signed or closed",
default=lambda self: self.date_conclusion,
)
contract_annex_ids = fields.One2many(
@ -140,11 +141,7 @@ class PartnerContract(models.Model): # , IDocument, Extension):
datetime.datetime -- date_conclusion_fix or date_conclusion or create_date
"""
date = self.date_conclusion_fix or self.date_conclusion
if date:
date = self.parse_odoo_date(date)
else:
date = self.parse_odoo_datetime(self.create_date)
return date
return date or self.create_date
def _(self, arg):
"""Uses in xml action (data/fields_default)

View File

@ -38,20 +38,20 @@ class ContractOrderAnnex(models.Model): # , IDocument, Extension):
order_id = fields.Many2one(
"sale.order",
string="Order",
help="Orders with this partner which are not uses in annexes yet",
help="This partner's orders which are not used in annexes yet",
required=True,
)
date_conclusion = fields.Date(
string="Conclusion Date",
string="Signing Date",
default=fields.Date.today(),
)
counter = fields.Integer(
string="",
help="Counter of Contract Annexes",
help="Contract Annexes counter",
)
currency_id = fields.Many2one(
related="company_id.currency_id",
readonly=True,
string="Currency",
default=lambda self: self.env.company.currency_id,
)
design_period = fields.Integer(

View File

@ -6,6 +6,7 @@ from ..utils import MODULE_NAME
class SaleOrder(models.Model):
_inherit = "sale.order"
# TODO: exists original field "commitment_date".
delivery_time = fields.Integer(
string="Delivery Time",
default=45,
@ -15,7 +16,7 @@ class SaleOrder(models.Model):
string="Contract Annex",
readonly=True,
)
# Extend default field
# Extend default field for showing payment terms created by this module only.
payment_term_id = fields.Many2one(
"account.payment.term",
domain=lambda self: [("id", "in", self._get_payment_terms())],

View File

@ -23,13 +23,13 @@ from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_
class Utils(models.AbstractModel):
_name = "client_contracts.utils"
@staticmethod
'''@staticmethod
def parse_odoo_date(date: str):
return dt.datetime.strptime(date, DEFAULT_SERVER_DATE_FORMAT)
@staticmethod
def parse_odoo_datetime(datetime: str):
return dt.datetime.strptime(datetime, DEFAULT_SERVER_DATETIME_FORMAT)
return dt.datetime.strptime(datetime, DEFAULT_SERVER_DATETIME_FORMAT)'''
@staticmethod
def to_fixed(number, digit=2):

View File

@ -20,7 +20,7 @@
<record id="res_partner_contract_info_inherit_view" model="ir.ui.view">
<field name="name">res.partner.contract.info</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="priority" eval="25"/>
<field name="arch" type="xml">
@ -63,13 +63,11 @@
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="25"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button class="oe_inline oe_stat_button" type="action" name="%(res_partner_contract_partner_action)d" attrs="{'invisible': [('parent_id', '!=', False)]}" icon="fa-pencil-square-o">
<field string="Contracts" name="contract_count" widget="statinfo"/>
</button>
</xpath>
</field>
</record>

View File

@ -17,8 +17,10 @@ class ContractWizard(models.TransientModel): # , Extension):
_inherit = ["client_contracts.utils"]
def _default_target(self):
_logger.debug("\n\n model: %s | id: %s \n\n", self.env.context.get("active_model"), self.env.context.get("self_id"))
return "{model},{target_id}".format(
model=self.active_model, target_id=int(self.env.context.get("self_id"))
# model=self.active_model, target_id=int(self.env.context.get("self_id"))
model=self.env.context.get("active_model"), target_id=int(self.env.context.get("self_id"))
)
def _default_document_template(self):
@ -177,7 +179,7 @@ class ContractWizard(models.TransientModel): # , Extension):
.create(
{
"name": attachment_name,
"datas_fname": attachment_name,
"store_fname": attachment_name,
"type": "binary",
"datas": encoded_data,
}