添加功能
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
from datetime import date
|
||||
|
||||
class PropertyTenantInformation(models.Model):
|
||||
_name = 'property.tenant.information'
|
||||
@@ -14,10 +14,6 @@ class PropertyTenantInformation(models.Model):
|
||||
home_phone = fields.Char(string='座机')
|
||||
email = fields.Char(string='电子邮箱')
|
||||
address = fields.Char(string='送达地址')
|
||||
scope_business = fields.Char(string='经营范围')
|
||||
invoicing_type = fields.Selection([('spot', '专票'), ('cape', '普票')], string="开票类型")
|
||||
invoicing_begins = fields.Char(string="开票抬头")
|
||||
tax_number = fields.Char(string="税号")
|
||||
card = fields.Char(string="身份号")
|
||||
industry_id = fields.Many2one('yuthon.industry.setting', string='行业')
|
||||
start_date = fields.Date(string="生效日期")
|
||||
@@ -27,7 +23,12 @@ class PropertyTenantInformation(models.Model):
|
||||
power_attorney_id = fields.Many2one('ir.attachment', string='委托代理书')
|
||||
attorne_card_id = fields.Many2one('ir.attachment', string='委托代理人身份证')
|
||||
bank_ids = fields.One2many('property.bank.line', 'tenant_id', string='银行信息')
|
||||
invoicing_ids = fields.One2many('invoicing.information.line', 'tenant_id', string='开票信息')
|
||||
kingdee_tenant_id = fields.Char(string='金蝶云承租方id')
|
||||
scope_business = fields.Char(string="经营范围", compute='_compute_invoicing_fields',store=True)
|
||||
invoicing_type = fields.Selection([('spot', '专票'), ('cape', '普票')], string="开票类型", compute='_compute_invoicing_fields', store=True)
|
||||
tax_number = fields.Char(string="税号", compute='_compute_invoicing_fields', store=True)
|
||||
invoicing_begins = fields.Char( string="开票抬头", compute='_compute_invoicing_fields', store=True)
|
||||
|
||||
def update_tenant_wizard(self):
|
||||
return {
|
||||
@@ -47,6 +48,27 @@ class PropertyTenantInformation(models.Model):
|
||||
if bank_id.name == False and bank_id.user == False and bank_id.bank == False:
|
||||
bank_id.unlink()
|
||||
|
||||
@api.depends('invoicing_ids', 'invoicing_ids.start_date', 'invoicing_ids.end_date',
|
||||
'invoicing_ids.scope_business', 'invoicing_ids.invoicing_type',
|
||||
'invoicing_ids.tax_number', 'invoicing_ids.invoicing_begins')
|
||||
def _compute_invoicing_fields(self):
|
||||
today = date.today()
|
||||
for record in self:
|
||||
scope_business = invoicing_type = tax_number = invoicing_begins = ""
|
||||
active_lines = record.invoicing_ids.filtered(lambda l: l.start_date and l.start_date <= today and (not l.end_date or l.end_date >= today)
|
||||
)
|
||||
if active_lines:
|
||||
latest_line = active_lines.sorted(key=lambda l: l.start_date, reverse=True)[0]
|
||||
scope_business = latest_line.scope_business or ""
|
||||
invoicing_type = latest_line.invoicing_type or ""
|
||||
tax_number = latest_line.tax_number or ""
|
||||
invoicing_begins = latest_line.invoicing_begins or ""
|
||||
|
||||
record.scope_business = scope_business
|
||||
record.invoicing_type = invoicing_type
|
||||
record.tax_number = tax_number
|
||||
record.invoicing_begins = invoicing_begins
|
||||
|
||||
class PropertyBankLine(models.Model):
|
||||
_name = 'property.bank.line'
|
||||
_description = '银行账户明细'
|
||||
@@ -54,4 +76,17 @@ class PropertyBankLine(models.Model):
|
||||
tenant_id = fields.Many2one('property.tenant.information', string='关联承租方信息')
|
||||
name = fields.Char(string="开户行")
|
||||
user = fields.Char(string="用户")
|
||||
bank = fields.Char(string="银行账号")
|
||||
bank = fields.Char(string="银行账号")
|
||||
|
||||
|
||||
class InvoicingInformationLine(models.Model):
|
||||
_name = 'invoicing.information.line'
|
||||
_description = '开票信息明细'
|
||||
|
||||
tenant_id = fields.Many2one('property.tenant.information', string='关联承租方信息')
|
||||
scope_business = fields.Char(string="经营范围")
|
||||
invoicing_type = fields.Selection([('spot', '专票'), ('cape', '普票')], string="开票类型")
|
||||
invoicing_begins = fields.Char(string="开票抬头")
|
||||
tax_number = fields.Char(string="税号")
|
||||
start_date = fields.Date(string="生效日期")
|
||||
end_date = fields.Date(string="失效日期")
|
||||
@@ -15,7 +15,7 @@ class YuthonTariffSetting(models.Model):
|
||||
_description = '税率配置'
|
||||
|
||||
name = fields.Char(string="名称")
|
||||
ratio = fields.Float(string="比例")
|
||||
ratio = fields.Float(string="比例", digits=(16, 4))
|
||||
|
||||
|
||||
class PropertyAccountSetting(models.Model):
|
||||
|
||||
@@ -101,4 +101,5 @@ access_meter_archives_line, meter.archives.line,model_meter_archives_line,base.g
|
||||
access_meter_water_line, meter.water.line,model_meter_water_line,base.group_user,1,1,1,1
|
||||
access_yuthon_epitope_values, yuthon.epitope.values,model_yuthon_epitope_values,base.group_user,1,1,1,1
|
||||
access_task_push_wizard,task.push.wizard,model_task_push_wizard,base.group_user,1,1,1,1
|
||||
access_utility_meter_wizard,utility.meter.wizard,model_utility_meter_wizard,base.group_user,1,1,1,1
|
||||
access_utility_meter_wizard,utility.meter.wizard,model_utility_meter_wizard,base.group_user,1,1,1,1
|
||||
access_invoicing_information_line,invoicing.information.line,model_invoicing_information_line,base.group_user,1,1,1,1
|
||||
|
@@ -40,11 +40,11 @@
|
||||
<group>
|
||||
<field name="address"/>
|
||||
<field name="entity_type"/>
|
||||
<field name="scope_business"/>
|
||||
<field name="scope_business" invisible="1"/>
|
||||
<field name="card"/>
|
||||
<field name="invoicing_type"/>
|
||||
<field name="invoicing_begins"/>
|
||||
<field name="tax_number"/>
|
||||
<field name="invoicing_type" invisible="1"/>
|
||||
<field name="invoicing_begins" invisible="1"/>
|
||||
<field name="tax_number" invisible="1"/>
|
||||
<field name="kingdee_tenant_id"/>
|
||||
<field name="power_attorney_id" widget="preview_many2one"/>
|
||||
<field name="attorne_card_id" widget="preview_many2one"/>
|
||||
@@ -62,6 +62,19 @@
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="开票信息">
|
||||
<field name="invoicing_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="tenant_id" column_invisible="1"/>
|
||||
<field name="scope_business"/>
|
||||
<field name="invoicing_type"/>
|
||||
<field name="invoicing_begins"/>
|
||||
<field name="tax_number"/>
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user