mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 09:12:07 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -5,23 +5,23 @@ from odoo import api, fields, models, _
|
|||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class Opportunity2Quotation(models.TransientModel):
|
||||
class CrmQuotationPartner(models.TransientModel):
|
||||
_name = 'crm.quotation.partner'
|
||||
_description = 'Create new or use existing Customer on new Quotation'
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
result = super(Opportunity2Quotation, self).default_get(fields)
|
||||
result = super().default_get(fields)
|
||||
|
||||
active_model = self._context.get('active_model')
|
||||
active_model = self.env.context.get('active_model')
|
||||
if active_model != 'crm.lead':
|
||||
raise UserError(_('You can only apply this action from a lead.'))
|
||||
|
||||
lead = False
|
||||
if result.get('lead_id'):
|
||||
lead = self.env['crm.lead'].browse(result['lead_id'])
|
||||
elif 'lead_id' in fields and self._context.get('active_id'):
|
||||
lead = self.env['crm.lead'].browse(self._context['active_id'])
|
||||
elif 'lead_id' in fields and self.env.context.get('active_id'):
|
||||
lead = self.env['crm.lead'].browse(self.env.context['active_id'])
|
||||
if lead:
|
||||
result['lead_id'] = lead.id
|
||||
partner_id = result.get('partner_id') or lead._find_matching_partner().id
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@
|
|||
<field name="lead_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('action','!=','exist')], 'required':[('action', '=','exist')]}">
|
||||
<group invisible="action != 'exist'" required="action == 'exist'">
|
||||
<group>
|
||||
<field name="partner_id" attrs="{'invisible': [('action','!=','exist')], 'required':[('action', '=','exist')]}"
|
||||
<field name="partner_id" invisible="action != 'exist'" required="action == 'exist'"
|
||||
context="{'res_partner_search_mode': 'customer'}" />
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_apply" string="Confirm" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
<button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="z"/>
|
||||
<button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="x"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
<record id="crm_quotation_partner_action" model="ir.actions.act_window">
|
||||
<field name="name">New Quotation</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">crm.quotation.partner</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_quotation_partner_view_form"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue