diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 11f1f69..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,846 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/contract_wizard.py b/models/contract_wizard.py index c19cf0c..2d44ae3 100644 --- a/models/contract_wizard.py +++ b/models/contract_wizard.py @@ -82,7 +82,7 @@ class ContractWizard(models.TransientModel): @api.onchange('contract_id') def _compute_context_date(self): contract_date = datetime.strptime(self.contract_id.date, '%Y-%m-%d') - self._context_date = contract_date.strftime('%d %b %Y') + self._context_date = contract_date.strftime('%d %B %Y') @api.onchange('partner_id') def _compute_context_partner_contract_name(self): @@ -236,42 +236,77 @@ class ContractWizard(models.TransientModel): def _compute_context_payment_term_word(self): self._context_payment_term_word = numeral.in_words(self.payment_terms) - _context_name = fields.Char(compute='_compute_context_name', readonly=True) - _context_date = fields.Char(compute='_compute_context_date', readonly=True) - _context_partner_contract_name = fields.Char(compute='_compute_context_partner_contract_name', readonly=True) + _context_name = fields.Char(string='Contract number', compute='_compute_context_name', readonly=True) + _context_date = fields.Char(string='Contract date', compute='_compute_context_date', readonly=True) + _context_partner_contract_name = fields.Char(string='Partner contract name', + compute='_compute_context_partner_contract_name', readonly=True) _context_partner_adress = fields.Char(compute='_compute_context_partner_adress', readonly=True) - _context_partner_representer_contract_name = fields.Char( + _context_partner_representer_contract_name = fields.Char(string='partner representer contract name', compute='_compute_context_partner_representer_contract_name', readonly=True) - _context_partner_inn = fields.Char(compute='_compute_context_partner_inn', readonly=True) - _context_partner_kpp = fields.Char(compute='_compute_context_partner_kpp', readonly=True) - _context_partner_rs = fields.Char(compute='_compute_context_partner_rs', readonly=True) - _context_partner_bik = fields.Char(compute='_compute_context_partner_bik', readonly=True) - _context_partner_bank = fields.Char(compute='_compute_context_partner_bank', readonly=True) - _context_partner_phone = fields.Char(compute='_compute_context_partner_phone', readonly=True) - _context_partner_representer_name = fields.Char(compute='_compute_context_partner_representer_name', readonly=True) - _context_seller_contract_name = fields.Char(compute='_compute_context_seller_contract_name', readonly=True) - _context_seller_adress = fields.Char(compute='_compute_context_seller_adress', readonly=True) - _context_seller_representer_contract_job_name = fields.Char( + _context_partner_inn = fields.Char(string='Partner inn', compute='_compute_context_partner_inn', readonly=True) + _context_partner_kpp = fields.Char(string='Partner kpp', compute='_compute_context_partner_kpp', readonly=True) + _context_partner_rs = fields.Char(string='Partner corresponding account', + compute='_compute_context_partner_rs', + readonly=True) + _context_partner_bik = fields.Char(string='Partner bank bik', + compute='_compute_context_partner_bik', + readonly=True) + _context_partner_bank = fields.Char(string='Partner bank name', + compute='_compute_context_partner_bank', + readonly=True) + _context_partner_phone = fields.Char(string='Partner phone', + compute='_compute_context_partner_phone', + readonly=True) + _context_partner_representer_name = fields.Char(string='Partner representer name', + compute='_compute_context_partner_representer_name', + readonly=True) + _context_seller_contract_name = fields.Char(string='Seller contract name', + compute='_compute_context_seller_contract_name', + readonly=True) + _context_seller_adress = fields.Char(string='Seller full adress', + compute='_compute_context_seller_adress', + readonly=True) + _context_seller_representer_contract_job_name = fields.Char(string='Seller representer contract job name', compute='_compute_context_seller_representer_contract_job_name', readonly=True) - _context_seller_representer_contract_name = fields.Char(compute='_compute_context_seller_representer_contract_name', + _context_seller_representer_contract_name = fields.Char(string='Seller representer contract name', + compute='_compute_context_seller_representer_contract_name', readonly=True) - _context_seller_inn = fields.Char(compute='_compute_context_seller_inn', readonly=True) - _context_seller_kpp = fields.Char(compute='_compute_context_seller_kpp', readonly=True) - _context_seller_rs = fields.Char(compute='_compute_context_seller_rs', readonly=True) - _context_seller_bik = fields.Char(compute='_compute_context_seller_bik', readonly=True) - _context_seller_bank = fields.Char(compute='_compute_context_seller_bank', readonly=True) - _context_seller_phone = fields.Char(compute='_compute_context_seller_phone', readonly=True) - _context_seller_representer_job_name = fields.Char(compute='_compute_context_seller_representer_job_name', + _context_seller_inn = fields.Char(string='Seller inn', compute='_compute_context_seller_inn', readonly=True) + _context_seller_kpp = fields.Char(string='Seller kpp', compute='_compute_context_seller_kpp', readonly=True) + _context_seller_rs = fields.Char(string='Seller corresponding account', + compute='_compute_context_seller_rs', + readonly=True) + _context_seller_bik = fields.Char(string='Seller bank bik', compute='_compute_context_seller_bik', readonly=True) + _context_seller_bank = fields.Char(string='Seller bank name', compute='_compute_context_seller_bank', readonly=True) + _context_seller_phone = fields.Char(string='Seller phone', compute='_compute_context_seller_phone', readonly=True) + _context_seller_representer_job_name = fields.Char(string='Seller representer job name', + compute='_compute_context_seller_representer_job_name', readonly=True) - _context_seller_representer_name = fields.Char(compute='_compute_context_seller_representer_name', readonly=True) - _context_summ_rub = fields.Char(compute='_compute_context_summ_rub', readonly=True) - _context_summ_rub_word = fields.Char(compute='_compute_context_summ_rub_word', readonly=True) - _context_summ_kop = fields.Char(compute='_compute_context_summ_kop', readonly=True) - _context_summ_word = fields.Char(compute='_compute_context_summ_word', readonly=True) - _context_delivery_term = fields.Char(compute='_compute_context_delivery_term', readonly=True) - _context_delivery_term_word = fields.Char(compute='_compute_context_delivery_term_word', readonly=True) - _context_payment_term = fields.Char(compute='_compute_context_payment_term', readonly=True) - _context_payment_term_word = fields.Char(compute='_compute_context_payment_term_word', readonly=True) + _context_seller_representer_name = fields.Char(string='Seller representer name', + compute='_compute_context_seller_representer_name', readonly=True) + _context_summ_rub = fields.Char(string='Contract summ(rub)', compute='_compute_context_summ_rub', readonly=True) + _context_summ_rub_word = fields.Char(string='Contract summ(rub), word', + compute='_compute_context_summ_rub_word', + readonly=True) + _context_summ_kop = fields.Char(string='Contract summ(kop)', compute='_compute_context_summ_kop', readonly=True) + _context_summ_word = fields.Char(string='Contract summ word', compute='_compute_context_summ_word', readonly=True) + _context_delivery_term = fields.Char(string='Contract delivery term', + compute='_compute_context_delivery_term', + readonly=True) + _context_delivery_term_word = fields.Char(string='Contract delivery term word', + compute='_compute_context_delivery_term_word', + readonly=True) + _context_payment_term = fields.Char(string='Contract payment term', + compute='_compute_context_payment_term', readonly=True) + _context_payment_term_word = fields.Char(string='Contract payment term word', + compute='_compute_context_payment_term_word', readonly=True) + _context_partner_passport_data = fields.Char(string='Partner passport data', + compute='_compute_partner_passport_data', + readonly=True) + + @api.onchange('partner_id') + def _compute_partner_passport_data(self): + return self.partner_id.passport_data @api.onchange('partner_id') def _set_order_domain(self): @@ -326,6 +361,7 @@ class ContractWizard(models.TransientModel): 'partner_rs': self.partner_id.bank_account.acc_number, 'partner_bik': self.partner_id.bank_account.bank_id.bic, 'partner_bank': self.partner_id.bank_account.bank_id.name, + 'partner_passport_data': self.partner_id.passport_data, 'partner_phone': self.partner_id.phone, 'partner_representer_name': self.partner_id.representative_id.name, 'seller_contract_name': self.company_id.contract_name, @@ -354,7 +390,7 @@ class ContractWizard(models.TransientModel): def get_docx_contract_1(self): odoo_data_dir = config.get("data_dir") - odoo_bd = config.get("dbfilter") + odoo_bd = config.get("db_name") filename = self.template.store_fname full_path = '{}/filestore/{}/{}'.format(odoo_data_dir, odoo_bd, filename) context = self._generate_context() diff --git a/models/models.py b/models/models.py index 8cf8ac0..cb10295 100644 --- a/models/models.py +++ b/models/models.py @@ -50,7 +50,8 @@ class PartnerContract(models.Model): @api.model def create(self, vals): - vals['name'] = self._calculate_contract_name(datetime.now()) + datetime_now = datetime.now().strftime("%Y-%m-%d") + vals['name'] = self._calculate_contract_name(datetime_now) return super(PartnerContract, self).create(vals) @@ -85,7 +86,12 @@ class ResPartner(models.Model): @api.one @api.depends('street', 'street2', 'city', 'state_id', 'zip', 'country_id') def _compute_full_adress(self): - full_adress = '{}, {}, {}, {} {}'.format(self.zip, self.country_id.name, self.city, self.street, self.street2) + if self.zip: + full_adress = '{}, {}, {}, {} {}'.format(self.zip, self.country_id.name, self.city, self.street, + self.street2) + else: + full_adress = '{}, {}, {} {}'.format(self.country_id.name, self.city, self.street, + self.street2) self.full_adress = full_adress @api.one diff --git a/views/contract_wizard.xml b/views/contract_wizard.xml index cb064f0..1ede508 100644 --- a/views/contract_wizard.xml +++ b/views/contract_wizard.xml @@ -65,6 +65,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/views/templates.xml b/views/templates.xml index 3748896..a89b022 100644 --- a/views/templates.xml +++ b/views/templates.xml @@ -429,6 +429,14 @@ + + + + + + + + Расчетный счет: @@ -440,6 +448,17 @@ + + + Паспорт: + + + Адрес: + + Телефон: + + + @@ -622,7 +641,7 @@ - + ПРОДАВЕЦ @@ -636,19 +655,14 @@ - + - - - - Паспорт: - - Адрес: - - Телефон: - + + + + @@ -663,7 +677,6 @@ - @@ -680,7 +693,7 @@ - +