Commit 86c89c5a by aa.gusti

penambahan portal buat ppat????

1 parent 3828f9e8
...@@ -25,8 +25,10 @@ Memudahkan dalam mengelola tagihan kepada wajib pajak atau wajib retribusi ...@@ -25,8 +25,10 @@ Memudahkan dalam mengelola tagihan kepada wajib pajak atau wajib retribusi
'views/sales.xml', 'views/sales.xml',
'views/menus.xml', 'views/menus.xml',
'demo/bphtb.sales.csv', 'demo/bphtb.sales.csv',
'views/portal_templates.xml',
'report/sspd_format_template.xml', 'report/sspd_format_template.xml',
], ],
'demo': [ 'demo': [
'demo/bphtb.sales.csv' 'demo/bphtb.sales.csv'
......
...@@ -14,7 +14,6 @@ _logger = logging.getLogger(__name__) ...@@ -14,7 +14,6 @@ _logger = logging.getLogger(__name__)
class BphtbSales(models.Model): class BphtbSales(models.Model):
_name = 'bphtb.sales' _name = 'bphtb.sales'
_description = 'Transaksi BPHTB' _description = 'Transaksi BPHTB'
# code = fields.Char(index=True, string='Code')
_inherit = ['portal.mixin', 'mail.thread', 'mail.activity.mixin', 'sequence.mixin'] _inherit = ['portal.mixin', 'mail.thread', 'mail.activity.mixin', 'sequence.mixin']
name = fields.Char(string='Number', copy=False, compute='_compute_name', readonly=False, store=True, index=True, name = fields.Char(string='Number', copy=False, compute='_compute_name', readonly=False, store=True, index=True,
tracking=True) tracking=True)
...@@ -128,7 +127,7 @@ class BphtbSales(models.Model): ...@@ -128,7 +127,7 @@ class BphtbSales(models.Model):
disc_amount = fields.Float() disc_amount = fields.Float()
payment = fields.Float(readonly=True, payment = fields.Float(readonly=True,
states={'draft': [('readonly', False)]}, ) states={'draft': [('readonly', False)]}, )
owed = fields.Float(compute="_compute_owed") owed = fields.Float(compute="_compute_owed", store=True)
typ = fields.Selection([ typ = fields.Selection([
('sspd', 'SSPD'), ('sspd', 'SSPD'),
('kb', 'SKPD KB'), ('kb', 'SKPD KB'),
...@@ -155,6 +154,8 @@ class BphtbSales(models.Model): ...@@ -155,6 +154,8 @@ class BphtbSales(models.Model):
default=lambda self: self.env.company.id default=lambda self: self.env.company.id
if not self.company_id else False) if not self.company_id else False)
district_id = fields.Many2one('res.district', related='company_id.district_id', store=True) district_id = fields.Many2one('res.district', related='company_id.district_id', store=True)
wp_ids = fields.Many2many('res.partner', readonly=True,
states={'draft': [('readonly', False)]}, )
def _my_check_method(self, cr, uid, ids, context=None): def _my_check_method(self, cr, uid, ids, context=None):
# Your code goes here # Your code goes here
...@@ -515,3 +516,9 @@ class BphtbSales(models.Model): ...@@ -515,3 +516,9 @@ class BphtbSales(models.Model):
# if self.journal_id.refund_sequence and self.move_type in ('out_refund', 'in_refund'): # if self.journal_id.refund_sequence and self.move_type in ('out_refund', 'in_refund'):
# starting_sequence = "R" + starting_sequence # starting_sequence = "R" + starting_sequence
return starting_sequence return starting_sequence
#Portal Area
def _compute_access_url(self):
super(BphtbSales, self)._compute_access_url()
for bphtb in self:
bphtb.access_url = '/my/bphtb/%s' % (bphtb.id)
\ No newline at end of file \ No newline at end of file
...@@ -107,7 +107,6 @@ class SequenceMixin(models.AbstractModel): ...@@ -107,7 +107,6 @@ class SequenceMixin(models.AbstractModel):
(self._sequence_yearly_regex, 'year', ['seq', 'year']), (self._sequence_yearly_regex, 'year', ['seq', 'year']),
(self._sequence_fixed_regex, 'never', ['seq']), (self._sequence_fixed_regex, 'never', ['seq']),
]: ]:
_logger.info(f"{regex}, {ret_val}, {requirements} ")
match = re.match(regex, name or '') match = re.match(regex, name or '')
if match: if match:
groupdict = match.groupdict() groupdict = match.groupdict()
...@@ -207,7 +206,6 @@ class SequenceMixin(models.AbstractModel): ...@@ -207,7 +206,6 @@ class SequenceMixin(models.AbstractModel):
regex = self._sequence_yearly_regex regex = self._sequence_yearly_regex
elif sequence_number_reset == 'month': elif sequence_number_reset == 'month':
regex = self._sequence_monthly_regex regex = self._sequence_monthly_regex
_logger.info(f'{regex} {sequence_number_reset}')
format_values = re.match(regex, previous).groupdict() format_values = re.match(regex, previous).groupdict()
format_values['seq_length'] = len(format_values['seq']) format_values['seq_length'] = len(format_values['seq'])
format_values['year_length'] = len(format_values.get('year', '')) format_values['year_length'] = len(format_values.get('year', ''))
......
...@@ -9,3 +9,4 @@ ...@@ -9,3 +9,4 @@
"access_bphtb_sales_admin","access.bphtb.sales.admin","model_bphtb_sales","base.group_system",1,1,1,1 "access_bphtb_sales_admin","access.bphtb.sales.admin","model_bphtb_sales","base.group_system",1,1,1,1
"access_bphtb_sales_bphtb_admin","access.bphtb.sales.bphtb.admin","model_bphtb_sales","group_bphtb_admin",1,1,1,1 "access_bphtb_sales_bphtb_admin","access.bphtb.sales.bphtb.admin","model_bphtb_sales","group_bphtb_admin",1,1,1,1
"access_bphtb_sales_bphtb_ppat","access.bphtb.sales.bphtb.ppt","model_bphtb_sales","group_bphtb_ppat",1,1,1,0 "access_bphtb_sales_bphtb_ppat","access.bphtb.sales.bphtb.ppt","model_bphtb_sales","group_bphtb_ppat",1,1,1,0
"access_bphtb_sales_portal","access.bphtb.sales.portal","model_bphtb_sales","base.group_portal",1,1,1,0
...@@ -25,6 +25,18 @@ ...@@ -25,6 +25,18 @@
<field name="perm_write" eval="True"/> <field name="perm_write" eval="True"/>
<field name="perm_unlink" eval="False"/> <field name="perm_unlink" eval="False"/>
</record> </record>
<record model="ir.rule" id="bphtb_sales_portal_rule">
<field name="name">bphtb.sales portal</field>
<field name="model_id" ref="model_bphtb_sales"/>
<field name="groups" eval="[4,ref('base.group_portal')]"/>
<field name="domain_force">[('ppat_id', 'child_of', user.commercial_partner_id.id)]</field>
<field name="perm_read" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_write" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
<!-- <record model="ir.rule" id="bphtb_sales_edit_disable">--> <!-- <record model="ir.rule" id="bphtb_sales_edit_disable">-->
<!-- <field name="name">bphtb_sales_edit_disable</field>--> <!-- <field name="name">bphtb_sales_edit_disable</field>-->
......
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
<xpath expr="//field[@name='type']" position="attributes"> <xpath expr="//field[@name='type']" position="attributes">
<attribute name="invisible">True</attribute> <attribute name="invisible">True</attribute>
</xpath> </xpath>
<xpath expr="//field[@name='category_id']" position="replace"/>
<xpath expr="//field[@name='function']" position="replace"/>
<xpath expr="//field[@name='title']" position="replace"/>
<xpath expr="//page[@name='sales_purchases']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field> </field>
</record> </record>
<record id="action_ppat_config_bphtb_kab" model="ir.actions.act_window"> <record id="action_ppat_config_bphtb_kab" model="ir.actions.act_window">
......
from odoo import fields, models, api import base64
import os
from odoo import fields, models, api, tools
ADDRESS_FIELDS = ( ADDRESS_FIELDS = (
'street', 'street2', 'zip', 'city', 'state_id', 'country_id', 'street', 'street2', 'zip', 'city', 'state_id', 'country_id',
...@@ -8,21 +11,17 @@ ADDRESS_FIELDS = ( ...@@ -8,21 +11,17 @@ ADDRESS_FIELDS = (
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'
# company_id = fields.Many2one('res.company', string="Company",
# default=lambda self: self.env.company.id def _get_identity_card(self) -> bytes:
# if not self.company_id else False return base64.b64encode(open(os.path.join(
# ) tools.config['root_path'], 'addons', 'base', 'static', 'img',
# 'avatar.png'), 'rb').read())
# country_id = fields.Many2one('res.country', string="Country",
# default=lambda self: self.env.company.country_id
# if not self.country_id else False
# )
# state_id = fields.Many2one('res.country.state', string="State",
# default=lambda self: self.env.company.state_id
# if not self.state_id else False
# )
#
identity_number = fields.Char(string="Identity Number", size=16) identity_number = fields.Char(string="Identity Number", size=16)
identity_card = fields.Binary(default=_get_identity_card, string="ID Card",
readonly=False)
district_id = fields.Many2one('res.district', string="Kabupaten/Kota", district_id = fields.Many2one('res.district', string="Kabupaten/Kota",
ondelete='restrict', domain="[('state_id', '=?', state_id)]" ondelete='restrict', domain="[('state_id', '=?', state_id)]"
# default=lambda self: self.env.company.district_id # default=lambda self: self.env.company.district_id
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data> <data>
<record id="action_partner_config_id" model="ir.actions.act_window"> <record id="action_partner_config_id" model="ir.actions.act_window">
<field name="name">Partner</field> <field name="name">Partner</field>
<field name="res_model">res.partner</field> <field name="res_model">res.partner</field>
<field name="view_mode">kanban,tree,form</field> <field name="view_mode">kanban,tree,form</field>
<field name="help" type="html"> <field name="help" type="html">
<p class="o_view_nocontent_smiling_face"> <p class="o_view_nocontent_smiling_face">
Partner Partner
</p> </p>
</field> </field>
</record> </record>
<record id="partner_form_id" model="ir.ui.view"> <record id="partner_form_id" model="ir.ui.view">
<field name="name">partner.form.id.inherit</field> <field name="name">partner.form.id.inherit</field>
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="priority">9</field> <field name="priority">9</field>
<field name="inherit_id" ref="base.view_partner_form"/> <field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='type']" position="before"> <xpath expr="//field[@name='type']" position="before">
<field name="identity_number"/> <field name="identity_number"/>
</xpath> </xpath>
<xpath expr="//field[@name='city']" position="attributes"> <xpath expr="//field[@name='city']" position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
</xpath> </xpath>
<xpath expr="//field[@name='state_id']" position="before"> <xpath expr="//field[@name='state_id']" position="before">
<field name="village_id" class="o_address_state" placeholder="Desa/Kel" <field name="village_id" class="o_address_state" placeholder="Desa/Kel"
options="{'no_open': True, 'no_quick_create': True}" options="{'no_open': True, 'no_quick_create': True}"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'sub_district_id': sub_district_id, 'default_sub_district_id': sub_district_id, context="{'sub_district_id': sub_district_id, 'default_sub_district_id': sub_district_id,
'district_id': district_id}" 'district_id': district_id}"
domain="[('sub_district_id', '=?', sub_district_id)]"/> domain="[('sub_district_id', '=?', sub_district_id)]"/>
<field name="sub_district_id" class="o_address_state" placeholder="Kecamatan" <field name="sub_district_id" class="o_address_state" placeholder="Kecamatan"
options="{'no_open': True, 'no_quick_create': True}" options="{'no_open': True, 'no_quick_create': True}"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'district_id': district_id, 'default_district_id': district_id, context="{'district_id': district_id, 'default_district_id': district_id,
'state_id':state_id}" 'state_id':state_id}"
domain="[('district_id', '=?', district_id)]"/> domain="[('district_id', '=?', district_id)]"/>
<field name="district_id" class="o_address_state" placeholder="Kab/Kota" <field name="district_id" class="o_address_state" placeholder="Kab/Kota"
options="{'no_open': True, 'no_quick_create': True}" options="{'no_open': True, 'no_quick_create': True}"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'state_id': state_id, 'default_state_id': state_id}" context="{'state_id': state_id, 'default_state_id': state_id}"
domain="[('state_id', '=?', state_id)]"/> domain="[('state_id', '=?', state_id)]"/>
</xpath> </xpath>
</field> <xpath expr="//field[@name='category_id']" position="after">
</record> <field name="identity_card" widget="image"
</data> nolabel="0" options="{'image_preview': 'image_128'}"/>
</odoo> </xpath>
<xpath expr="//field[@name='child_ids']//form//field[@name='city']" position="replace"/>
<xpath expr="//field[@name='child_ids']//form//field[@name='state_id']" position="before">
<field name="village_id" class="o_address_street" placeholder="Desa/Kel"
options="{'no_open': True, 'no_create': True}"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'sub_district_id': sub_district_id, 'default_sub_district_id': sub_district_id,
'district_id': district_id}"
domain="[('sub_district_id', '=?', sub_district_id)]"/>
<field name="sub_district_id" class="o_address_street" placeholder="Kecamatan"
options="{'no_open': True, 'no_create': True}"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'district_id': district_id, 'default_district_id': district_id,
'state_id':state_id}"
domain="[('district_id', '=?', district_id)]"/>
<field name="district_id" class="o_address_street" placeholder="Kab/Kota"
options="{'no_open': True, 'no_quick_create': True}"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'state_id': state_id, 'default_state_id': state_id}"
domain="[('state_id', '=?', state_id)]"/>
</xpath>
<xpath expr="//field[@name='child_ids']//form//field[@name='mobile']" position="after">
<field name="identity_card" widget="image"
nolabel="0" options="{'image_preview': 'image_128'}"/>
</xpath>
</field>
</record>
</data>
</odoo>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!