[IMP]l10n_cn: add fapiao number to account.move
Add fapiao number to account.move, only show it when the company is located in China. Task 2180269 PR #45743 Related: odoo/upgrade#813 Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
# Copyright (C) 2007-2014 Jeff Wang(<http://jeff@osbzr.com>).
|
||||
|
||||
from . import models
|
||||
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ State Data/省份数据
|
||||
'data/l10n_cn_chart_post_data.xml',
|
||||
'data/account_tax_template_data.xml',
|
||||
'data/account_chart_template_data.xml',
|
||||
'views/account_move_view.xml'
|
||||
],
|
||||
'post_init_hook': 'load_translations',
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import account_move
|
||||
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
fapiao = fields.Char(string='Fapiao Number', size=8, copy=False, tracking=True)
|
||||
|
||||
@api.constrains('fapiao')
|
||||
def _check_fapiao(self):
|
||||
for record in self:
|
||||
if not record.fapiao.isdecimal():
|
||||
raise ValidationError(_("Fapiao number is an 8-digit number. Please enter a correct one."))
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="account_move_form_l10n_cn" model="ir.ui.view">
|
||||
<field name="name">l10n_cn.account.move.form</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='ref']" position="after">
|
||||
<field name="country_code" invisible='1'/>
|
||||
<field name="move_type" invisible='1'/>
|
||||
<field name="fapiao" attrs="{'invisible': ['|', ('country_code','!=', 'CN'),
|
||||
('move_type', 'not in', ['out_invoice', 'out_refund', 'in_invoice', 'in_refund'])]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user