docs creating works except ir.actions.run, 615 str
This commit is contained in:
parent
cd2bdd2748
commit
60d415192b
@ -187,7 +187,7 @@ MM = months[mm]
|
|||||||
dd = dd if dd // 10 else '0{}'.format(dd)
|
dd = dd if dd // 10 else '0{}'.format(dd)
|
||||||
mm = mm if mm // 10 else '0{}'.format(mm)
|
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 keys must be decalared in this xml with id equal to "contract_field_{technical_name}"
|
||||||
ctx = {
|
ctx = {
|
||||||
|
@ -7,6 +7,6 @@ class ProductProduct(models.Model):
|
|||||||
description_sale = fields.Text(
|
description_sale = fields.Text(
|
||||||
"Sale Description",
|
"Sale Description",
|
||||||
translate=True,
|
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",
|
"This description will be copied to every Sales Order, Delivery Order and Customer Invoice/Credit Note",
|
||||||
)
|
)
|
||||||
|
@ -15,7 +15,7 @@ class ResPartner(models.Model):
|
|||||||
string="Name Initials",
|
string="Name Initials",
|
||||||
)
|
)
|
||||||
function_genitive = fields.Char(
|
function_genitive = fields.Char(
|
||||||
string="Function Genitive",
|
string="Job position genitive",
|
||||||
)
|
)
|
||||||
client_contract_ids = fields.One2many(
|
client_contract_ids = fields.One2many(
|
||||||
"res.partner.contract",
|
"res.partner.contract",
|
||||||
@ -33,7 +33,7 @@ class ResPartner(models.Model):
|
|||||||
string="Actual Address",
|
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 representing company"
|
||||||
)
|
)
|
||||||
representative_document = fields.Char(
|
representative_document = fields.Char(
|
||||||
string="Representative acts on the basis of",
|
string="Representative acts on the basis of",
|
||||||
|
@ -36,7 +36,8 @@ class PartnerContract(models.Model): # , IDocument, Extension):
|
|||||||
|
|
||||||
return contract_date
|
return contract_date
|
||||||
|
|
||||||
def _get_default_create_date_ts(self):
|
@staticmethod
|
||||||
|
def _get_default_create_date_ts():
|
||||||
"""Returns timestamp of now by local datetime"""
|
"""Returns timestamp of now by local datetime"""
|
||||||
return datetime.datetime.now().timestamp()
|
return datetime.datetime.now().timestamp()
|
||||||
|
|
||||||
@ -59,11 +60,11 @@ class PartnerContract(models.Model): # , IDocument, Extension):
|
|||||||
)
|
)
|
||||||
create_date = fields.Datetime(string="Created on")
|
create_date = fields.Datetime(string="Created on")
|
||||||
date_conclusion = fields.Date(
|
date_conclusion = fields.Date(
|
||||||
string="Date of system conclusion",
|
string="Signing date in system",
|
||||||
)
|
)
|
||||||
date_conclusion_fix = fields.Date(
|
date_conclusion_fix = fields.Date(
|
||||||
string="Date of manual conclusion",
|
string="Actual signing date",
|
||||||
help="Field for manual edit when contract is signed or closed",
|
help="Field for pointing out manually when contract is signed or closed",
|
||||||
default=lambda self: self.date_conclusion,
|
default=lambda self: self.date_conclusion,
|
||||||
)
|
)
|
||||||
contract_annex_ids = fields.One2many(
|
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
|
datetime.datetime -- date_conclusion_fix or date_conclusion or create_date
|
||||||
"""
|
"""
|
||||||
date = self.date_conclusion_fix or self.date_conclusion
|
date = self.date_conclusion_fix or self.date_conclusion
|
||||||
if date:
|
return date or self.create_date
|
||||||
date = self.parse_odoo_date(date)
|
|
||||||
else:
|
|
||||||
date = self.parse_odoo_datetime(self.create_date)
|
|
||||||
return date
|
|
||||||
|
|
||||||
def _(self, arg):
|
def _(self, arg):
|
||||||
"""Uses in xml action (data/fields_default)
|
"""Uses in xml action (data/fields_default)
|
||||||
|
@ -38,20 +38,20 @@ class ContractOrderAnnex(models.Model): # , IDocument, Extension):
|
|||||||
order_id = fields.Many2one(
|
order_id = fields.Many2one(
|
||||||
"sale.order",
|
"sale.order",
|
||||||
string="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,
|
required=True,
|
||||||
)
|
)
|
||||||
date_conclusion = fields.Date(
|
date_conclusion = fields.Date(
|
||||||
string="Conclusion Date",
|
string="Signing Date",
|
||||||
default=fields.Date.today(),
|
default=fields.Date.today(),
|
||||||
)
|
)
|
||||||
counter = fields.Integer(
|
counter = fields.Integer(
|
||||||
string="№",
|
string="№",
|
||||||
help="Counter of Contract Annexes",
|
help="Contract Annexes counter",
|
||||||
)
|
)
|
||||||
currency_id = fields.Many2one(
|
currency_id = fields.Many2one(
|
||||||
related="company_id.currency_id",
|
string="Currency",
|
||||||
readonly=True,
|
default=lambda self: self.env.company.currency_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
design_period = fields.Integer(
|
design_period = fields.Integer(
|
||||||
|
@ -6,6 +6,7 @@ from ..utils import MODULE_NAME
|
|||||||
class SaleOrder(models.Model):
|
class SaleOrder(models.Model):
|
||||||
_inherit = "sale.order"
|
_inherit = "sale.order"
|
||||||
|
|
||||||
|
# TODO: exists original field "commitment_date".
|
||||||
delivery_time = fields.Integer(
|
delivery_time = fields.Integer(
|
||||||
string="Delivery Time",
|
string="Delivery Time",
|
||||||
default=45,
|
default=45,
|
||||||
@ -15,7 +16,7 @@ class SaleOrder(models.Model):
|
|||||||
string="Contract Annex",
|
string="Contract Annex",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
# Extend default field
|
# Extend default field for showing payment terms created by this module only.
|
||||||
payment_term_id = fields.Many2one(
|
payment_term_id = fields.Many2one(
|
||||||
"account.payment.term",
|
"account.payment.term",
|
||||||
domain=lambda self: [("id", "in", self._get_payment_terms())],
|
domain=lambda self: [("id", "in", self._get_payment_terms())],
|
||||||
|
@ -23,13 +23,13 @@ from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_
|
|||||||
class Utils(models.AbstractModel):
|
class Utils(models.AbstractModel):
|
||||||
_name = "client_contracts.utils"
|
_name = "client_contracts.utils"
|
||||||
|
|
||||||
@staticmethod
|
'''@staticmethod
|
||||||
def parse_odoo_date(date: str):
|
def parse_odoo_date(date: str):
|
||||||
return dt.datetime.strptime(date, DEFAULT_SERVER_DATE_FORMAT)
|
return dt.datetime.strptime(date, DEFAULT_SERVER_DATE_FORMAT)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_odoo_datetime(datetime: str):
|
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
|
@staticmethod
|
||||||
def to_fixed(number, digit=2):
|
def to_fixed(number, digit=2):
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<record id="res_partner_contract_info_inherit_view" model="ir.ui.view">
|
<record id="res_partner_contract_info_inherit_view" model="ir.ui.view">
|
||||||
<field name="name">res.partner.contract.info</field>
|
<field name="name">res.partner.contract.info</field>
|
||||||
<field name="model">res.partner</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="priority" eval="25"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
@ -63,13 +63,11 @@
|
|||||||
<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="priority" eval="25"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
<xpath expr="//div[@name='button_box']" position="inside">
|
<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">
|
<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"/>
|
<field string="Contracts" name="contract_count" widget="statinfo"/>
|
||||||
</button>
|
</button>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -17,8 +17,10 @@ class ContractWizard(models.TransientModel): # , Extension):
|
|||||||
_inherit = ["client_contracts.utils"]
|
_inherit = ["client_contracts.utils"]
|
||||||
|
|
||||||
def _default_target(self):
|
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(
|
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):
|
def _default_document_template(self):
|
||||||
@ -177,7 +179,7 @@ class ContractWizard(models.TransientModel): # , Extension):
|
|||||||
.create(
|
.create(
|
||||||
{
|
{
|
||||||
"name": attachment_name,
|
"name": attachment_name,
|
||||||
"datas_fname": attachment_name,
|
"store_fname": attachment_name,
|
||||||
"type": "binary",
|
"type": "binary",
|
||||||
"datas": encoded_data,
|
"datas": encoded_data,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user