Browse Source

draft partner 1

master
root 3 years ago
parent
commit
7d7db472ab
8 changed files with 1843 additions and 6 deletions
  1. +1
    -0
      __manifest__.py
  2. +1718
    -0
      i18n/fr.po
  3. +2
    -1
      models/__init__.py
  4. +14
    -3
      models/partner.py
  5. +35
    -0
      models/partner_draft.py
  6. +1
    -0
      security/ir.model.access.csv
  7. +12
    -2
      views/partner.xml
  8. +60
    -0
      views/partner_draft.xml

+ 1
- 0
__manifest__.py View File

@ -30,6 +30,7 @@
'views/email.xml',
'views/phone.xml',
'views/partner.xml',
'views/partner_draft.xml',
'views/donation.xml',
'views/relationship.xml',
'views/operation.xml',


+ 1718
- 0
i18n/fr.po
File diff suppressed because it is too large
View File


+ 2
- 1
models/__init__.py View File

@ -13,4 +13,5 @@ from . import returnmail
from . import payment_batch
from . import sale_order
from . import product
from . import aggregate
from . import aggregate
from . import partner_draft

+ 14
- 3
models/partner.py View File

@ -1,5 +1,5 @@
from odoo import models, fields, api
from odoo.exceptions import UserError, ValidationError
from odoo.exceptions import UserError, ValidationError, Warning
from psycopg2 import sql, DatabaseError
from werkzeug import utils
@ -156,18 +156,29 @@ class partner(models.Model):
)
key=fields.Integer(
compute='_compute_key',
#compute='_compute_key',
string="Key",
store=True
#store=True,
readonly=True
)
firstname=fields.Char(string="First name")
npai_count=fields.Integer(String="NPAI count", readonly=True)
source=fields.Char(String="source")
def _compute_key(self):
for rec in self:
rec.key=int(rec.id)*40456
def _compute_all_key(self):
#for rec in self.env:
#rec.write({'key':3})
#raise Warning(rec.id)
for rec in self.env['res.partner'].search([]):
rec.key=2
#raise Warning(len())
@api.onchange('street')
def _onchange_street(self):
for rec in self:


+ 35
- 0
models/partner_draft.py View File

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import UserError, ValidationError
from psycopg2 import sql, DatabaseError
from odoo.tools.safe_eval import safe_eval, datetime
from werkzeug import utils
class opendons_partnerdraft(models.Model):
_name = 'opendons.partnerdraft'
_description = 'import draft partner'
external_id=fields.Integer(string='external id',required=True)
source=fields.Char(String='source file',required=True)
name=fields.Char(string='name',required=True)
firstname=fields.Char(string='firstname')
phone = fields.Char(string='phone')
mobile = fields.Char(string='mobile')
email = fields.Char(string='email')
complement_ident = fields.Char(string='N° appartment,floor')
complement_geo = fields.Char(string='entry,tower,bat')
street = fields.Char(string='street')
street2 = fields.Char(string='street2')
city = fields.Char(string='city')
zip = fields.Char(string='zip code')
country = fields.Char(string='country')

+ 1
- 0
security/ir.model.access.csv View File

@ -24,3 +24,4 @@ access_opendons_payment_batch_qr_code,opendons_payment_batch_qrcode,model_opendo
access_opendons_duplicate_operation_wizard,opendons_duplicate_operation_wizard,model_opendons_operation_duplicate,donation.group_donation_manager,1,1,1,1
access_opendons_aggregate_partner,opendons_aggregate_partner,model_opendons_aggregate_partner,donation.group_donation_manager,1,1,1,1
access_opendons_partnerdraft,opendons_partnerdraft,model_opendons_partnerdraft,donation.group_donation_manager,1,1,1,1

+ 12
- 2
views/partner.xml View File

@ -62,6 +62,12 @@
<field name="domain">[('recurring_template', '!=', False)]</field>
</record>
<record id="partnerdraft_action" model="ir.actions.act_window">
<field name="name">Partners draft</field>
<field name="res_model">opendons.partnerdraft</field>
<field name="view_mode">tree,form</field>
<field name="context"></field>
</record>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">opendons.res.partner.form</field>
@ -77,6 +83,7 @@
<field name="firstname" attrs="{'invisible':[('is_company','=',True)]}"/>
<field name="id"/>
<field name="key"/>
<field name="source"/>
<field name="parent_id" string="Company Name"
@ -95,7 +102,7 @@
<xpath expr="/form/sheet/div/div" position="replace">
</xpath>
<xpath expr="//label[@for='phone']" position="replace"></xpath>
<!-- <xpath expr="//label[@for='phone']" position="replace"></xpath>
<xpath expr="//field[@name='phone']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
@ -106,7 +113,7 @@
<xpath expr="//label[@for='email']" position="replace"></xpath>
<xpath expr="//field[@name='email']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</xpath> -->
<!-- <xpath expr="//page[@name='contact_addresses']" position="replace">
</xpath> -->
@ -181,6 +188,9 @@
<menuitem id="opendons_relationship_title_menu" name ="Relationships"
parent="contacts.menu_contacts" sequence="22"/>
<menuitem id="opendons_partnerdraft_title_menu" action="partnerdraft_action" name ="Partners import"
parent="contacts.menu_contacts" sequence="4"/>
</odoo>

+ 60
- 0
views/partner_draft.xml View File

@ -0,0 +1,60 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="opendons.partner_draft">
<field name="name">opendons_partner_draft list</field>
<field name="model">opendons.partnerdraft</field>
<field name="arch" type="xml">
<tree>
<field name="source"/>
<field name="external_id"/>
<field name="name"/>
<field name="firstname"/>
<field name="phone"/>
<field name="mobile"/>
<field name="email"/>
<field name="complement_ident"/>
<field name="complement_geo"/>
<field name="street"/>
<field name="street2"/>
<field name="city"/>
<field name="zip"/>
<field name="country"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opendons.partnerdraft_form" >
<field name="name">opendons_partnerdraft_form</field>
<field name="model">opendons.partnerdraft</field>
<field name="arch" type="xml">
<form string="Partner draft import">
<header>
<!-- <button name="compute_aggregate" type="object" string="Compute"/> -->
</header>
<sheet>
<group name="main">
<field name="source"/>
<field name="external_id"/>
<field name="name"/>
<field name="firstname"/>
<field name="phone"/>
<field name="mobile"/>
<field name="email"/>
<field name="complement_ident"/>
<field name="complement_geo"/>
<field name="street"/>
<field name="street2"/>
<field name="city"/>
<field name="zip"/>
<field name="country"/>
</group>
</sheet>
</form>
</field>
</record>
</odoo>

Loading…
Cancel
Save