update app-odoo , app base

This commit is contained in:
ivan deng
2019-10-28 04:38:00 +08:00
parent 54a4d59a6a
commit 27e1306476
9 changed files with 62 additions and 161 deletions

View File

@@ -32,14 +32,14 @@
############################################################################## ##############################################################################
{ {
'name': "Base Pro, 基础增强", 'name': "Partner set customer vendor",
'version': '13.19.10.16', 'version': '13.19.10.28',
'author': 'Sunpop.cn', 'author': 'Sunpop.cn',
'category': 'Base', 'category': 'Base',
'website': 'https://www.sunpop.cn', 'website': 'https://www.sunpop.cn',
'license': 'LGPL-3', 'license': 'LGPL-3',
'sequence': 2, 'sequence': 2,
'price': 0.00, 'price': 18.00,
'currency': 'EUR', 'currency': 'EUR',
'images': ['static/description/banner.png'], 'images': ['static/description/banner.png'],
'depends': [ 'depends': [
@@ -47,12 +47,13 @@
'purchase', 'purchase',
], ],
'summary': """ 'summary': """
Add customer, vendor (supplier) field to partner model and views.
Set and view partner type: customer or vendor.
Odoo App of Sunpop.cn Odoo App of Sunpop.cn
""", """,
'description': """ 'description': """
Support Odoo 1312, 11, Enterprise and Community Edition Support Odoo 13 Enterprise and Community Edition
1. Add customer, supplier field to partner 1. Add customer, vendor field to partner
2.
3. Multi-language Support. 3. Multi-language Support.
4. Multi-Company Support. 4. Multi-Company Support.
5. Support Odoo 1312, 11, Enterprise and Community Edition 5. Support Odoo 1312, 11, Enterprise and Community Edition

View File

@@ -23,6 +23,14 @@ def pre_init_hook(cr):
# cr.execute("") # cr.execute("")
def post_init_hook(cr, registry): def post_init_hook(cr, registry):
try:
#
sql = "UPDATE res_partner SET customer = TRUE WHERE customer_rank >= 1;"
cr.execute(sql)
sql = "UPDATE res_partner SET supplier = TRUE WHERE supplier_rank >= 1"
cr.execute(sql)
except Exception as e:
pass
pass pass
# cr.execute("") # cr.execute("")

View File

@@ -24,7 +24,41 @@ from odoo.tools import pycompat
class Partner(models.Model): class Partner(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'
customer = fields.Boolean(string='Is a Customer', default=True,
def _get_default_customer(self):
search_partner_mode = self.env.context.get('res_partner_search_mode')
is_customer = search_partner_mode == 'customer'
if is_customer and not self.env.context.get('default_customer'):
return is_customer
else:
return None
def _get_default_supplier(self):
search_partner_mode = self.env.context.get('res_partner_search_mode')
is_supplier = search_partner_mode == 'supplier'
if is_supplier and not self.env.context.get('default_supplier'):
return is_supplier
else:
return None
customer = fields.Boolean(string='Is a Customer', default=_get_default_customer, inverse='_set_customer',
help="Check this box if this contact is a customer. It can be selected in sales orders.") help="Check this box if this contact is a customer. It can be selected in sales orders.")
supplier = fields.Boolean(string='Is a Vendor', supplier = fields.Boolean(string='Is a Vendor', default=_get_default_supplier, inverse='_set_supplier',
help="Check this box if this contact is a vendor. It can be selected in purchase orders.") help="Check this box if this contact is a vendor. It can be selected in purchase orders.")
def _set_customer(self):
for rec in self:
if rec.customer:
if rec.customer_rank < 1 or not rec.customer_rank:
rec.customer_rank = 1
else:
rec.customer_rank = 0
def _set_supplier(self):
for rec in self:
if rec.supplier:
if rec.supplier_rank < 1 or not rec.supplier_rank:
rec.supplier_rank = 1
else:
rec.supplier_rank = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@@ -1,10 +1,10 @@
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced" > <div class="oe_row oe_spaced" >
<div class="oe_span12"> <div class="oe_span12">
<h2 class="oe_slogan"> </h2> <h2 class="oe_slogan"> Partner set customer vendor </h2>
<h3 class="oe_slogan"> </h3> <h3 class="oe_slogan"> Set and view partner type: customer or vendor. </h3>
<div class="oe_row"> <div class="oe_row">
<h3>Lastest update: v12.19.04.28</h3> <h3>Lastest update: v13.19.10.28</h3>
<div class="oe_span12"> <div class="oe_span12">
<img class="oe_demo oe_screenshot" style="max-height: 100%;" src="banner.png"> <img class="oe_demo oe_screenshot" style="max-height: 100%;" src="banner.png">
</div> </div>
@@ -14,19 +14,11 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li> <li>
<i class="fa fa-check-square-o text-primary"></i> <i class="fa fa-check-square-o text-primary"></i>
Put key function here. Add customer, vendor field to partner model and views. Like odoo 12.
</li> </li>
<li> <li>
<i class="fa fa-check-square-o text-primary"></i> <i class="fa fa-check-square-o text-primary"></i>
3. Multi-language Support. Set and view partner type: customer or supplier.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
4. Multi-Company Support.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
5. Support Odoo 1312, 11, Enterprise and Community Edition.
</li> </li>
</ul> </ul>
</div> </div>
@@ -38,10 +30,10 @@
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<h1 class="text-danger text-center">So Easy to navigator and search any data.</h1> <h1 class="text-danger text-center">So Easy to set and show customer or vendor.</h1>
<h4 class="oe_slogan"> </h4> <h4 class="oe_slogan"> </h4>
<div class="oe_demo oe_screenshot"> <div class="oe_demo oe_screenshot">
<img src=".jpg"/> <img src="demo1.jpg"/>
</div> </div>
</div> </div>
</section> </section>

View File

@@ -18,12 +18,14 @@
{ {
'name': "App base chinese中国化基本模块增强", 'name': "App base chinese中国化基本模块增强",
'version': '13.19.05.17', 'version': '13.19.10.28',
'author': 'Sunpop.cn', 'author': 'Sunpop.cn',
'category': 'Base', 'category': 'Base',
'website': 'https://www.sunpop.cn', 'website': 'https://www.sunpop.cn',
'license': 'LGPL-3', 'license': 'LGPL-3',
'sequence': 2, 'sequence': 2,
'price': 18.00,
'currency': 'EUR',
'summary': """ 'summary': """
Chinese enhance. Out of the box use in china. Chinese enhance. Out of the box use in china.
Set all chinese default value. Set all chinese default value.
@@ -46,6 +48,7 @@
'pre_init_hook': 'pre_init_hook', 'pre_init_hook': 'pre_init_hook',
'post_init_hook': 'post_init_hook', 'post_init_hook': 'post_init_hook',
'depends': [ 'depends': [
'app_base',
'stock', 'stock',
'l10n_cn' 'l10n_cn'
], ],

View File

@@ -7,7 +7,6 @@
<field name="code">product.category.seq.normal</field> <field name="code">product.category.seq.normal</field>
<field name="prefix">CAT</field> <field name="prefix">CAT</field>
<field name="padding">4</field> <field name="padding">4</field>
<field name="initial">True</field>
</record> </record>
</data> </data>
</odoo> </odoo>

View File

@@ -1,128 +0,0 @@
-
!record {model: 'res.partner', id: base.res_partner_address_3}:
name: Thomas Passot
parent_id: base.res_partner_2
function: Functional Consultant
email: thomas.passot@agrolait.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_4}:
name: Michel Fletcher
parent_id: base.res_partner_2
function: Analyst
email: michel.fletcher@agrolait.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_5}:
name: Chao Wang
parent_id: base.res_partner_3
function: Marketing Manager
email: chao.wang@chinaexport.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_10}:
name: David Simpson
parent_id: base.res_partner_3
function: Senior Consultant
email: david.simpson@epic.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_11}:
name: John M. Brown
parent_id: base.res_partner_3
function: Director
email: john.brown@epic.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_13}:
name: Charlie Bernard
parent_id: base.res_partner_4
function: Senior Associate
email: charlie.bernard@wealthyandsons.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_14}:
name: Jessica Dupont
parent_id: base.res_partner_4
function: Analyst
email: jessica.dupont@wealthyandsons.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_15}:
name: Phillipp Miller
parent_id: base.res_partner_12
function: Creative Director
email: phillipp.miller@mediapole.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_16}:
name: Ayaan Agarwal
parent_id: base.res_partner_12
function: Director
email: ayaan.agarwal@bestdesigners.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_17}:
name: Daniel Jackson
parent_id: base.res_partner_10
function: Managing Partner
email: daniel.jackson@jackson.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_18}:
name: William Thomas
parent_id: base.res_partner_10
function: Senior Consultant
email: william.jackson@jackson.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_22}:
name: Laith Jubair
parent_id: base.res_partner_2
function: Director
email: laith.jubair@axelor.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_24}:
name: Robert Anderson
parent_id: base.res_partner_4
function: System Analyst
email: robert.anderson@chamberworks.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_25}:
name: Jacob Taylor
parent_id: base.res_partner_3
function: Order Clerk
email: jacob.taylor@millennium.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_28}:
name: Benjamin Flores
parent_id: base.res_partner_12
function: Business Executive
email: benjamin.flores@nebula.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_30}:
name: Lucas Jones
parent_id: base.res_partner_18
function: Functional Consultant
email: lucas.jones@thinkbig.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_32}:
name: Robin Smith
parent_id: base.res_partner_4
function: Sales Manager
email: robin.smith@globalsolutions.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_33}:
name: Morgan Rose
parent_id: base.res_partner_4
function: Financial Manager
email: morgan.rose@globalsolutions.example.com
-
!record {model: 'res.partner', id: base.res_partner_address_34}:
name: Kevin Clarke
parent_id: base.res_partner_4
function: Knowledge Manager
email: kevin.clarke@globalsolutions.example.com
-
!record {model: 'res.partner', id: base.res_partner_main1}:
name: Mark Davis
customer: False
parent_id: base.main_partner
function: Chief Executive Officer (CEO)
email: mark.davis@yourcompany.example.com
-
!record {model: 'res.partner', id: base.res_partner_main2}:
name: Roger Scott
customer: False
parent_id: base.main_partner
function: Chief Operations Officer (COO)
email: roger.scott@yourcompany.example.com

View File

@@ -32,14 +32,6 @@
<xpath expr="//field[@name='zip']" position="move"/> <xpath expr="//field[@name='zip']" position="move"/>
</xpath> </xpath>
<!-- res.partner联系人 form --> <!-- res.partner联系人 form -->
<!-- 所有类型联系人默认都不是客户,不是供应商-->
<xpath expr="//field[@name='child_ids']" position="attributes">
<attribute name="context">
{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_city': city, 'default_state_id':
state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_supplier': 0, 'default_customer': 0,
'default_lang': lang,}
</attribute>
</xpath>
<!--联系人,如果是个人类型,不允许其下再有联系人--> <!--联系人,如果是个人类型,不允许其下再有联系人-->
<xpath expr="//notebook/page[1]" position="attributes"> <xpath expr="//notebook/page[1]" position="attributes">
<attribute name="attrs">{'invisible': [('is_company','!=', True)]}</attribute> <attribute name="attrs">{'invisible': [('is_company','!=', True)]}</attribute>