Merge lp:~julie-w/unifield-server/US-8900 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6109
Proposed branch: lp:~julie-w/unifield-server/US-8900
Merge into: lp:unifield-server
Diff against target: 126 lines (+28/-22)
2 files modified
bin/addons/account/invoice.py (+3/-2)
bin/addons/account/report/invoice_excel_export.py (+25/-20)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-8900
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+408656@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/account/invoice.py'
--- bin/addons/account/invoice.py 2021-04-23 16:43:40 +0000
+++ bin/addons/account/invoice.py 2021-09-15 15:25:35 +0000
@@ -2140,7 +2140,7 @@
2140 def get(self, cr, uid, key, key2, models, meta=False, context=None, res_id_req=False, without_user=True, key2_req=True, view_id=False):2140 def get(self, cr, uid, key, key2, models, meta=False, context=None, res_id_req=False, without_user=True, key2_req=True, view_id=False):
2141 """2141 """
2142 Hides the reports:2142 Hides the reports:
2143 - "Invoice Excel Export" in the menu of other invoices than IVO/IVI2143 - "Invoice Excel Export" in the menu of other invoices than IVO/IVI/STV
2144 - "FO Follow-up Finance" in the menu of other invoices than IVO/STV2144 - "FO Follow-up Finance" in the menu of other invoices than IVO/STV
2145 - "STV/IVO lines follow-up" in the menu of other invoices than IVO/STV (+ renames it depending on the inv. type)2145 - "STV/IVO lines follow-up" in the menu of other invoices than IVO/STV (+ renames it depending on the inv. type)
2146 """2146 """
@@ -2162,7 +2162,8 @@
2162 elif context_stv:2162 elif context_stv:
2163 v[2]['name'] = _('STV lines follow-up')2163 v[2]['name'] = _('STV lines follow-up')
2164 # display2164 # display
2165 if not context.get('is_intermission') and len(v) > 2 and v[2].get('report_name', '') == 'invoice.excel.export':2165 if not context.get('is_intermission') and not context_stv and len(v) > 2 and \
2166 v[2].get('report_name', '') == 'invoice.excel.export':
2166 continue2167 continue
2167 elif not context_ivo and not context_stv and len(v) > 1 and v[1] in ('fo_follow_up_finance', 'invoice_lines_follow_up'):2168 elif not context_ivo and not context_stv and len(v) > 1 and v[1] in ('fo_follow_up_finance', 'invoice_lines_follow_up'):
2168 continue2169 continue
21692170
=== modified file 'bin/addons/account/report/invoice_excel_export.py'
--- bin/addons/account/report/invoice_excel_export.py 2020-04-09 09:06:08 +0000
+++ bin/addons/account/report/invoice_excel_export.py 2021-09-15 15:25:35 +0000
@@ -37,8 +37,10 @@
3737
38 def _get_distribution_lines(self, inv_line):38 def _get_distribution_lines(self, inv_line):
39 """39 """
40 Returns distrib. line data related to the invoice line in parameter, as a list of dicts40 Returns distrib. line data related to the invoice line in parameter, as a list of dicts.
41 Note: it gives a result even for lines without AD: the line subtotal is retrieved in any cases41 Notes:
42 - it gives a result even for lines without AD: the line subtotal is retrieved in any cases
43 - only CC and Dest are retrieved, FP is excluded.
42 """44 """
43 fp_distrib_line_obj = self.pool.get('funding.pool.distribution.line')45 fp_distrib_line_obj = self.pool.get('funding.pool.distribution.line')
44 distrib_lines = []46 distrib_lines = []
@@ -69,18 +71,19 @@
6971
70 def _get_shipment_number(self, inv):72 def _get_shipment_number(self, inv):
71 """73 """
72 Returns the "shipment" or "simple OUT" number having generated the IVO if linked to a supply workflow74 Returns the "shipment" or "simple OUT" number having generated the IVO/STV if linked to a supply workflow
73 Displayed for both the IVO and the IVI.75 Displayed for both the IVO/STV and the IVI.
74 """76 """
75 if self.invoices.get(inv.id, {}).get('shipment', None) is not None:77 if self.invoices.get(inv.id, {}).get('shipment', None) is not None:
76 # process only once per invoice78 # process only once per invoice
77 return self.invoices[inv.id]['shipment']79 return self.invoices[inv.id]['shipment']
78 ship_or_out_ref = ''80 ship_or_out_ref = ''
79 if inv.from_supply and inv.is_intermission:81 if inv.from_supply:
80 if inv.type == 'out_invoice': # IVO82 inv_type = self.pool.get('account.invoice').get_account_invoice_type(self.cr, self.uid, inv.id)
83 if inv_type in ('ivo', 'stv'):
81 if inv.name:84 if inv.name:
82 ship_or_out_ref = inv.name.split()[-1]85 ship_or_out_ref = inv.name.split()[-1]
83 elif inv.type == 'in_invoice': # IVI86 elif inv_type == 'ivi':
84 if inv.picking_id:87 if inv.picking_id:
85 ship_or_out_ref = inv.picking_id.shipment_ref or ''88 ship_or_out_ref = inv.picking_id.shipment_ref or ''
86 self.invoices.setdefault(inv.id, {}).update({'shipment': ship_or_out_ref})89 self.invoices.setdefault(inv.id, {}).update({'shipment': ship_or_out_ref})
@@ -88,20 +91,21 @@
8891
89 def _get_fo_number(self, inv):92 def _get_fo_number(self, inv):
90 """93 """
91 Returns the FO number related to the IVO if any.94 Returns the FO number related to the IVO/STV if any.
92 Displayed for both the IVO and the IVI.95 Displayed for both the IVO/STV and the IVI.
93 """96 """
94 if self.invoices.get(inv.id, {}).get('fo', None) is not None:97 if self.invoices.get(inv.id, {}).get('fo', None) is not None:
95 # process only once per invoice98 # process only once per invoice
96 return self.invoices[inv.id]['fo']99 return self.invoices[inv.id]['fo']
97 fo_number = ''100 fo_number = ''
98 if inv.from_supply and inv.is_intermission:101 if inv.from_supply:
99 if inv.type == 'out_invoice': # IVO102 inv_type = self.pool.get('account.invoice').get_account_invoice_type(self.cr, self.uid, inv.id)
103 if inv_type in ('ivo', 'stv'):
100 if inv.origin:104 if inv.origin:
101 inv_source_doc_split = inv.origin.split(':')105 inv_source_doc_split = inv.origin.split(':')
102 if inv_source_doc_split:106 if inv_source_doc_split:
103 fo_number = inv_source_doc_split[-1]107 fo_number = inv_source_doc_split[-1]
104 elif inv.type == 'in_invoice': # IVI108 elif inv_type == 'ivi':
105 if inv.main_purchase_id:109 if inv.main_purchase_id:
106 fo_number = inv.main_purchase_id.short_partner_ref or ''110 fo_number = inv.main_purchase_id.short_partner_ref or ''
107 self.invoices.setdefault(inv.id, {}).update({'fo': fo_number})111 self.invoices.setdefault(inv.id, {}).update({'fo': fo_number})
@@ -109,25 +113,26 @@
109113
110 def _get_po_number(self, inv_line):114 def _get_po_number(self, inv_line):
111 """115 """
112 Returns the PO number for Intermission Voucher Lines linked to a supply workflow.116 Returns the PO number for the lines linked to a supply workflow.
113 For the IVO: PO to the external partner in order to buy the goods117 For the IVO/STV: PO to the external partner in order to buy the goods
114 For the IVI: PO to the intermission partner which triggered the creation of the FO118 For the IVI: PO to the intermission partner which triggered the creation of the FO
115 """119 """
116 inv = inv_line.invoice_id120 inv = inv_line.invoice_id
117 ivo_from_supply = inv.is_intermission and inv.type == 'out_invoice' and inv.from_supply121 inv_type = self.pool.get('account.invoice').get_account_invoice_type(self.cr, self.uid, inv.id)
118 if not ivo_from_supply and self.invoices.get(inv.id, {}).get('po', None) is not None:122 out_inv_from_supply = inv_type in ('ivo', 'stv') and inv.from_supply
119 # process only once per invoice except for IVO from Supply where the check must be done line by line123 if not out_inv_from_supply and self.invoices.get(inv.id, {}).get('po', None) is not None:
124 # process only once per invoice except for IVO/STV from Supply where the check must be done line by line
120 return self.invoices[inv.id]['po']125 return self.invoices[inv.id]['po']
121 po_number = ''126 po_number = ''
122 po_line_obj = self.pool.get('purchase.order.line')127 po_line_obj = self.pool.get('purchase.order.line')
123 if inv.from_supply and inv.is_intermission:128 if inv.from_supply:
124 if inv.type == 'out_invoice': # IVO129 if inv_type in ('ivo', 'stv'):
125 fo_line = inv_line.sale_order_line_id130 fo_line = inv_line.sale_order_line_id
126 if fo_line and fo_line.type == 'make_to_order': # the line is sourced on a PO131 if fo_line and fo_line.type == 'make_to_order': # the line is sourced on a PO
127 pol_ids = po_line_obj.search(self.cr, self.uid, [('sale_order_line_id', '=', fo_line.id)])132 pol_ids = po_line_obj.search(self.cr, self.uid, [('sale_order_line_id', '=', fo_line.id)])
128 if pol_ids:133 if pol_ids:
129 po_number = po_line_obj.browse(self.cr, self.uid, pol_ids[0], fields_to_fetch=['order_id']).order_id.name134 po_number = po_line_obj.browse(self.cr, self.uid, pol_ids[0], fields_to_fetch=['order_id']).order_id.name
130 elif inv.type == 'in_invoice': # IVI135 elif inv_type == 'ivi':
131 if inv.main_purchase_id:136 if inv.main_purchase_id:
132 po_number = inv.main_purchase_id.name137 po_number = inv.main_purchase_id.name
133 self.invoices.setdefault(inv.id, {}).update({'po': po_number})138 self.invoices.setdefault(inv.id, {}).update({'po': po_number})

Subscribers

People subscribed via source and target branches