Commit 6c98b47e authored by Actarus's avatar Actarus
Browse files

Added models for Partner, Contact and Site; added default views

parent 09c3fbdc
# -*- coding: utf-8 -*-
from . import models
# -*- coding: utf-8 -*-
{
'name': 'Relations client',
'name': 'Relations clients',
'category': 'Sales',
'application': True,
'depends': [
......@@ -9,5 +9,11 @@
],
'license': 'GPL-3',
'data': [
'security/ir.model.access.csv',
'views/partner_views.xml',
'views/contact_views.xml',
'views/site_views.xml',
'views/customer_relationship_menus.xml',
],
}
# -*- coding: utf-8 -*-
from . import partner, site, contact
# -*- coding: utf-8 -*-
from odoo import models, fields
class Contact(models.Model):
_name = "customer.contact"
_description = "Contact auprès d'une société cliente"
# ======
# Fields
# ======
name = fields.Char(string="Nom", required=True)
partner_id = fields.Many2one("customer.partner", string="Société")
# -*- coding: utf-8 -*-
from odoo import models, fields
class Partner(models.Model):
_name = "customer.partner"
_description = "Société cliente"
# ======
# Fields
# ======
name = fields.Char(string="Nom", required=True)
# Contacts
contact_ids = fields.One2many("customer.contact", "partner_id", string="Contacts")
site_ids = fields.One2many("customer.site", "partner_id", string="Sites")
# -*- coding: utf-8 -*-
from odoo import models, fields
class CustomerSite(models.Model):
_name = "customer.site"
_description = "Site client"
# ======
# Fields
# ======
name = fields.Char(string="Nom", required=True)
partner_id = fields.Many2one("customer.partner", string="Propriétaire")
# Contacts
contact_id = fields.Many2one("customer.contact", string="Contact")
maintenance_contact_id = fields.Many2one("customer.contact", string="Contact de maintenance")
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_customer_partner,access_customer_partner,model_customer_partner,base.group_user,1,1,1,1
access_customer_contact,access_customer_contact,model_customer_contact,base.group_user,1,1,1,1
access_customer_site,access_customer_site,model_customer_site,base.group_user,1,1,1,1
<?xml version="1.0"?>
<odoo>
<record id="customer_contact_action" model="ir.actions.act_window">
<field name="name">Contact</field>
<field name="res_model">customer.contact</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
<?xml version="1.0"?>
<odoo>
<menuitem id="customer_menu_root" name="Relations clients">
<menuitem id="customer_partner_first_level_menu" name="Partenaires">
<menuitem id="customer_partner_menu_action" action="customer_partner_action"/>
<menuitem id="customer_contact_menu_action" action="customer_contact_action"/>
</menuitem>
<menuitem id="customer_site_menu_action" action="customer_site_action"/>
</menuitem>
</odoo>
<?xml version="1.0"?>
<odoo>
<record id="customer_partner_action" model="ir.actions.act_window">
<field name="name">Compte</field>
<field name="res_model">customer.partner</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
<?xml version="1.0"?>
<odoo>
<record id="customer_site_action" model="ir.actions.act_window">
<field name="name">Site client</field>
<field name="res_model">customer.site</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment