nuovo modulo + modifiche a morpheus crm e morpheus contacts
This commit is contained in:
parent
3b082bb3d9
commit
3c887e79d2
@ -20,5 +20,5 @@
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
'auto_install': True,
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -71,6 +71,24 @@ class ResPartner(models.Model):
|
||||
'fornitore.attuale.option',
|
||||
string="Fornitori Attuali dei Clienti"
|
||||
)
|
||||
|
||||
# Campo per identificare se è un agente
|
||||
is_agent = fields.Boolean(
|
||||
string="È un Agente",
|
||||
help="Spunta questa casella se questo contatto è un agente"
|
||||
)
|
||||
|
||||
# Campo Email 2
|
||||
email2 = fields.Char(
|
||||
string="E-mail 2" ,
|
||||
help="Indirizzo email secondario"
|
||||
)
|
||||
|
||||
# Campo Note Logistiche (simile alle note interne)
|
||||
note_logistiche = fields.Html(
|
||||
string="Note Logistiche",
|
||||
help="Note logistiche interne con editor ricco"
|
||||
)
|
||||
|
||||
class ResPartnerSector(models.Model):
|
||||
_name = 'res.partner.sector' # Nome tecnico corretto
|
||||
|
||||
@ -8,6 +8,12 @@
|
||||
<xpath expr="//page[@name='sales_purchases']//field[@name='user_id']" position="after">
|
||||
<field name="agente_id" context="{'default_is_company': False, 'default_company_type': 'person'}" string="Agente"/>
|
||||
<field name="percent_provvigioni"/>
|
||||
<field name="is_agent"/>
|
||||
</xpath>
|
||||
|
||||
<!-- Aggiungere Email 2 sotto il campo email -->
|
||||
<xpath expr="//field[@name='category_id']" position="after">
|
||||
<field name="email2" string="E-mail 2"/>
|
||||
</xpath>
|
||||
|
||||
<!-- Campi extra nella vista principale -->
|
||||
@ -35,6 +41,11 @@
|
||||
<field name="fornitori_attuali_ids" widget="many2many_checkboxes"/>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
<!-- Nuova pagina Note Logistiche -->
|
||||
<page string="Note Logistiche">
|
||||
<field name="note_logistiche" widget="html" placeholder="Inserisci qui le note logistiche..." options="{'collaborative': true, 'resizable': true, 'codeview': true}"/>
|
||||
</page>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
|
||||
@ -14,4 +14,5 @@
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': True,
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -43,7 +43,36 @@ class CrmLead(models.Model):
|
||||
# Questo messaggio potrebbe apparire se la condizione 'invisible' nell'XML non fosse perfetta
|
||||
# o se il metodo fosse chiamato da un'altra parte.
|
||||
raise UserError(_("L'opportunità deve essere nello stadio 'Nuova' per poterla inviare a 'Wishlist verificata'."))
|
||||
|
||||
|
||||
# --- Invio email agli addetti acquisti ---
|
||||
emails = []
|
||||
if self.addetto_acquisti and self.addetto_acquisti.partner_id.email:
|
||||
emails.append(self.addetto_acquisti.partner_id.email)
|
||||
if self.addetto_acquisti_2 and self.addetto_acquisti_2.partner_id.email:
|
||||
emails.append(self.addetto_acquisti_2.partner_id.email)
|
||||
if not emails:
|
||||
return True # Nessun destinatario, esci silenziosamente
|
||||
|
||||
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
opportunity_url = f"{base_url}/web#id={self.id}&model=crm.lead&view_type=form&page=wishlist_cliente"
|
||||
button_html = f'<a href="{opportunity_url}" style="display:inline-block;padding:8px 16px;background:#1976d2;color:#fff;text-decoration:none;border-radius:4px;">Apri wishlist cliente</a>'
|
||||
body_html = f"""
|
||||
Gentile Ufficio acquisti,<br/><br/>
|
||||
è stata verificata la wishlist presente nella seguente opportunità:<br/><br/>
|
||||
<b>Nome cliente:</b> {self.partner_id.name}<br/>
|
||||
<b>Nome opportunità:</b> {self.name}<br/><br/>
|
||||
|
||||
{button_html}
|
||||
"""
|
||||
mail_values = {
|
||||
'subject': f"Wishlist verificata - {self.name}",
|
||||
'body_html': body_html,
|
||||
'email_to': ','.join(emails),
|
||||
'auto_delete': True,
|
||||
'model': 'crm.lead',
|
||||
'res_id': self.id,
|
||||
}
|
||||
self.env['mail.mail'].sudo().create(mail_values).send()
|
||||
return True
|
||||
|
||||
|
||||
@ -75,15 +104,16 @@ class CrmLead(models.Model):
|
||||
self.agente_id = self.partner_id.agente_id
|
||||
self.percent_provvigioni = self.partner_id.percent_provvigioni
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('partner_id'):
|
||||
partner = self.env['res.partner'].browse(vals['partner_id'])
|
||||
if not vals.get('agente_id') and partner.agente_id:
|
||||
vals['agente_id'] = partner.agente_id.id
|
||||
if not vals.get('percent_provvigioni'):
|
||||
vals['percent_provvigioni'] = partner.percent_provvigioni
|
||||
return super(CrmLead, self).create(vals)
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
if vals.get('partner_id'):
|
||||
partner = self.env['res.partner'].browse(vals['partner_id'])
|
||||
if not vals.get('agente_id') and partner.agente_id:
|
||||
vals['agente_id'] = partner.agente_id.id
|
||||
if not vals.get('percent_provvigioni'):
|
||||
vals['percent_provvigioni'] = partner.percent_provvigioni
|
||||
return super(CrmLead, self).create(vals_list)
|
||||
|
||||
|
||||
# Campi per la Richiesta Offerta
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
</field>
|
||||
|
||||
<xpath expr="//sheet/notebook" position="inside">
|
||||
<page string="Wishlist Cliente">
|
||||
<page string="Wishlist Cliente" name="wishlist_cliente">
|
||||
<group string="Completamento">
|
||||
<field name="wishlist_complete_percent" widget="progressbar"/>
|
||||
<button name="action_set_stage_wishlist_verificata"
|
||||
|
||||
3
morpheus_fornitori/__init__.py
Normal file
3
morpheus_fornitori/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
22
morpheus_fornitori/__manifest__.py
Normal file
22
morpheus_fornitori/__manifest__.py
Normal file
@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': "Morpheus Fornitori",
|
||||
'version': '18.0.1.0.0',
|
||||
'summary': "Gestione semplice delle richieste fornitori",
|
||||
'author': "Morpheus",
|
||||
'category': 'Purchases',
|
||||
'license': 'LGPL-3',
|
||||
'depends': ['base', 'mail','sale_management', 'product'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/sequences.xml',
|
||||
'data/supplier_request_stage_data.xml',
|
||||
'views/supplier_request_stage_views.xml',
|
||||
'views/supplier_request_views.xml',
|
||||
'views/menus.xml',
|
||||
'views/menus_prodotti.xml',
|
||||
],
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
}
|
||||
12
morpheus_fornitori/data/sequences.xml
Normal file
12
morpheus_fornitori/data/sequences.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Sequenza per la numerazione automatica delle richieste fornitori -->
|
||||
<record id="sequence_supplier_request" model="ir.sequence">
|
||||
<field name="name">Richieste fornitori</field>
|
||||
<field name="code">supplier.request</field>
|
||||
<field name="prefix">RIF</field>
|
||||
<field name="padding">4</field>
|
||||
<field name="number_next">1</field>
|
||||
<field name="number_increment">1</field>
|
||||
</record>
|
||||
</odoo>
|
||||
77
morpheus_fornitori/data/supplier_request_stage_data.xml
Normal file
77
morpheus_fornitori/data/supplier_request_stage_data.xml
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<!-- Stati di default per le richieste fornitori -->
|
||||
<record id="stage_draft" model="supplier.request.stage">
|
||||
<field name="name">Bozza</field>
|
||||
<field name="sequence">1</field>
|
||||
<field name="color">0</field>
|
||||
<field name="description">Richiesta in fase di preparazione, non ancora inviata.</field>
|
||||
<field name="fold">False</field>
|
||||
<field name="is_closed">False</field>
|
||||
<field name="is_cancelled">False</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_submitted" model="supplier.request.stage">
|
||||
<field name="name">Inviata</field>
|
||||
<field name="sequence">2</field>
|
||||
<field name="color">1</field>
|
||||
<field name="description">Richiesta inviata al fornitore, in attesa di risposta.</field>
|
||||
<field name="fold">False</field>
|
||||
<field name="is_closed">False</field>
|
||||
<field name="is_cancelled">False</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_in_approval" model="supplier.request.stage">
|
||||
<field name="name">In approvazione</field>
|
||||
<field name="sequence">3</field>
|
||||
<field name="color">3</field>
|
||||
<field name="description">Richiesta in fase di approvazione interna.</field>
|
||||
<field name="fold">False</field>
|
||||
<field name="is_closed">False</field>
|
||||
<field name="is_cancelled">False</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_approved" model="supplier.request.stage">
|
||||
<field name="name">Approvata</field>
|
||||
<field name="sequence">4</field>
|
||||
<field name="color">5</field>
|
||||
<field name="description">Richiesta approvata, pronta per l'esecuzione.</field>
|
||||
<field name="fold">False</field>
|
||||
<field name="is_closed">False</field>
|
||||
<field name="is_cancelled">False</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_completed" model="supplier.request.stage">
|
||||
<field name="name">Completata</field>
|
||||
<field name="sequence">5</field>
|
||||
<field name="color">10</field>
|
||||
<field name="description">Richiesta completata con successo.</field>
|
||||
<field name="fold">True</field>
|
||||
<field name="is_closed">True</field>
|
||||
<field name="is_cancelled">False</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_rejected" model="supplier.request.stage">
|
||||
<field name="name">Rifiutata</field>
|
||||
<field name="sequence">6</field>
|
||||
<field name="color">9</field>
|
||||
<field name="description">Richiesta rifiutata dal fornitore o internamente.</field>
|
||||
<field name="fold">True</field>
|
||||
<field name="is_closed">True</field>
|
||||
<field name="is_cancelled">True</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_cancelled" model="supplier.request.stage">
|
||||
<field name="name">Annullata</field>
|
||||
<field name="sequence">7</field>
|
||||
<field name="color">8</field>
|
||||
<field name="description">Richiesta annullata prima del completamento.</field>
|
||||
<field name="fold">True</field>
|
||||
<field name="is_closed">True</field>
|
||||
<field name="is_cancelled">True</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
4
morpheus_fornitori/models/__init__.py
Normal file
4
morpheus_fornitori/models/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import supplier_request_stage
|
||||
from . import supplier_request
|
||||
124
morpheus_fornitori/models/supplier_request.py
Normal file
124
morpheus_fornitori/models/supplier_request.py
Normal file
@ -0,0 +1,124 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class SupplierRequest(models.Model):
|
||||
_name = 'supplier.request'
|
||||
_description = 'Richiesta fornitore'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'create_date desc'
|
||||
|
||||
name = fields.Char(
|
||||
string="Numero richiesta",
|
||||
required=True,
|
||||
copy=False,
|
||||
readonly=True,
|
||||
index=True,
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('supplier.request')
|
||||
)
|
||||
|
||||
# Campo 1: Fornitore (selezionabile dai contatti)
|
||||
partner_id = fields.Many2one(
|
||||
'res.partner',
|
||||
string="Fornitore",
|
||||
required=True,
|
||||
|
||||
help="Seleziona il fornitore dalla lista dei contatti"
|
||||
)
|
||||
|
||||
# Campo 2: Descrizione
|
||||
description = fields.Text(
|
||||
string="Descrizione",
|
||||
required=True,
|
||||
help="Descrivi dettagliatamente la richiesta"
|
||||
)
|
||||
|
||||
# Campo 3: Allegati
|
||||
attachment_ids = fields.Many2many(
|
||||
'ir.attachment',
|
||||
'supplier_request_attachment_rel',
|
||||
'request_id',
|
||||
'attachment_id',
|
||||
string="Allegati"
|
||||
)
|
||||
|
||||
# Stage configurabile (simile al CRM)
|
||||
stage_id = fields.Many2one(
|
||||
'supplier.request.stage',
|
||||
string='Stato',
|
||||
index=True,
|
||||
tracking=True,
|
||||
group_expand='_read_group_stage_ids',
|
||||
ondelete='restrict',
|
||||
default=lambda self: self.env['supplier.request.stage'].search([('sequence', '=', 1)], limit=1),
|
||||
help="Stato attuale della richiesta fornitore"
|
||||
)
|
||||
|
||||
# Campi informativi
|
||||
create_uid = fields.Many2one('res.users', string='Creato da', readonly=True)
|
||||
create_date = fields.Datetime(string='Data Creazione', readonly=True)
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('name', '/') == '/':
|
||||
vals['name'] = self.env['ir.sequence'].next_by_code('supplier.request') or '/'
|
||||
return super(SupplierRequest, self).create(vals)
|
||||
|
||||
@api.model
|
||||
def _read_group_stage_ids(self, stages, domain):
|
||||
"""Read group customization for stage_id field to always show all stages"""
|
||||
# Mostra sempre tutti gli stage attivi
|
||||
search_domain = ['|', ('id', 'in', stages.ids), ('active', '=', True)]
|
||||
stage_ids = stages.sudo()._search(search_domain, order=stages._order)
|
||||
return stages.browse(stage_ids)
|
||||
|
||||
def action_move_to_stage(self, stage_name):
|
||||
"""Metodo generico per spostare a uno stage specifico"""
|
||||
self.ensure_one()
|
||||
stage = self.env['supplier.request.stage'].search([('name', '=', stage_name)], limit=1)
|
||||
if stage:
|
||||
old_stage_name = self.stage_id.name if self.stage_id else 'Nessuno'
|
||||
self.stage_id = stage
|
||||
self.message_post(body=f"Richiesta spostata da '{old_stage_name}' a '{stage_name}'.")
|
||||
else:
|
||||
raise UserError(f"Stage '{stage_name}' non trovato.")
|
||||
|
||||
def action_submit(self):
|
||||
"""Invia la richiesta"""
|
||||
self.action_move_to_stage('Inviata')
|
||||
|
||||
def action_approve(self):
|
||||
"""Approva la richiesta"""
|
||||
self.action_move_to_stage('Approvata')
|
||||
|
||||
def action_reject(self):
|
||||
"""Rifiuta la richiesta"""
|
||||
self.action_move_to_stage('Rifiutata')
|
||||
|
||||
def action_done(self):
|
||||
"""Completa la richiesta"""
|
||||
self.action_move_to_stage('Completata')
|
||||
|
||||
def action_cancel(self):
|
||||
"""Annulla la richiesta"""
|
||||
self.action_move_to_stage('Annullata')
|
||||
|
||||
def action_reset_to_draft(self):
|
||||
"""Ripristina la richiesta in bozza"""
|
||||
self.action_move_to_stage('Bozza')
|
||||
|
||||
# Metodi di utilità per verificare lo stato
|
||||
@api.depends('stage_id')
|
||||
def _compute_is_closed(self):
|
||||
for record in self:
|
||||
record.is_closed = record.stage_id.is_closed if record.stage_id else False
|
||||
|
||||
@api.depends('stage_id')
|
||||
def _compute_is_cancelled(self):
|
||||
for record in self:
|
||||
record.is_cancelled = record.stage_id.is_cancelled if record.stage_id else False
|
||||
|
||||
is_closed = fields.Boolean('È chiusa', compute='_compute_is_closed', store=True)
|
||||
is_cancelled = fields.Boolean('È annullata', compute='_compute_is_cancelled', store=True)
|
||||
41
morpheus_fornitori/models/supplier_request_stage.py
Normal file
41
morpheus_fornitori/models/supplier_request_stage.py
Normal file
@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SupplierRequestStage(models.Model):
|
||||
"""Modello per gli stati delle richieste fornitori.
|
||||
Simile a crm.stage, permette la configurazione dinamica degli stati.
|
||||
"""
|
||||
_name = "supplier.request.stage"
|
||||
_description = "Supplier Request Stages"
|
||||
_rec_name = 'name'
|
||||
_order = "sequence, name, id"
|
||||
|
||||
name = fields.Char('Nome stato', required=True, translate=True)
|
||||
sequence = fields.Integer('Sequenza', default=1, help="Usato per ordinare gli stati. Valori più bassi vengono mostrati prima.")
|
||||
description = fields.Text('Descrizione', help="Descrizione interna dello stato per aiutare gli utenti.")
|
||||
fold = fields.Boolean('Nascosto in kanban',
|
||||
help='Questo stato è nascosto nella vista kanban quando non ci sono record in quello stato.')
|
||||
is_closed = fields.Boolean('Stato chiuso',
|
||||
help='Indica se questo stato rappresenta una richiesta chiusa/completata.')
|
||||
is_cancelled = fields.Boolean('Stato annullato',
|
||||
help='Indica se questo stato rappresenta una richiesta annullata.')
|
||||
|
||||
# Colore per la vista kanban
|
||||
color = fields.Integer('Colore', default=0)
|
||||
|
||||
# Campi per report e analisi
|
||||
active = fields.Boolean('Attivo', default=True)
|
||||
|
||||
def _default_stages(self):
|
||||
"""Crea gli stati di default se non esistono"""
|
||||
return [
|
||||
{'name': 'Bozza', 'sequence': 1, 'color': 0},
|
||||
{'name': 'Inviata', 'sequence': 2, 'color': 1},
|
||||
{'name': 'In approvazione', 'sequence': 3, 'color': 3},
|
||||
{'name': 'Approvata', 'sequence': 4, 'color': 5},
|
||||
{'name': 'Completata', 'sequence': 5, 'color': 10, 'is_closed': True},
|
||||
{'name': 'Rifiutata', 'sequence': 6, 'color': 9, 'is_cancelled': True},
|
||||
{'name': 'Annullata', 'sequence': 7, 'color': 8, 'is_cancelled': True},
|
||||
]
|
||||
5
morpheus_fornitori/security/ir.model.access.csv
Normal file
5
morpheus_fornitori/security/ir.model.access.csv
Normal file
@ -0,0 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_supplier_request_user,Supplier Request User,model_supplier_request,base.group_user,1,1,1,1
|
||||
access_supplier_request_manager,Supplier Request Manager,model_supplier_request,base.group_system,1,1,1,1
|
||||
access_supplier_request_stage_user,Supplier Request Stage User,model_supplier_request_stage,base.group_user,1,0,0,0
|
||||
access_supplier_request_stage_manager,Supplier Request Stage Manager,model_supplier_request_stage,base.group_system,1,1,1,1
|
||||
|
25
morpheus_fornitori/static/description/index.html
Normal file
25
morpheus_fornitori/static/description/index.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Morpheus Fornitori</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Morpheus Fornitori</h1>
|
||||
<p>Modulo semplificato per la gestione delle richieste fornitori.</p>
|
||||
|
||||
<h2>Caratteristiche</h2>
|
||||
<ul>
|
||||
<li>Interfaccia semplice con solo 3 campi principali</li>
|
||||
<li>Selezione fornitore dai contatti esistenti</li>
|
||||
<li>Campo descrizione per dettagli della richiesta</li>
|
||||
<li>Gestione allegati</li>
|
||||
<li>Workflow configurabile con stati personalizzabili</li>
|
||||
<li>Nessuna logica email automatica</li>
|
||||
<li>Nessun riferimento a sedi o amministratori</li>
|
||||
</ul>
|
||||
|
||||
<h2>Utilizzo</h2>
|
||||
<p>Naviga in "Morpheus Fornitori" → "Richieste Fornitori" per creare e gestire le richieste.</p>
|
||||
</body>
|
||||
</html>
|
||||
28
morpheus_fornitori/views/menus.xml
Normal file
28
morpheus_fornitori/views/menus.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Menu principale -->
|
||||
<menuitem id="morpheus_fornitori_main_menu"
|
||||
name="Richieste fornitori"
|
||||
web_icon="morpheus_fornitori,static/description/icon.png"
|
||||
sequence="10"/>
|
||||
|
||||
<!-- Menu Richieste Fornitori -->
|
||||
<menuitem id="supplier_request_menu"
|
||||
name="Richieste"
|
||||
parent="morpheus_fornitori_main_menu"
|
||||
action="supplier_request_action"
|
||||
sequence="10"/>
|
||||
|
||||
<!-- Menu Configurazione -->
|
||||
<menuitem id="morpheus_fornitori_config_menu"
|
||||
name="Configurazione"
|
||||
parent="morpheus_fornitori_main_menu"
|
||||
sequence="100"/>
|
||||
|
||||
<!-- Menu Stati -->
|
||||
<menuitem id="supplier_request_stage_menu"
|
||||
name="Stati richieste"
|
||||
parent="morpheus_fornitori_config_menu"
|
||||
action="supplier_request_stage_action"
|
||||
sequence="10"/>
|
||||
</odoo>
|
||||
9
morpheus_fornitori/views/menus_prodotti.xml
Normal file
9
morpheus_fornitori/views/menus_prodotti.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<menuitem
|
||||
id="morpheus_menu_main_menu"
|
||||
name="Prodotti"
|
||||
sequence="20"
|
||||
action="product.product_template_action_all"
|
||||
/>
|
||||
</odoo>
|
||||
89
morpheus_fornitori/views/supplier_request_stage_views.xml
Normal file
89
morpheus_fornitori/views/supplier_request_stage_views.xml
Normal file
@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Vista Search per Stage -->
|
||||
<record id="supplier_request_stage_search" model="ir.ui.view">
|
||||
<field name="name">supplier.request.stage.search</field>
|
||||
<field name="model">supplier.request.stage</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Ricerca stati">
|
||||
<field name="name"/>
|
||||
<field name="sequence"/>
|
||||
<field name="is_closed"/>
|
||||
<field name="is_cancelled"/>
|
||||
<separator/>
|
||||
<filter string="Attivi" name="active" domain="[('active', '=', True)]"/>
|
||||
<filter string="Stati chiusi" name="closed" domain="[('is_closed', '=', True)]"/>
|
||||
<filter string="Stati annullati" name="cancelled" domain="[('is_cancelled', '=', True)]"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Vista List per Stage -->
|
||||
<record id="supplier_request_stage_tree" model="ir.ui.view">
|
||||
<field name="name">supplier.request.stage.list</field>
|
||||
<field name="model">supplier.request.stage</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Stati richieste fornitori" multi_edit="1" sample="1">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="description"/>
|
||||
<field name="is_closed"/>
|
||||
<field name="is_cancelled"/>
|
||||
<field name="fold"/>
|
||||
<field name="color" widget="color_picker"/>
|
||||
<field name="active"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Vista Form per Stage -->
|
||||
<record id="supplier_request_stage_form" model="ir.ui.view">
|
||||
<field name="name">supplier.request.stage.form</field>
|
||||
<field name="model">supplier.request.stage</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Stato Richiesta Fornitore">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<label for="name"/>
|
||||
<h1>
|
||||
<field name="name" placeholder="es. In approvazione"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="sequence"/>
|
||||
<field name="active"/>
|
||||
<field name="color" widget="color_picker"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_closed"/>
|
||||
<field name="is_cancelled"/>
|
||||
<field name="fold"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Descrizione"/>
|
||||
<field name="description" nolabel="1" placeholder="Descrivi le caratteristiche di questo stato e quando una richiesta dovrebbe trovarsi qui."/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action per Stage -->
|
||||
<record id="supplier_request_stage_action" model="ir.actions.act_window">
|
||||
<field name="name">Stati richieste</field>
|
||||
<field name="res_model">supplier.request.stage</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="view_id" ref="supplier_request_stage_tree"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Configura un nuovo stato per le richieste fornitori
|
||||
</p>
|
||||
<p>
|
||||
Gli stati permettono di organizzare il flusso di lavoro delle richieste fornitori.
|
||||
Puoi creare stati personalizzati, riordinarli e configurare le loro proprietà.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
166
morpheus_fornitori/views/supplier_request_views.xml
Normal file
166
morpheus_fornitori/views/supplier_request_views.xml
Normal file
@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Vista Form per Richieste Fornitori -->
|
||||
<record id="supplier_request_form_view" model="ir.ui.view">
|
||||
<field name="name">supplier.request.form</field>
|
||||
<field name="model">supplier.request</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Richiesta Fornitore">
|
||||
<header>
|
||||
<button name="action_submit" type="object" string="Invia"
|
||||
class="btn-primary" invisible="stage_id.name != 'Bozza'"/>
|
||||
<button name="action_approve" type="object" string="Approva"
|
||||
class="btn-success" invisible="stage_id.name not in ['Inviata', 'In approvazione']"/>
|
||||
<button name="action_reject" type="object" string="Rifiuta"
|
||||
class="btn-warning" invisible="stage_id.is_closed or stage_id.is_cancelled"/>
|
||||
<button name="action_done" type="object" string="Completa"
|
||||
class="btn-success" invisible="stage_id.name != 'Approvata'"/>
|
||||
<button name="action_cancel" type="object" string="Annulla"
|
||||
class="btn-danger" invisible="stage_id.is_closed"/>
|
||||
<button name="action_reset_to_draft" type="object" string="Ripristina in Bozza"
|
||||
class="btn-secondary" invisible="stage_id.name == 'Bozza'"/>
|
||||
<field name="stage_id" widget="statusbar" options="{'clickable': '1'}"
|
||||
statusbar_visible="Bozza,Inviata,Approvata,Completata"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name" readonly="1"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="partner_id" options="{'no_create': True, 'no_edit': True}"
|
||||
context="{'default_is_company': True, 'default_supplier_rank': 1}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="create_uid" readonly="1"/>
|
||||
<field name="create_date" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="description" placeholder="Inserisci una descrizione dettagliata della richiesta..."/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Allegati">
|
||||
<field name="attachment_ids" widget="many2many_binary"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<chatter/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Vista Tree per Richieste Fornitori -->
|
||||
<record id="supplier_request_tree_view" model="ir.ui.view">
|
||||
<field name="name">supplier.request.tree</field>
|
||||
<field name="model">supplier.request</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Richieste fornitori">
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="description"/>
|
||||
<field name="stage_id" decoration-info="stage_id.name == 'Bozza'"
|
||||
decoration-warning="stage_id.name in ['Inviata', 'In Approvazione']"
|
||||
decoration-success="stage_id.name in ['Approvata', 'Completata']"
|
||||
decoration-danger="stage_id.is_cancelled"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="create_date"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Vista Search per Richieste Fornitori -->
|
||||
<record id="supplier_request_search_view" model="ir.ui.view">
|
||||
<field name="name">supplier.request.search</field>
|
||||
<field name="model">supplier.request</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Cerca Richieste Fornitori">
|
||||
<field name="name" string="Numero"/>
|
||||
<field name="partner_id" string="Fornitore"/>
|
||||
<field name="description" string="Descrizione"/>
|
||||
<field name="stage_id" string="Stato"/>
|
||||
<field name="create_uid" string="Creato da"/>
|
||||
<filter string="In corso" name="active" domain="[('stage_id.is_closed', '=', False), ('stage_id.is_cancelled', '=', False)]"/>
|
||||
<filter string="Chiuse" name="closed" domain="[('stage_id.is_closed', '=', True)]"/>
|
||||
<filter string="Annullate" name="cancelled" domain="[('stage_id.is_cancelled', '=', True)]"/>
|
||||
<separator/>
|
||||
<filter string="Le mie richieste" name="my_requests"
|
||||
domain="[('create_uid', '=', uid)]"/>
|
||||
<group expand="0" string="Raggruppa per">
|
||||
<filter string="Stato" name="group_stage"
|
||||
context="{'group_by': 'stage_id'}"/>
|
||||
<filter string="Fornitore" name="group_partner"
|
||||
context="{'group_by': 'partner_id'}"/>
|
||||
<filter string="Creato da" name="group_user"
|
||||
context="{'group_by': 'create_uid'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Vista Kanban per Richieste Fornitori -->
|
||||
<record id="supplier_request_kanban_view" model="ir.ui.view">
|
||||
<field name="name">supplier.request.kanban</field>
|
||||
<field name="model">supplier.request</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban default_group_by="stage_id" class="o_kanban_small_column" quick_create="false">
|
||||
<field name="stage_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="name"/>
|
||||
<field name="description"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="create_date"/>
|
||||
<field name="is_closed"/>
|
||||
<field name="is_cancelled"/>
|
||||
<progressbar field="stage_id" colors='{"Completata": "success", "Rifiutata": "danger", "Annullata": "warning"}'/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_card oe_kanban_global_click">
|
||||
<div class="o_kanban_content">
|
||||
<div class="o_kanban_record_title">
|
||||
<field name="name"/>
|
||||
</div>
|
||||
<div class="o_kanban_record_subtitle">
|
||||
<field name="partner_id"/>
|
||||
</div>
|
||||
<div class="o_kanban_record_body">
|
||||
<field name="description" widget="truncate_text"/>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom">
|
||||
<div class="oe_kanban_bottom_left">
|
||||
<span class="o_kanban_record_date">
|
||||
<field name="create_date" widget="date"/>
|
||||
</span>
|
||||
</div>
|
||||
<div class="oe_kanban_bottom_right">
|
||||
<img t-att-src="kanban_image('res.users', 'avatar_128', record.create_uid.raw_value)"
|
||||
t-att-title="record.create_uid.value" t-att-alt="record.create_uid.value"
|
||||
class="oe_kanban_avatar o_image_24_cover"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Azione per le Richieste Fornitori -->
|
||||
<record id="supplier_request_action" model="ir.actions.act_window">
|
||||
<field name="name">Richieste Fornitori</field>
|
||||
<field name="res_model">supplier.request</field>
|
||||
<field name="view_mode">kanban,list,form</field>
|
||||
<field name="search_view_id" ref="supplier_request_search_view"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Nessuna richiesta fornitore trovata.
|
||||
</p>
|
||||
<p>
|
||||
Crea la tua prima richiesta fornitore cliccando su "Nuovo".
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue
Block a user