diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..11f1f69
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,846 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ data
+ o.
+ valign=top
+ <br>
+
+
+ docs[0].
+ valign="top"
+ width="49%"
+ <br/>
+ align="left"
+ <br />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1540457007119
+
+
+ 1540457007119
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/models/models.py b/models/models.py
index 5a59a0b..8cf8ac0 100644
--- a/models/models.py
+++ b/models/models.py
@@ -9,21 +9,6 @@ class PartnerContract(models.Model):
_name = 'res.partner.contract'
- @api.onchange('date')
- def _change_contract_name(self):
- """
- Procedure for forming contract name
- :return: contract name in format "DDMM-YY-№"
- """
- contract_date = datetime.strptime(self.date, '%Y-%m-%d')
- date_part = contract_date.strftime('%d%m-%y')
- today_contracts = self.search([('date', '=', contract_date.date())])
- if len(today_contracts) > 0:
- last_contract_number = int(today_contracts[-1].name.split('-')[2]) + 1
- else:
- last_contract_number = 1
- self.name = '{}-{}'.format(date_part, last_contract_number)
-
name = fields.Char(
string='Contract number',
help='Number of contract, letters and digits',)
@@ -44,16 +29,28 @@ class PartnerContract(models.Model):
string='Annexes',
help='Annexes to this contract')
- @api.model
- def create(self, vals):
- contract_date = datetime.now()
+ def _calculate_contract_name(self, _date):
+ contract_date = datetime.strptime(_date, '%Y-%m-%d')
date_part = contract_date.strftime('%d%m-%y')
today_contracts = self.search([('date', '=', contract_date.date())])
if len(today_contracts) > 0:
last_contract_number = int(today_contracts[-1].name.split('-')[2]) + 1
else:
last_contract_number = 1
- vals['name'] = '{}-{}'.format(date_part, last_contract_number)
+ return '{}-{}'.format(date_part, last_contract_number)
+
+ @api.onchange('date')
+ def _change_contract_name(self):
+ """
+ Procedure for forming contract name
+ :return: contract name in format "DDMM-YY-№"
+ """
+
+ self.name = self._calculate_contract_name(self.date)
+
+ @api.model
+ def create(self, vals):
+ vals['name'] = self._calculate_contract_name(datetime.now())
return super(PartnerContract, self).create(vals)
diff --git a/views/templates.xml b/views/templates.xml
index 4dde9f8..3748896 100644
--- a/views/templates.xml
+++ b/views/templates.xml
@@ -6,10 +6,10 @@
-
+
|
- 7 495 008-84-67 hello@tabulasense.ru
+
|
@@ -535,7 +535,7 @@
-
+
|
@@ -549,7 +549,7 @@
М.П.
- 
+
|
М.П.
@@ -598,7 +598,7 @@
|
-
+
|
@@ -612,7 +612,7 @@
М.П.
- 
+
|
М.П. |
@@ -662,7 +662,8 @@
-
+
+
|
@@ -676,7 +677,7 @@
М.П.
- 
+
|
|