Skip to content

Commit

Permalink
FJG: merge awesomefoodcoops/9.0 cd42c279612a7d1b94be9a932d5a1676404e18d6
Browse files Browse the repository at this point in the history
  (missing dependcies)
  • Loading branch information
fjg committed Jan 28, 2021
1 parent 02644b4 commit 313281f
Show file tree
Hide file tree
Showing 173 changed files with 10,803 additions and 1,384 deletions.
24 changes: 14 additions & 10 deletions account_asset_management_xlsx/report/report_account_asset_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def generate_xlsx_report(self, workbook, data, objects):
'date',
'value',
'salvage_value',
'value_residual',
'method',
'method_number',
'prorata',
'amo_ant',
'amo_de_lan',
'cum_amo',
'val_nette',
'value_residual'
]
self.info_labels = {
'name': {'str': u"Nom de l'immobilisation"},
Expand All @@ -57,11 +57,6 @@ def generate_xlsx_report(self, workbook, data, objects):
'type': 'formula',
'format': self.format_table_number
},
'value_residual': {
'str': u'Valeur rés.',
'type': 'formula',
'format': self.format_table_number
},
'method': {'str': u'Méthode'},
'method_number': {'str': 'Nb. amort.'},
'prorata': {'str': 'Prorata'},
Expand All @@ -70,13 +65,18 @@ def generate_xlsx_report(self, workbook, data, objects):
'type': 'formula',
'format': self.format_table_number
},
'amo_de_lan': {
'str': u"Amortissement de l'année",
'type': 'formula',
'format': self.format_table_number
},
'cum_amo': {
'str': 'Cum. amo.',
'type': 'formula',
'format': self.format_table_number
},
'val_nette': {
'str': 'Val. nette',
'value_residual': {
'str': u'Val. résiduelle',
'type': 'formula',
'format': self.format_table_number
},
Expand All @@ -87,6 +87,7 @@ def generate_xlsx_report(self, workbook, data, objects):
'value_residual': [],
'salvage_value': [],
'amo_ant': [],
'amo_de_lan': [],
'cum_amo': [],
'val_nette': [],
}
Expand Down Expand Up @@ -196,6 +197,7 @@ def generate_report_category(self, category_datas):
'value_residual': '=SUM({}:{})',
'salvage_value': '=SUM({}:{})',
'amo_ant': '=SUM({}:{})',
'amo_de_lan': '=SUM({}:{})',
'cum_amo': '=SUM({}:{})',
'val_nette': '=SUM({}:{})',
}
Expand Down Expand Up @@ -247,6 +249,7 @@ def generate_report_summary(self):
'value_residual': '=SUM({})',
'salvage_value': '=SUM({})',
'amo_ant': '=SUM({})',
'amo_de_lan': '=SUM({})',
'cum_amo': '=SUM({})',
'val_nette': '=SUM({})',
}
Expand Down Expand Up @@ -368,7 +371,8 @@ def _define_formats(self, workbook):
})
self.format_table_date = workbook.add_format(format_table_date)

self.format_table_header_dark_grey = workbook.add_format(format_table_header)
self.format_table_header_dark_grey = workbook.add_format(
format_table_header)
self.format_table_header_dark_grey.set_bg_color('#808080')
self.format_table_header_dark_grey.set_font_color('#000000')

Expand Down
22 changes: 10 additions & 12 deletions account_asset_management_xlsx/report/report_account_asset_xlsx.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<openerp>
<data>
<report
id="report_account_asset_xlsx"
model="account.asset.xlsx.wizard"
name="report_account_asset_xlsx"
file="report_account_asset_xlsx"
report_type="xlsx"
string="Account Asset Report"
/>
</data>
</openerp>
<odoo>
<report
id="report_account_asset_xlsx"
model="account.asset.xlsx.wizard"
name="report_account_asset_xlsx"
file="report_account_asset_xlsx"
report_type="xlsx"
string="Account Asset Report"
/>
</odoo>
26 changes: 12 additions & 14 deletions account_asset_management_xlsx/wizard/account_asset_xlsx_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ class AccountAssetXlsxWizard(models.TransientModel):
default='all'
)

@api.onchange('to_date')
def onchange_to_date(self):
if self.to_date:
self.from_date = self.to_date[:5] + '01-01'
else:
self.from_date = False

@api.multi
def export_report(self):
self.ensure_one()
Expand Down Expand Up @@ -65,7 +72,6 @@ def get_category_datas(self):
'date',
'value',
'salvage_value',
'value_residual',
'method',
'method_number',
'prorata'
Expand Down Expand Up @@ -110,7 +116,7 @@ def get_category_datas(self):
new_value = asset_method_dict.get(value, value)

if new_value:
line_data[column] = new_value
line_data[column] = new_value

if line_data and asset_category:
account_amount_values = \
Expand Down Expand Up @@ -164,12 +170,6 @@ def get_account_amount_values(self, asset=False):
('date', "<=", self.to_date),
] + aml_period_domain, fields=read_fields)

aml_before_date_end = self.env['account.move.line'].search_read([
('move_id.asset_id', '=', asset.id),
('account_id.user_type_id', '=', fixed_asset_account_type.id),
('date', "<=", self.to_date),
] + state_domain, fields=read_fields)

amount_before_date_start = sum(
[(l['credit'] - l['debit']) for l in aml_before_date_start]
)
Expand All @@ -178,13 +178,11 @@ def get_account_amount_values(self, asset=False):
[(l['credit'] - l['debit']) for l in aml_in_range]
)

amount_before_date_end = sum(
[(l['credit'] - l['debit']) for l in aml_before_date_end]
)

cum_amo = amount_in_range + amount_before_date_start
account_amount_values.update({
'amo_ant': amount_before_date_start * sign,
'cum_amo': amount_in_range * sign,
'val_nette': amount_before_date_end,
'amo_de_lan': amount_in_range * sign,
'cum_amo': cum_amo * sign,
'value_residual': asset.value - cum_amo,
})
return account_amount_values
76 changes: 37 additions & 39 deletions account_asset_management_xlsx/wizard/account_asset_xlsx_wizard.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>

<openerp>
<data>
<record id="view_account_asset_xlsx_wizard" model="ir.ui.view">
<field name="name">view.account.asset.xlsx.wizard</field>
<field name="model">account.asset.xlsx.wizard</field>
<field name="arch" type="xml">
<form string="Account Asset Xlsx Wizard">
<group col="4">
<field name="from_date" />
<field name="to_date" />
<field name="asset_state" />
<field name="target_move" widget="radio"/>
</group>
<group>
<field name="asset_category_ids" options="{'no_create_edit': True, 'no_quick_create': True}"/>
</group>
<footer>
<button name="export_report" string="Export" type="object" class="btn btn-primary"/>
<button special="cancel" string="Cancel" class="btn btn-danger"/>
</footer>
</form>
</field>
</record>
<odoo>
<record id="view_account_asset_xlsx_wizard" model="ir.ui.view">
<field name="name">view.account.asset.xlsx.wizard</field>
<field name="model">account.asset.xlsx.wizard</field>
<field name="arch" type="xml">
<form string="Account Asset Xlsx Wizard">
<group col="4">
<field name="from_date" invisible="1"/>
<field name="to_date" />
<field name="asset_state" />
<field name="target_move" widget="radio"/>
</group>
<group>
<field name="asset_category_ids" options="{'no_create_edit': True, 'no_quick_create': True}"/>
</group>
<footer>
<button name="export_report" string="Export" type="object" class="btn btn-primary"/>
<button special="cancel" string="Cancel" class="btn btn-danger"/>
</footer>
</form>
</field>
</record>

<record id="action_account_asset_xlsx_wizard" model="ir.actions.act_window">
<field name="name">Export Account Asset Report</field>
<field name="res_model">account.asset.xlsx.wizard</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="view_account_asset_xlsx_wizard"/>
</record>
<record id="action_account_asset_xlsx_wizard" model="ir.actions.act_window">
<field name="name">Export Account Asset Report</field>
<field name="res_model">account.asset.xlsx.wizard</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="view_account_asset_xlsx_wizard"/>
</record>

<menuitem
id="open_account_asset_xlsx_wizard"
action="action_account_asset_xlsx_wizard"
name="Asset Report Xlsx"
parent="account.account_reports_management_menu"
sequence="100"
/>
</data>
</openerp>
<menuitem
id="open_account_asset_xlsx_wizard"
action="action_account_asset_xlsx_wizard"
name="Asset Report Xlsx"
parent="account.account_reports_management_menu"
sequence="100"
/>
</odoo>
2 changes: 1 addition & 1 deletion account_reconcile_pos_payments/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{
'name': 'Bank auto reconcille',
'version': '9.0.1',
'version': '9.0.2.0.0',
'category': 'Custom',
'author': 'La Louve',
'license': 'AGPL-3',
Expand Down
Loading

0 comments on commit 313281f

Please sign in to comment.