Add view for RO-fields

This commit is contained in:
Alexander Shitov 2018-11-09 14:18:23 +05:00
parent bf2d439810
commit 5c6e7c12eb
3 changed files with 136 additions and 62 deletions

60
.idea/workspace.xml generated
View File

@ -2,10 +2,8 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f04ec5ee-004e-4a46-8928-714efbc22225" name="Default" comment=""> <list default="true" id="f04ec5ee-004e-4a46-8928-714efbc22225" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/models/contract_wizard.py" afterPath="$PROJECT_DIR$/models/contract_wizard.py" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/models/contract_wizard.py" afterPath="$PROJECT_DIR$/models/contract_wizard.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/models/models.py" afterPath="$PROJECT_DIR$/models/models.py" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/views/contract_wizard.xml" afterPath="$PROJECT_DIR$/views/contract_wizard.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/views/templates.xml" afterPath="$PROJECT_DIR$/views/templates.xml" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@ -31,18 +29,18 @@
<file leaf-file-name="contract_wizard.xml" pinned="false" current-in-tab="false"> <file leaf-file-name="contract_wizard.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/views/contract_wizard.xml"> <entry file="file://$PROJECT_DIR$/views/contract_wizard.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1095"> <state relative-caret-position="725">
<caret line="73" column="25" lean-forward="false" selection-start-line="73" selection-start-column="25" selection-end-line="73" selection-end-column="25" /> <caret line="78" column="70" lean-forward="false" selection-start-line="78" selection-start-column="70" selection-end-line="78" selection-end-column="70" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="contract_wizard.py" pinned="false" current-in-tab="false"> <file leaf-file-name="contract_wizard.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/models/contract_wizard.py"> <entry file="file://$PROJECT_DIR$/models/contract_wizard.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315"> <state relative-caret-position="635">
<caret line="84" column="58" lean-forward="false" selection-start-line="84" selection-start-column="58" selection-end-line="84" selection-end-column="58" /> <caret line="308" column="44" lean-forward="false" selection-start-line="308" selection-start-column="44" selection-end-line="308" selection-end-column="44" />
<folding> <folding>
<element signature="e#25#36#0" expanded="true" /> <element signature="e#25#36#0" expanded="true" />
</folding> </folding>
@ -60,7 +58,7 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="templates.xml" pinned="false" current-in-tab="true"> <file leaf-file-name="templates.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/views/templates.xml"> <entry file="file://$PROJECT_DIR$/views/templates.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="531"> <state relative-caret-position="531">
@ -169,15 +167,15 @@
<option value="$PROJECT_DIR$/__init__.py" /> <option value="$PROJECT_DIR$/__init__.py" />
<option value="$PROJECT_DIR$/controllers/__init__.py" /> <option value="$PROJECT_DIR$/controllers/__init__.py" />
<option value="$PROJECT_DIR$/controllers/controllers.py" /> <option value="$PROJECT_DIR$/controllers/controllers.py" />
<option value="$PROJECT_DIR$/views/contract_wizard.xml" />
<option value="$PROJECT_DIR$/__manifest__.py" /> <option value="$PROJECT_DIR$/__manifest__.py" />
<option value="$PROJECT_DIR$/models/contract_wizard.py" />
<option value="$PROJECT_DIR$/models/models.py" /> <option value="$PROJECT_DIR$/models/models.py" />
<option value="$PROJECT_DIR$/views/templates.xml" /> <option value="$PROJECT_DIR$/views/templates.xml" />
<option value="$PROJECT_DIR$/views/contract_wizard.xml" />
<option value="$PROJECT_DIR$/models/contract_wizard.py" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="7"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="6" /> <option name="x" value="6" />
<option name="y" value="55" /> <option name="y" value="55" />
<option name="width" value="1914" /> <option name="width" value="1914" />
@ -274,7 +272,7 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-1" y="0" width="1922" height="1048" extended-state="7" /> <frame x="-1" y="0" width="1922" height="1048" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.27908218" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.27908218" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
@ -695,14 +693,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/views/contract_wizard.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1095">
<caret line="73" column="25" lean-forward="false" selection-start-line="73" selection-start-column="25" selection-end-line="73" selection-end-column="25" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/controllers/controllers.py"> <entry file="file://$PROJECT_DIR$/controllers/controllers.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210"> <state relative-caret-position="210">
@ -721,16 +711,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/models/contract_wizard.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="84" column="58" lean-forward="false" selection-start-line="84" selection-start-column="58" selection-end-line="84" selection-end-column="58" />
<folding>
<element signature="e#25#36#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/views/templates.xml"> <entry file="file://$PROJECT_DIR$/views/templates.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="531"> <state relative-caret-position="531">
@ -785,5 +765,23 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/views/contract_wizard.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="725">
<caret line="78" column="70" lean-forward="false" selection-start-line="78" selection-start-column="70" selection-end-line="78" selection-end-column="70" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/models/contract_wizard.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="635">
<caret line="308" column="44" lean-forward="false" selection-start-line="308" selection-start-column="44" selection-end-line="308" selection-end-column="44" />
<folding>
<element signature="e#25#36#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component> </component>
</project> </project>

View File

@ -236,42 +236,77 @@ class ContractWizard(models.TransientModel):
def _compute_context_payment_term_word(self): def _compute_context_payment_term_word(self):
self._context_payment_term_word = numeral.in_words(self.payment_terms) self._context_payment_term_word = numeral.in_words(self.payment_terms)
_context_name = fields.Char(compute='_compute_context_name', readonly=True) _context_name = fields.Char(string='Contract number', compute='_compute_context_name', readonly=True)
_context_date = fields.Char(compute='_compute_context_date', readonly=True) _context_date = fields.Char(string='Contract date', compute='_compute_context_date', readonly=True)
_context_partner_contract_name = fields.Char(compute='_compute_context_partner_contract_name', 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_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) compute='_compute_context_partner_representer_contract_name', readonly=True)
_context_partner_inn = fields.Char(compute='_compute_context_partner_inn', readonly=True) _context_partner_inn = fields.Char(string='Partner inn', compute='_compute_context_partner_inn', readonly=True)
_context_partner_kpp = fields.Char(compute='_compute_context_partner_kpp', readonly=True) _context_partner_kpp = fields.Char(string='Partner kpp', compute='_compute_context_partner_kpp', readonly=True)
_context_partner_rs = fields.Char(compute='_compute_context_partner_rs', readonly=True) _context_partner_rs = fields.Char(string='Partner corresponding account',
_context_partner_bik = fields.Char(compute='_compute_context_partner_bik', readonly=True) compute='_compute_context_partner_rs',
_context_partner_bank = fields.Char(compute='_compute_context_partner_bank', readonly=True) readonly=True)
_context_partner_phone = fields.Char(compute='_compute_context_partner_phone', readonly=True) _context_partner_bik = fields.Char(string='Partner bank bik',
_context_partner_representer_name = fields.Char(compute='_compute_context_partner_representer_name', readonly=True) compute='_compute_context_partner_bik',
_context_seller_contract_name = fields.Char(compute='_compute_context_seller_contract_name', readonly=True) readonly=True)
_context_seller_adress = fields.Char(compute='_compute_context_seller_adress', readonly=True) _context_partner_bank = fields.Char(string='Partner bank name',
_context_seller_representer_contract_job_name = fields.Char( 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) 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) readonly=True)
_context_seller_inn = fields.Char(compute='_compute_context_seller_inn', readonly=True) _context_seller_inn = fields.Char(string='Seller inn', compute='_compute_context_seller_inn', readonly=True)
_context_seller_kpp = fields.Char(compute='_compute_context_seller_kpp', readonly=True) _context_seller_kpp = fields.Char(string='Seller kpp', compute='_compute_context_seller_kpp', readonly=True)
_context_seller_rs = fields.Char(compute='_compute_context_seller_rs', readonly=True) _context_seller_rs = fields.Char(string='Seller corresponding account',
_context_seller_bik = fields.Char(compute='_compute_context_seller_bik', readonly=True) compute='_compute_context_seller_rs',
_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',
readonly=True) readonly=True)
_context_seller_representer_name = fields.Char(compute='_compute_context_seller_representer_name', readonly=True) _context_seller_bik = fields.Char(string='Seller bank bik', compute='_compute_context_seller_bik', readonly=True)
_context_summ_rub = fields.Char(compute='_compute_context_summ_rub', readonly=True) _context_seller_bank = fields.Char(string='Seller bank name', compute='_compute_context_seller_bank', readonly=True)
_context_summ_rub_word = fields.Char(compute='_compute_context_summ_rub_word', readonly=True) _context_seller_phone = fields.Char(string='Seller phone', compute='_compute_context_seller_phone', readonly=True)
_context_summ_kop = fields.Char(compute='_compute_context_summ_kop', readonly=True) _context_seller_representer_job_name = fields.Char(string='Seller representer job name',
_context_summ_word = fields.Char(compute='_compute_context_summ_word', readonly=True) compute='_compute_context_seller_representer_job_name',
_context_delivery_term = fields.Char(compute='_compute_context_delivery_term', readonly=True) readonly=True)
_context_delivery_term_word = fields.Char(compute='_compute_context_delivery_term_word', readonly=True) _context_seller_representer_name = fields.Char(string='Seller representer name',
_context_payment_term = fields.Char(compute='_compute_context_payment_term', readonly=True) compute='_compute_context_seller_representer_name', readonly=True)
_context_payment_term_word = fields.Char(compute='_compute_context_payment_term_word', 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') @api.onchange('partner_id')
def _set_order_domain(self): def _set_order_domain(self):
@ -326,6 +361,7 @@ class ContractWizard(models.TransientModel):
'partner_rs': self.partner_id.bank_account.acc_number, 'partner_rs': self.partner_id.bank_account.acc_number,
'partner_bik': self.partner_id.bank_account.bank_id.bic, 'partner_bik': self.partner_id.bank_account.bank_id.bic,
'partner_bank': self.partner_id.bank_account.bank_id.name, '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_phone': self.partner_id.phone,
'partner_representer_name': self.partner_id.representative_id.name, 'partner_representer_name': self.partner_id.representative_id.name,
'seller_contract_name': self.company_id.contract_name, 'seller_contract_name': self.company_id.contract_name,

View File

@ -65,6 +65,46 @@
<field name="description"/> <field name="description"/>
</tree> </tree>
</field> </field>
<group string="Contract values">
<group string="Contract">
<field name="_context_name"/>
<field name="_context_date"/>
<field name="_context_summ_rub"/>
<field name="_context_summ_rub_word"/>
<field name="_context_summ_kop"/>
<field name="_context_summ_word"/>
<field name="_context_delivery_term"/>
<field name="_context_delivery_term_word"/>
<field name="_context_payment_term"/>
<field name="_context_payment_term_word"/>
</group>
<group string="Company values">
<field name="_context_seller_contract_name"/>
<field name="_context_seller_adress"/>
<field name="_context_seller_representer_contract_job_name"/>
<field name="_context_seller_representer_contract_name"/>
<field name="_context_seller_inn"/>
<field name="_context_seller_kpp"/>
<field name="_context_seller_rs"/>
<field name="_context_seller_bik"/>
<field name="_context_seller_bank"/>
<field name="_context_seller_phone"/>
<field name="_context_seller_representer_job_name"/>
<field name="_context_seller_representer_name"/>
</group>
<group string="Partner values">
<field name="_context_partner_contract_name"/>
<field name="_context_partner_adress"/>
<field name="_context_partner_representer_contract_name"/>
<field name="_context_partner_inn"/>
<field name="_context_partner_kpp"/>
<field name="_context_partner_rs"/>
<field name="_context_partner_bik"/>
<field name="_context_partner_bank"/>
<field name="_context_partner_phone"/>
<field name="_context_partner_representer_name"/>
</group>
</group>
</group> </group>
<button string="Form DOCX from template" type="object" name="get_docx_contract" /> <button string="Form DOCX from template" type="object" name="get_docx_contract" />
<button string="Form contract with company" type="action" name="%(contract_company_template)d" /> <button string="Form contract with company" type="action" name="%(contract_company_template)d" />