Browse Source

[IMP] adding name attribute on div to allow xpath overriding on

certifacte template
pull/1/head
houssine 8 years ago
parent
commit
fd45ae6272
  1. 6
      easy_my_coop/report/cooperator_certificat_G001.xml
  2. 1
      easy_my_coop_taxshelter_report/__init__.py
  3. 2
      easy_my_coop_taxshelter_report/__openerp__.py
  4. 1
      easy_my_coop_taxshelter_report/models/__init__.py
  5. 47
      easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py
  6. 4
      easy_my_coop_taxshelter_report/report/tax_shelter_report.xml
  7. 7
      easy_my_coop_taxshelter_report/security/ir.model.access.csv
  8. 110
      easy_my_coop_taxshelter_report/views/tax_shelter_declaration_view.xml
  9. 2
      easy_my_coop_taxshelter_report/wizard/__init__.py
  10. 29
      easy_my_coop_taxshelter_report/wizard/tax_shelter_certificate_wizard.py
  11. 20
      easy_my_coop_taxshelter_report/wizard/tax_shelter_report_wizard.xml

6
easy_my_coop/report/cooperator_certificat_G001.xml

@ -57,7 +57,7 @@
<div style="width:125px;position:relative;top:10px;border-bottom: 4pt solid #fcc300;"/> <div style="width:125px;position:relative;top:10px;border-bottom: 4pt solid #fcc300;"/>
</h2> </h2>
<div style="position:relative;top:55px;">
<div name="label_coop_number" style="position:relative;top:55px;">
<span t-field="o.name"></span> <span t-field="o.name"></span>
<span> is recorded in the register of cooperators under number </span> <span> is recorded in the register of cooperators under number </span>
<span t-field="o.cooperator_register_number"></span> <span t-field="o.cooperator_register_number"></span>
@ -121,7 +121,7 @@
</tbody> </tbody>
</table> </table>
<div class="row">
<div name="total_table" class="row">
<div class="col-xs-6 pull-right"> <div class="col-xs-6 pull-right">
<table class="table table-condensed easymy-coop-info-title" style="position:relative;top:145px;width:85%"> <table class="table table-condensed easymy-coop-info-title" style="position:relative;top:145px;width:85%">
<tr class="border-top-easymy-coop-cert"> <tr class="border-top-easymy-coop-cert">
@ -141,7 +141,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 pull-left" style="position:relative;top:205px;font-size:20;color:black;font-family:Roboto-Regular;">
<div name="board_commitee" class="col-xs-6 pull-left" style="position:relative;top:205px;font-size:20;color:black;font-family:Roboto-Regular;">
<div style="position:relative;top:205px;"> <div style="position:relative;top:205px;">
Pour le Conseil d'administration de <span t-field="o.company_id.name"/>. Pour le Conseil d'administration de <span t-field="o.company_id.name"/>.
</div> </div>

1
easy_my_coop_taxshelter_report/__init__.py

@ -0,0 +1 @@
from . import models

2
easy_my_coop_taxshelter_report/__openerp__.py

@ -29,7 +29,7 @@
""", """,
'data': [ 'data': [
'report/tax_shelter_report.xml', 'report/tax_shelter_report.xml',
#'wizard/tax_shelter_report_wizard.xml'
'views/tax_shelter_declaration_view.xml'
], ],
'installable': True, 'installable': True,
} }

1
easy_my_coop_taxshelter_report/models/__init__.py

@ -0,0 +1 @@
from . import tax_shelter_declaration

47
easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from openerp import api, fields, models, _
class TaxShelterCertificate(models.Model):
_name="tax.shelter.declaration"
declaration_year = fields.Integer(string='Declaration year', required=True)
tax_shelter_certificates = fields.One2many('tax.shelter.certificate','declaration_id', string='Tax shelter certificates', readonly=True)
date_from = fields.Date(string='Date from', required=True)
date_to = fields.Date(string='Date to', required=True)
tax_shelter_percentage = fields.Selection([('30','30%'),
('45','45%')],
string='Tax Shelter percentage', required=True)
@api.one
def process_declaration(self):
True
class TaxShelterCertificate(models.Model):
_name="tax.shelter.certificate"
partner_id = fields.Many2one('res.partner', string='Cooperator', required=True, readonly=True)
declaration_id = fields.Many2one('tax.shelter.declaration', string='Declaration', required=True, readonly=True)
subscribed_lines = fields.One2many('certificate.line','tax_shelter_certificate', string='Certificate lines', readonly=True)
sell_back_lines = fields.One2many('certificate.line','tax_shelter_certificate', string='Shares resold', readonly=True)
total = fields.Float(string='Total')
class TaxShelterCertificateLine(models.Model):
_name="certificate.line"
tax_shelter_certificate = fields.Many2one('tax.shelter.certificate', string="Tax shelter certificate",required=True)
share_type = fields.Many2one('product.produt', string='Share type', required=True, readonly=True)
share_price = fields.Float(string='Share price', required=True, readonly=True)
quantity = fields.Integer(string='Number of shares', required=True, readonly=True)
transaction_date = fields.Date(string="Transaction date")
certificat_type = fields.Selection([('subscribed','Subscribed'),
('resold','Resold'),
('kept','Kept')], required=True, readonly=True)
total = fields.Float(compute='_compute_total', string='Sub total')
@api.multi
def _compute_total(self):
for line in self:
total = line.share_price * line.quantity

4
easy_my_coop_taxshelter_report/report/tax_shelter_report.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<odoo>
<data noupdate="0"> <data noupdate="0">
<report <report
@ -138,4 +138,4 @@ Cordialement,
</t> </t>
</template> </template>
</data> </data>
</openerp>
</odoo>

7
easy_my_coop_taxshelter_report/security/ir.model.access.csv

@ -0,0 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_tax_shelter_declaration,tax.shelter.declaration,model_tax_shelter_declaration,easy_my_coop.group_energiris_user,1,0,0,0
access_tax_shelter_declaration,tax.shelter.declaration,model_tax_shelter_declaration,easy_my_coop.group_energiris_manager,1,1,1,0
access_tax_shelter_certificate,tax.shelter.certificate,model_tax_shelter_certificate,easy_my_coop.group_energiris_user,1,0,0,0
access_tax_shelter_certificate,tax.shelter.certificate,model_tax_shelter_certificate,easy_my_coop.group_energiris_manager,1,1,1,0
access_certificate_line,certificate.line,model_certificate_line,easy_my_coop.group_energiris_user,1,0,0,0
access_certificate_line,certificate.line,model_certificate_line,easy_my_coop.group_energiris_manager,1,1,1,0

110
easy_my_coop_taxshelter_report/views/tax_shelter_declaration_view.xml

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem name="Declaration" id="menu_easy_my_coop_main_declaration" parent="easy_my_coop.menu_main_easy_my_coop" sequence="10"/>
<record id="tax_shelter_declaration_form" model="ir.ui.view">
<field name="name">tax.shelter.declaration.form</field>
<field name="model">tax.shelter.declaration</field>
<field name="arch" type="xml">
<form string="Tax shelter declaration">
<header>
<button name="compute_declaration" string="Process Declaration" type="object" class="oe_highlight" groups="easy_my_coop.group_energiris_manager"/>
</header>
<sheet>
<group>
<group>
<field name="declaration_year"/>
<field name="tax_shelter_percentage"/>
</group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
</group>
<notebook>
<page string="Tax shelter certificates">
<field name="tax_shelter_certificates">
<tree>
<field name="partner_id"/>
<field name="total"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="tax_shelter_declaration_tree" model="ir.ui.view">
<field name="name">tax.shelter.declaration.tree</field>
<field name="model">tax.shelter.declaration</field>
<field name="arch" type="xml">
<tree string="Tax shelter declaration">
<field name="declaration_year"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="tax_shelter_percentage"/>
</tree>
</field>
</record>
<record id="tax_shelter_declaration_action" model="ir.actions.act_window">
<field name="name">Tax Shelter Declaration</field>
<field name="res_model">tax.shelter.declaration</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="tax_shelter_declaration_tree"/>
</record>
<menuitem action="tax_shelter_declaration_action" name="Tax Shelter Declaration" id="menu_tax_shelter_declaration" parent="menu_easy_my_coop_main_declaration" sequence="10" groups="easy_my_coop.group_energiris_manager"/>
<record id="tax_shelter_certificate_form" model="ir.ui.view">
<field name="name">tax.shelter.certificate.form</field>
<field name="model">tax.shelter.certificate</field>
<field name="arch" type="xml">
<form string="Tax shelter certificate">
<sheet>
<group>
<group>
<field name="partner_id"/>
<field name="declaration_id"/>
</group>
<group>
<field name="total"/>
</group>
</group>
<notebook>
<page string="Subscription">
<field name="subscribed_lines">
<tree>
<field name="transaction_date"/>
<field name="share_type"/>
<field name="quantity"/>
<field name="share_price"/>
<field name="certificat_type"/>
<field name="total"/>
</tree>
</field>
</page>
<page string="Sell back">
<field name="sell_back_lines">
<tree>
<field name="transaction_date"/>
<field name="share_type"/>
<field name="quantity"/>
<field name="share_price"/>
<field name="certificat_type"/>
<field name="total"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</data>
</odoo>

2
easy_my_coop_taxshelter_report/wizard/__init__.py

@ -1 +1 @@
from . import tax_shelter_report_wizard
from . import tax_shelter_certificate_wizard

29
easy_my_coop_taxshelter_report/wizard/tax_shelter_report_wizard.py → easy_my_coop_taxshelter_report/wizard/tax_shelter_certificate_wizard.py

@ -21,29 +21,8 @@
from openerp import api, fields, models, _ from openerp import api, fields, models, _
class TaxShelterReport(models.TransientModel):
_name = 'tax.shelter.report'
class TaxShelterCertificateWizard(models.TransientModel):
_name = 'tax.shelter.certificate.wizard'
name = fields.Char(string='Name')
year = fields.Integer(string='Year', help='Introduce the year for which you want to get the report')
def _print_report(self, data):
return {'type': 'ir.actions.report.xml',
'report_name': data['report'],
'datas': data}
@api.one
def print_report(self):
data = {}
domain = [('cooperator','=','True'),('member','=','True')]
coop = self.env['res.partner'].search(domain, order='cooperator_register_number')
data['model'] = 'res.partner'
data['report'] = 'easy_my_coop_taxshelter_report.taxshelter_report'
data['ids'] = coop.ids
#return self._print_report(data)
return self.env['report'].get_action(coop, 'easy_my_coop_taxshelter_report.tax_shelter_report')
def process_certificates(self):
True

20
easy_my_coop_taxshelter_report/wizard/tax_shelter_report_wizard.xml

@ -1,19 +1,17 @@
<?xml version="1.0" ?> <?xml version="1.0" ?>
<openerp>
<odoo>
<data> <data>
<record id="view_tax_shelter_wizard" model="ir.ui.view"> <record id="view_tax_shelter_wizard" model="ir.ui.view">
<field name="name">tax.shelter.report.wizard.form</field>
<field name="model">tax.shelter.report</field>
<field name="name">tax.shelter.certificate.wizard.form</field>
<field name="model">tax.shelter.certificate.wizard</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Reporting">
<separator string="Tax shelter report"/>
<form string="Tax shelter certificat wizard">
<group> <group>
<field name="year"/> <field name="year"/>
</group> </group>
<footer> <footer>
<button name="print_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
<button name="process_certificates" string="Process" type="object" default_focus="1" class="oe_highlight"/>
or or
<button string="Cancel" class="oe_link" special="cancel" /> <button string="Cancel" class="oe_link" special="cancel" />
</footer> </footer>
@ -24,7 +22,7 @@
<record id="action_tax_shelter_wizard" model="ir.actions.act_window"> <record id="action_tax_shelter_wizard" model="ir.actions.act_window">
<field name="name">Tax shelter report</field> <field name="name">Tax shelter report</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">tax.shelter.report</field>
<field name="res_model">tax.shelter.certificate.wizard</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="view_id" ref="view_tax_shelter_wizard"/> <field name="view_id" ref="view_tax_shelter_wizard"/>
@ -32,7 +30,7 @@
<field name="multi">True</field> <field name="multi">True</field>
</record> </record>
<menuitem id="menu_easy_my_reporting" name="Reporting" parent="easy_my_coop.menu_main_easy_my_coop" sequence="60"/>
<menuitem id="menu_tax_shelter_wizard_report" name="Tax shelter report" parent="menu_easy_my_reporting" action="action_tax_shelter_wizard" sequence="10"/>
<menuitem id="menu_easy_my_declaration" name="Declaration" parent="easy_my_coop.menu_main_easy_my_coop" sequence="60"/>
<menuitem id="menu_tax_shelter_wizard" name="Tax shelter certificates" parent="menu_easy_my_declaration" action="action_tax_shelter_wizard" sequence="10" groups="easy_my_coop.group_energiris_user"/>
</data> </data>
</openerp>
</odoo>
Loading…
Cancel
Save