Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
odoo-dev
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e2f7cd02
authored
Nov 28, 2021
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
penambahan objek pajak lain2
1 parent
9d078ac7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
249 additions
and
42 deletions
pdl_kab/data/res_user.xml
pdl_kab/models/partner.py
pdl_kab/models/product.py
pdl_kab/views/menus.xml
pdl_kab/views/partner.xml
pdl_kab/views/product.xml
pdl_kab/views/product_hotel.xml
pdl_kab/data/res_user.xml
View file @
e2f7cd0
...
...
@@ -31,6 +31,7 @@
<field
name=
"district_id"
ref=
"id_gov.ct_jb_71"
/>
<field
name=
"company_id"
ref=
"pdl_kab.pdl_company_id"
/>
<field
name=
"zip"
>
90241
</field>
<field
name=
"type"
>
wp
</field>
<field
name=
"customer_rank"
>
1
</field>
<field
name=
"phone"
>
+62 812-345-678
</field>
<field
name=
"email"
>
info@company.idexample.com
</field>
...
...
pdl_kab/models/partner.py
View file @
e2f7cd0
...
...
@@ -39,17 +39,41 @@ class ResPartner(models.Model):
domain
=
"[('sub_district_id', '=?', sub_district_id)]"
)
# type = fields.Selection(
# selection_add=[('op', 'Objek Pajak'),
# ('wp', 'Wajib Pajak'),
# ('owner', 'Pemilik'),
# ('operation', 'Pengelola')],
# ondelete={
# 'op': 'cascade',
# 'wp': 'cascade',
# 'owner': 'cascade',
# 'operation': 'cascade'
# })
type
=
fields
.
Selection
(
selection_add
=
[(
'op'
,
'Objek Pajak'
),
(
'wp'
,
'Wajib Pajak'
),
],
ondelete
=
{
'op'
:
'cascade'
,
'wp'
:
'cascade'
,
})
@api.onchange
(
'parent_id'
)
def
onchange_parent_id
(
self
):
# return values in result, as this method is used by _fields_sync()
if
not
self
.
parent_id
:
return
result
=
{}
partner
=
self
.
_origin
if
partner
.
parent_id
and
partner
.
parent_id
!=
self
.
parent_id
and
self
.
type
!=
'op'
:
result
[
'warning'
]
=
{
'title'
:
_
(
'Warning'
),
'message'
:
_
(
'Changing the company of a contact should only be done if it '
'was never correctly set. If an existing contact starts working for a new '
'company then a new contact should be created under that new '
'company. You can use the "Discard" button to abandon this change.'
)
}
if
partner
.
type
==
'contact'
or
self
.
type
==
'contact'
:
# for contacts: copy the parent address, if set (aka, at least one
# value is set in the address: otherwise, keep the one from the
# contact)
address_fields
=
self
.
_address_fields
()
if
any
(
self
.
parent_id
[
key
]
for
key
in
address_fields
):
def
convert
(
value
):
return
value
.
id
if
isinstance
(
value
,
models
.
BaseModel
)
else
value
result
[
'value'
]
=
{
key
:
convert
(
self
.
parent_id
[
key
])
for
key
in
address_fields
}
return
result
# def _get_name_search_order_by_fields(self):
# res = super()._get_name_search_order_by_fields()
...
...
pdl_kab/models/product.py
View file @
e2f7cd0
...
...
@@ -77,11 +77,12 @@ class Product(models.Model):
wp_sub_district_id
=
fields
.
Many2one
(
'res.district.sub'
,
compute
=
'_compute_wp'
,
store
=
False
)
wp_district_id
=
fields
.
Many2one
(
'res.district'
,
compute
=
'_compute_wp'
,
store
=
False
)
wp_state_id
=
fields
.
Many2one
(
'res.country.state'
,
compute
=
'_compute_wp'
,
store
=
False
)
wp_zip
=
fields
.
Char
(
compute
=
'_compute_wp'
)
wp_phone
=
fields
.
Char
(
compute
=
'_compute_wp'
)
wp_email
=
fields
.
Char
(
compute
=
'_compute_wp'
)
wp_website
=
fields
.
Char
(
compute
=
'_compute_wp'
)
wp_zip
=
fields
.
Char
(
compute
=
'_compute_wp'
,
string
=
"ZIP"
)
wp_phone
=
fields
.
Char
(
compute
=
'_compute_wp'
,
string
=
"Phone"
)
wp_email
=
fields
.
Char
(
compute
=
'_compute_wp'
,
string
=
"Email"
)
wp_website
=
fields
.
Char
(
compute
=
'_compute_wp'
,
string
=
"Web Site"
)
rate
=
fields
.
Float
(
related
=
'categ_id.rate'
,
store
=
True
,
readonly
=
False
)
def
_get_wp_address_field_names
(
self
):
return
[
(
"wp_id"
,
"id"
),
...
...
@@ -110,13 +111,26 @@ class Product(models.Model):
for
wp
in
self
.
filtered
(
lambda
product
:
product
.
partner_id
):
if
not
wp
.
partner_id
:
continue
address_data
=
wp
.
partner_id
.
parent_id
.
sudo
()
.
address_get
(
adr_pref
=
[
'
contact
'
])
if
address_data
[
'
contact
'
]:
partner
=
wp
.
partner_id
.
browse
(
address_data
[
'
contact
'
])
.
sudo
()
address_data
=
wp
.
partner_id
.
parent_id
.
sudo
()
.
address_get
(
adr_pref
=
[
'
wp
'
])
if
address_data
[
'
wp
'
]:
partner
=
wp
.
partner_id
.
browse
(
address_data
[
'
wp
'
])
.
sudo
()
wp
.
update
(
wp
.
_get_wp_address_update
(
partner
))
else
:
wp
.
update
(
wp
.
_get_wp_address_update
(
False
))
@api.onchange
(
'wp_id'
)
def
_onchange_wp_id
(
self
):
self
.
wp_street
=
self
.
wp_id
.
street
self
.
wp_street2
=
self
.
wp_id
.
street2
self
.
wp_village_id
=
self
.
wp_id
.
village_id
self
.
wp_sub_district_id
=
self
.
wp_id
.
sub_district_id
self
.
wp_district_id
=
self
.
wp_id
.
district_id
self
.
wp_state_id
=
self
.
wp_id
.
state_id
self
.
wp_zip
=
self
.
wp_id
.
zip
self
.
wp_phone
=
self
.
wp_id
.
phone
self
.
wp_email
=
self
.
wp_id
.
email
self
.
wp_website
=
self
.
wp_id
.
website
def
copy
(
self
,
default
=
None
):
raise
UserError
(
_
(
'Duplicating a company is not allowed. Please create a new company instead.'
))
...
...
@@ -252,7 +266,7 @@ class Product(models.Model):
on product address fields. Fields are labeled same on both models. """
return
[
'street'
,
'street2'
,
'city'
,
'zip'
,
'state_id'
,
'country_id'
,
'district_id'
,
'sub_district_id'
,
'village_id'
,
'phone'
,
'email'
,
'website'
]
'email'
,
'website'
]
@api.onchange
(
'village_id'
)
def
_onchange_village_id
(
self
):
...
...
@@ -300,9 +314,9 @@ class Product(models.Model):
# partner's contact address
def
_compute_address
(
self
):
for
product
in
self
.
filtered
(
lambda
product
:
product
.
partner_id
):
address_data
=
product
.
partner_id
.
sudo
()
.
address_get
(
adr_pref
=
[
'
private
'
])
if
address_data
[
'
private
'
]:
partner
=
product
.
partner_id
.
browse
(
address_data
[
'
private
'
])
.
sudo
()
address_data
=
product
.
partner_id
.
sudo
()
.
address_get
(
adr_pref
=
[
'
op
'
])
if
address_data
[
'
op
'
]:
partner
=
product
.
partner_id
.
browse
(
address_data
[
'
op
'
])
.
sudo
()
product
.
update
(
product
.
_get_product_address_update
(
partner
))
@api.depends
(
'partner_id.image_1920'
)
...
...
@@ -356,14 +370,11 @@ class Product(models.Model):
partner
=
self
.
env
[
'res.partner'
]
.
create
({
'name'
:
vals
[
'name'
],
'is_company'
:
False
,
'type'
:
"
private
"
'type'
:
"
op
"
})
# compute stored fields, for example address dependent fields
partner
.
flush
()
vals
[
'partner_id'
]
=
partner
.
id
_logger
.
info
(
'-----------------'
)
_logger
.
info
(
vals
)
self
.
clear_caches
()
product
=
super
(
Product
,
self
)
.
create
(
vals
)
...
...
@@ -388,7 +399,7 @@ class Product(models.Model):
partner
=
self
.
env
[
'res.partner'
]
.
create
({
'name'
:
values
[
'name'
],
'is_company'
:
False
,
'type'
:
'
private
'
,
'type'
:
'
op
'
,
# 'image_1920': vals.get('logo'),
# 'email': vals.get('email'),
# 'phone': vals.get('phone'),
...
...
pdl_kab/views/menus.xml
View file @
e2f7cd0
...
...
@@ -11,16 +11,54 @@
name=
"Pendataan"
parent=
"pdl_kab_menu_root"
sequence=
"2"
/>
<!--Sub Pendataan-->
<menuitem
id=
"pendataan_hotel_menu"
name=
"Hotel"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_hotel_pdl_kab"
sequence=
"
2
"
/>
sequence=
"
3
"
/>
<menuitem
id=
"pendataan_resto_menu"
name=
"Restaurant"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_resto_pdl_kab"
sequence=
"2"
/>
sequence=
"4"
/>
<menuitem
id=
"pendataan_hiburan_menu"
name=
"Hiburan"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_hiburan_pdl_kab"
sequence=
"5"
/>
<menuitem
id=
"pendataan_ppj_menu"
name=
"PPJ"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_ppj_pdl_kab"
sequence=
"6"
/>
<menuitem
id=
"pendataan_parkir_menu"
name=
"Parkir"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_parkir_pdl_kab"
sequence=
"7"
/>
<menuitem
id=
"pendataan_walet_menu"
name=
"Walet"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_walet_pdl_kab"
sequence=
"8"
/>
<menuitem
id=
"pendataan_walet_menu"
name=
"Minerba"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_galian_pdl_kab"
sequence=
"9"
/>
<menuitem
id=
"pendataan_reklame_menu"
name=
"Reklame"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_reklame_pdl_kab"
sequence=
"10"
/>
<menuitem
id=
"pendataan_abt_menu"
name=
"Air Bawah Tanah"
parent=
"pendataan_pdl_kab_menu"
action=
"action_product_abt_pdl_kab"
sequence=
"10"
/>
<!--Penetapan-->
<!-- <menuitem id="penetapan_pdl_kab_menu"-->
...
...
pdl_kab/views/partner.xml
View file @
e2f7cd0
...
...
@@ -7,8 +7,8 @@
<field
name=
"inherit_id"
ref=
"base.view_res_partner_filter"
/>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//filter[@name='inactive']"
position=
"before"
>
<filter
string=
"Wajib Pajak"
name=
"
customer"
domain=
"[('customer_rank','>', 0
)]"
/>
<filter
string=
"
Vendor Bills"
name=
"supplier"
domain=
"[('supplier_rank','>', 0
)]"
/>
<filter
string=
"Wajib Pajak"
name=
"
wp"
domain=
"[('type','=', 'wp'
)]"
/>
<filter
string=
"
Objek Pajak"
name=
"op"
domain=
"[('type','=', 'op'
)]"
/>
<separator/>
</xpath>
</field>
...
...
@@ -19,10 +19,11 @@
<field
name=
"res_model"
>
res.partner
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"search_view_id"
ref=
"base.view_res_partner_filter"
/>
<field
name=
"domain"
>
[('
customer_rank','>',0
)]
</field>
<field
name=
"domain"
>
[('
type','=','wp'
)]
</field>
<field
name=
"context"
>
{
'res_partner_search_mode': 'customer',
'default_is_company': True,
'default_type': 'wp',
'default_customer_rank': 1}
</field>
<field
name=
"help"
type=
"html"
>
...
...
pdl_kab/views/product.xml
View file @
e2f7cd0
...
...
@@ -8,7 +8,7 @@
<tree
string=
"Objek Pajak"
sample=
"1"
>
<field
name=
"default_code"
string=
"NOPD"
/>
<field
name=
"name"
string=
"Nama Objek"
/>
<!-- <field name="lst_price" string="Min Omset"/>-->
<!-- <field name="lst_price" string="Min Omset"/>-->
<field
name=
"wp_id"
string=
"Wajib Pajak"
/>
<field
name=
"type"
string=
"Jenis"
/>
<field
name=
"company_id"
string=
"Lembaga/Organisasi"
/>
...
...
@@ -20,7 +20,6 @@
<field
name=
"name"
>
op.template.form
</field>
<field
name=
"model"
>
product.template
</field>
<field
name=
"inherit_id"
ref=
"product.product_template_form_view"
/>
<!-- <field name="inherit_id">product.product_template_only_form_view</field>-->
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//div[@name='options']"
position=
"attributes"
>
<attribute
name=
"invisible"
>
1
</attribute>
...
...
@@ -28,12 +27,11 @@
<xpath
expr=
"//div[@name='options']"
position=
"attributes"
>
<attribute
name=
"invisible"
>
1
</attribute>
</xpath>
<!-- <xpath expr="//field[@name='list_price']" position="attributes">-->
<!-- <attribute name="string">Minimum Omzet</attribute>-->
<!-- </xpath>-->
<xpath
expr=
"//field[@name='standard_price']"
position=
"replace"
/>
<xpath
expr=
"//field[@name='list_price']"
position=
"replace"
>
<xpath
expr=
"//field[@name='standard_price']"
position=
"attributes"
>
<attribute
name=
"invisible"
>
1
</attribute>
</xpath>
<xpath
expr=
"//field[@name='list_price']"
position=
"attributes"
>
<attribute
name=
"invisible"
>
1
</attribute>
</xpath>
<xpath
expr=
"//notebook"
position=
"before"
>
...
...
@@ -71,7 +69,9 @@
placeholder=
"e.g. https://opensipkd.com"
/>
</group>
<group>
<field
name=
"wp_id"
string=
"Wajib Pajak"
/>
<field
name=
"wp_id"
string=
"Wajib Pajak"
domain=
"[('type','=', 'wp')]"
options=
'{"no_open": False}'
context=
"{'default_type': 'wp', 'readonly_type':True}"
/>
<label
for=
"street"
string=
"Address"
/>
<div
class=
"o_address_format"
>
<field
name=
"wp_street"
placeholder=
"Street..."
class=
"o_address_street"
...
...
pdl_kab/views/product_hotel.xml
View file @
e2f7cd0
...
...
@@ -32,7 +32,6 @@
</p>
</field>
</record>
<record
id=
"action_product_resto_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak Restoran
</field>
<field
name=
"res_model"
>
product.template
</field>
...
...
@@ -52,6 +51,139 @@
</p>
</field>
</record>
<record
id=
"action_product_hiburan_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak Hiburan
</field>
<field
name=
"res_model"
>
product.template
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"domain"
>
[('type','=','hiburan')]
</field>
<field
name=
"context"
>
{"default_purchase_ok": False,
'search_default_filter_to_sell': 1,
'default_type': 'hiburan'}
</field>
<field
name=
"view_ids"
eval=
"[(5,
0,
0),
(0,
0,
{'view_mode':
'tree',
'view_id':
ref('op_template_tree')}),
(0,
0,
{'view_mode':
'form',
'view_id':
ref('hotel_template_form')}),
(0,
0,
{'view_mode':
'kanban'})]"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Pendataan Objek Pajak Hiburan
</p>
</field>
</record>
<record
id=
"action_product_ppj_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak PPJ
</field>
<field
name=
"res_model"
>
product.template
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"domain"
>
[('type','=','ppj')]
</field>
<field
name=
"context"
>
{"default_purchase_ok": False,
'search_default_filter_to_sell': 1,
'default_type': 'ppj'}
</field>
<field
name=
"view_ids"
eval=
"[(5,
0,
0),
(0,
0,
{'view_mode':
'tree',
'view_id':
ref('op_template_tree')}),
(0,
0,
{'view_mode':
'form',
'view_id':
ref('hotel_template_form')}),
(0,
0,
{'view_mode':
'kanban'})]"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Pendataan Objek Pajak PPJ
</p>
</field>
</record>
<record
id=
"action_product_walet_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak Walet
</field>
<field
name=
"res_model"
>
product.template
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"domain"
>
[('type','=','walet')]
</field>
<field
name=
"context"
>
{"default_purchase_ok": False,
'search_default_filter_to_sell': 1,
'default_type': 'walet'}
</field>
<field
name=
"view_ids"
eval=
"[(5,
0,
0),
(0,
0,
{'view_mode':
'tree',
'view_id':
ref('op_template_tree')}),
(0,
0,
{'view_mode':
'form',
'view_id':
ref('hotel_template_form')}),
(0,
0,
{'view_mode':
'kanban'})]"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Pendataan Objek Pajak Sarang Burung Walet
</p>
</field>
</record>
<record
id=
"action_product_parkir_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak Parkir
</field>
<field
name=
"res_model"
>
product.template
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"domain"
>
[('type','=','parkir')]
</field>
<field
name=
"context"
>
{"default_purchase_ok": False,
'search_default_filter_to_sell': 1,
'default_type': 'parkir'}
</field>
<field
name=
"view_ids"
eval=
"[(5,
0,
0),
(0,
0,
{'view_mode':
'tree',
'view_id':
ref('op_template_tree')}),
(0,
0,
{'view_mode':
'form',
'view_id':
ref('hotel_template_form')}),
(0,
0,
{'view_mode':
'kanban'})]"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Pendataan Objek Pajak Parkir
</p>
</field>
</record>
<record
id=
"action_product_abt_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak ABT
</field>
<field
name=
"res_model"
>
product.template
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"domain"
>
[('type','=','abt')]
</field>
<field
name=
"context"
>
{"default_purchase_ok": False,
'search_default_filter_to_sell': 1,
'default_type': 'abt'}
</field>
<field
name=
"view_ids"
eval=
"[(5,
0,
0),
(0,
0,
{'view_mode':
'tree',
'view_id':
ref('op_template_tree')}),
(0,
0,
{'view_mode':
'form',
'view_id':
ref('hotel_template_form')}),
(0,
0,
{'view_mode':
'kanban'})]"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Pendataan Objek Pajak Air Bawah Tanah
</p>
</field>
</record>
<record
id=
"action_product_reklame_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak Reklame
</field>
<field
name=
"res_model"
>
product.template
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"domain"
>
[('type','=','reklame')]
</field>
<field
name=
"context"
>
{"default_purchase_ok": False,
'search_default_filter_to_sell': 1,
'default_type': 'resto'}
</field>
<field
name=
"view_ids"
eval=
"[(5,
0,
0),
(0,
0,
{'view_mode':
'tree',
'view_id':
ref('op_template_tree')}),
(0,
0,
{'view_mode':
'form',
'view_id':
ref('hotel_template_form')}),
(0,
0,
{'view_mode':
'kanban'})]"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Pendataan Objek Pajak Reklame
</p>
</field>
</record>
<record
id=
"action_product_galian_pdl_kab"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Objek Pajak MINERBA
</field>
<field
name=
"res_model"
>
product.template
</field>
<field
name=
"view_mode"
>
kanban,tree,form
</field>
<field
name=
"domain"
>
[('type','=','galian')]
</field>
<field
name=
"context"
>
{"default_purchase_ok": False,
'search_default_filter_to_sell': 1,
'default_type': 'galian'}
</field>
<field
name=
"view_ids"
eval=
"[(5,
0,
0),
(0,
0,
{'view_mode':
'tree',
'view_id':
ref('op_template_tree')}),
(0,
0,
{'view_mode':
'form',
'view_id':
ref('hotel_template_form')}),
(0,
0,
{'view_mode':
'kanban'})]"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Pendataan Objek Pajak Galian Mineral Bukan Logam
</p>
</field>
</record>
</data>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment