Set version 4.1.1 and improve report_intrastat
bzr revid: ced-917a001bf6b67501733196182fce03d517ffeca0
This commit is contained in:
parent
3ca866031b
commit
4dfe331590
|
@ -40,11 +40,20 @@ class res_country(osv.osv):
|
|||
}
|
||||
res_country()
|
||||
|
||||
class report_intrastat_code(osv.osv):
|
||||
_name = "report.intrastat.code"
|
||||
_description = "Intrastat code"
|
||||
_columns = {
|
||||
'name': fields.char('Intrastat Code', size=16),
|
||||
'description': fields.char('Description', size=64),
|
||||
}
|
||||
report_intrastat_code()
|
||||
|
||||
class product_template(osv.osv):
|
||||
_name = "product.template"
|
||||
_inherit = "product.template"
|
||||
_columns = {
|
||||
'intrastat': fields.char('Intrastat code', size=16),
|
||||
'intrastat_id': fields.many2one('report.intrastat.code', 'Intrastat code'),
|
||||
}
|
||||
product_template()
|
||||
|
||||
|
@ -55,7 +64,7 @@ class report_intrastat(osv.osv):
|
|||
_columns = {
|
||||
'name': fields.date('Month', readonly=True),
|
||||
'code': fields.char('Country code', size="2", readonly=True),
|
||||
'intrastat': fields.char('Intratstat number', size=16, readonly=True),
|
||||
'intrastat_id': fields.many2one('report.intrastat.code', 'Intrastat code', readonly=True),
|
||||
'weight': fields.float('Weight', readonly=True),
|
||||
'value': fields.float('Value', readonly=True),
|
||||
'type': fields.selection([('import', 'Import'), ('export', 'Export')], 'Type')
|
||||
|
@ -66,7 +75,7 @@ class report_intrastat(osv.osv):
|
|||
select
|
||||
substring(m.create_date for 7)||'-01' as name,
|
||||
min(m.id) as id,
|
||||
pt.intrastat as intrastat,
|
||||
pt.intrastat_id as intrastat_id,
|
||||
case when l.usage in ('supplier', 'customer') then pc.code else c.code end as code,
|
||||
sum(case when pol.price_unit is not null
|
||||
then pol.price_unit * m.product_qty
|
||||
|
@ -100,7 +109,7 @@ class report_intrastat(osv.osv):
|
|||
and ((l.usage in ('supplier', 'customer') and dl.usage not in ('supplier', 'customer'))
|
||||
or (dl.usage in ('supplier', 'customer') and l.usage not in ('supplier', 'customer')))
|
||||
and (c.intrastat is not null or pc.intrastat is not null)
|
||||
group by substring(m.create_date for 7), pt.intrastat, c.code, pc.code, l.usage, dl.usage
|
||||
group by substring(m.create_date for 7), pt.intrastat_id, c.code, pc.code, l.usage, dl.usage
|
||||
)""")
|
||||
report_intrastat()
|
||||
|
||||
|
|
|
@ -24,17 +24,52 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Product -->
|
||||
<record model="ir.ui.view" id="product_normal_form_view">
|
||||
<field name="name">product.normal.form</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_manager" position="after">
|
||||
<field name="intrastat"/>
|
||||
<field name="intrastat_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Intrastat code -->
|
||||
<record model="ir.ui.view" id="view_report_intrastat_code_tree">
|
||||
<field name="name">report.intrastat.code.tree</field>
|
||||
<field name="model">report.intrastat.code</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat code">
|
||||
<field name="name"/>
|
||||
<field name="description"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_report_intrastat_code_form">
|
||||
<field name="name">report.intrastat.code.form</field>
|
||||
<field name="model">report.intrastat.code</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat code">
|
||||
<field name="name" select="1"/>
|
||||
<field name="description" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_report_intrastat_code_tree">
|
||||
<field name="name">report.intrastat.code</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">report.intrastat.code</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Products/Configuration/Intrastat code" action="action_report_intrastat_code_tree" id="menu_report_intrastat_code"/>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_report_intrastat_tree">
|
||||
<field name="name">report.intrastat.view</field>
|
||||
<field name="model">report.intrastat</field>
|
||||
|
@ -43,7 +78,7 @@
|
|||
<tree string="Intrastat Data">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="intrastat"/>
|
||||
<field name="intrastat_id"/>
|
||||
<field name="weight"/>
|
||||
<field name="value"/>
|
||||
<field name="type"/>
|
||||
|
|
Loading…
Reference in New Issue