Skip to content

Commit 1335d74

Browse files
committed
[IMP] excise_management: weekly excise report automation and configuration
- Capture transfer external IDs from transfer form and expose transfer IDs in invoice form. - Add new model to manage weekly Excise Reports. - Implement scheduled action running every Sunday to: - Create a new Excise Report for the past week. - Set report date range, label, and computation status (in progress). - Create a To-Do activity: "Excise Report <year>W<week>" assigned to the designated reporter, due +1 week. - Keep existing "Excises" report view, but: - Remove default grouping by week (keep only by fiscal deposit move). - Remove "Excise Amount" measure from default display, keep only quantity visible. - Add new menu item "Excise Reports" listing all Excise Report records.
1 parent efadecc commit 1335d74

File tree

12 files changed

+522
-5
lines changed

12 files changed

+522
-5
lines changed

beverage_distributor/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'name': 'Beverage Distributor',
3-
'version': '2.0',
3+
'version': '2.1',
44
'category': 'Supply Chain',
55
'depends': [
66
'base_automation',

excise_management/__manifest__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@
66
'depends': [
77
'account_tax_python',
88
'base_automation',
9+
'sale_management',
910
'stock',
1011
'web_studio',
1112
],
1213
'data': [
1314
'data/ir_model.xml',
1415
'data/ir_model_fields.xml',
16+
'data/ir_actions_server.xml',
1517
'data/ir_ui_view.xml',
18+
'data/qweb_view.xml',
1619
'data/ir_actions_act_window.xml',
1720
'data/account_tax_group.xml',
18-
'data/ir_actions_server.xml',
1921
'data/ir_ui_menu.xml',
2022
'data/base_automation.xml',
2123
'data/ir_model_access.xml',
@@ -27,4 +29,5 @@
2729
],
2830
'license': 'OPL-1',
2931
'images': ['images/main.png'],
32+
'cloc_exclude': ['data/qweb_view.xml']
3033
}

excise_management/data/ir_actions_act_window.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@
1616
(0, 0, {'view_mode': 'list', 'view_id': ref('stock_move_view_list')}),
1717
]"/>
1818
</record>
19+
<record id="excise_report_act_window" model="ir.actions.act_window">
20+
<field name="name">Excise Report</field>
21+
<field name="res_model">x_excise_report</field>
22+
<field name="view_mode">list,form</field>
23+
</record>
1924
</odoo>

excise_management/data/ir_actions_server.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,22 @@ for fp in records:
4040
<field name="state">code</field>
4141
<field name="name">Add/Remove excise tax on Fiscal Position</field>
4242
</record>
43+
<record id="cron_generate_excise_report" model="ir.cron">
44+
<field name="name">Generate Excise Report</field>
45+
<field name="model_id" ref="excise_report"/>
46+
<field name="state">code</field>
47+
<field name="interval_number">1</field>
48+
<field name="interval_type">weeks</field>
49+
<field name="nextcall" eval="(datetime.now() + timedelta(days=(6 - datetime.now().weekday()) % 7)).strftime('%Y-%m-%d %H:%M:%S')" />
50+
<field name="code"><![CDATA[
51+
res_id = env['x_excise_report'].create({'x_from_date': datetime.date.today() - datetime.timedelta(days=7), 'x_state': 'progress', 'x_user_id': env.company.x_reporter_id.id})
52+
env['mail.activity'].create({'activity_type_id': env.ref('mail.mail_activity_data_todo').id, 'summary': f"Excise Report {res_id.x_name}",'res_model_id': env.ref('excise_management.excise_report').id, 'res_id': res_id.id, 'user_id': env.company.x_reporter_id.id, 'date_deadline': datetime.date.today() + datetime.timedelta(weeks=1)})
53+
]]></field>
54+
</record>
55+
<record id="update_excise_report_to_done" model="ir.actions.server">
56+
<field name="name">Update excise report to done</field>
57+
<field name="model_id" ref="excise_report"/>
58+
<field name="state">code</field>
59+
<field name="code"><![CDATA[record['x_state'] = 'done']]></field>
60+
</record>
4361
</odoo>

excise_management/data/ir_default.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@
1212
<field name="field_id" ref="fiscal_position_is_fiscal_deposit"/>
1313
<field name="json_value">true</field>
1414
</record>
15+
<record id="default_res_config_reporter" model="ir.default">
16+
<field name="field_id" ref="res_config_reporter"/>
17+
<field name="json_value" eval="ref('base.user_admin')"/>
18+
</record>
1519
</odoo>

excise_management/data/ir_model.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,14 @@
44
<field name="model">x_excise_category</field>
55
<field name="name">Excise Category</field>
66
</record>
7+
<record id="excise_report" model="ir.model">
8+
<field name="model">x_excise_report</field>
9+
<field name="name">Excise Report</field>
10+
<field name="is_mail_thread" eval="True"/>
11+
<field name="is_mail_activity" eval="True"/>
12+
</record>
13+
<record id="excise_report_line" model="ir.model">
14+
<field name="model">x_excise_report_line</field>
15+
<field name="name">Excise Report Line</field>
16+
</record>
717
</odoo>

excise_management/data/ir_model_access.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,38 @@
1717
<field name="perm_read" eval="True"/>
1818
<field name="perm_write" eval="True"/>
1919
</record>
20+
<record id="excise_report_group_system" model="ir.model.access">
21+
<field name="group_id" ref="base.group_system"/>
22+
<field name="model_id" ref="excise_report"/>
23+
<field name="name">Excise report group_system</field>
24+
<field name="perm_create" eval="True"/>
25+
<field name="perm_read" eval="True"/>
26+
<field name="perm_unlink" eval="True"/>
27+
<field name="perm_write" eval="True"/>
28+
</record>
29+
<record id="excise_report_group_user" model="ir.model.access">
30+
<field name="group_id" ref="base.group_user"/>
31+
<field name="model_id" ref="excise_report"/>
32+
<field name="name">Excise report group_user</field>
33+
<field name="perm_create" eval="True"/>
34+
<field name="perm_read" eval="True"/>
35+
<field name="perm_write" eval="True"/>
36+
</record>
37+
<record id="excise_report_line_group_system" model="ir.model.access">
38+
<field name="group_id" ref="base.group_system"/>
39+
<field name="model_id" ref="excise_report_line"/>
40+
<field name="name">Excise report line group_system</field>
41+
<field name="perm_create" eval="True"/>
42+
<field name="perm_read" eval="True"/>
43+
<field name="perm_unlink" eval="True"/>
44+
<field name="perm_write" eval="True"/>
45+
</record>
46+
<record id="excise_report_line_group_user" model="ir.model.access">
47+
<field name="group_id" ref="base.group_user"/>
48+
<field name="model_id" ref="excise_report_line"/>
49+
<field name="name">Excise report line group_user</field>
50+
<field name="perm_create" eval="True"/>
51+
<field name="perm_read" eval="True"/>
52+
<field name="perm_write" eval="True"/>
53+
</record>
2054
</odoo>

0 commit comments

Comments
 (0)