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

Proposed by jftempo
Status: Merged
Merged at revision: 4972
Proposed branch: lp:~julie-w/unifield-server/US-4778
Merge into: lp:unifield-server
Diff against target: 52 lines (+11/-8)
2 files modified
bin/addons/register_accounting/purchase.py (+7/-7)
bin/addons/register_accounting/wizard/down_payment.py (+4/-1)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-4778
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+349121@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/register_accounting/purchase.py'
--- bin/addons/register_accounting/purchase.py 2017-11-27 15:38:38 +0000
+++ bin/addons/register_accounting/purchase.py 2018-07-09 08:35:51 +0000
@@ -52,13 +52,13 @@
5252
53 To be 100% invoiced, a PO should have some linked invoiced that are validated ('open' state or 'paid' state) and that sum of amount is greater or equal to PO total amount. So to find PO that are not 100% invoiced, you should find those from which all invoice are not created or which amount is inferior to PO total amount.53 To be 100% invoiced, a PO should have some linked invoiced that are validated ('open' state or 'paid' state) and that sum of amount is greater or equal to PO total amount. So to find PO that are not 100% invoiced, you should find those from which all invoice are not created or which amount is inferior to PO total amount.
5454
55 BKLG-51: new filters55 BKLG-51 / US-3782: new filters
56 1) On PO state: only allow "confirmed" or "confirmed (waiting)" POs to be selected in the wizard56 1) On PO LINE state: only allow PO having at least one line in Confirmed State, or Closed State if the related
57 (keeping 'done' for not completly invoiced)57 invoice is still in Draft state or Cancelled
58 2) On PO type: only allow regular, purchase list and direct purchase order PO types58 2) On PO type: only allow regular and "purchase list" purchase order types
59 3) Make sure that RFQs or tenders can not be linked to down payments59 3) Make sure that RFQs or tenders can not be linked to down payments
60 1) state 'confirm_waiting' + 'approved' + 'done' (done tolerated if partially invoiced)60 1) line state 'confirmed' + 'done' (done tolerated if invoice still in Draft state)
61 2) order_type 'regular', 'purchase_list', 'direct'61 2) order_type 'regular', 'purchase_list'
62 3) rfq_ok != True62 3) rfq_ok != True
6363
64 US-1064: new rule: as soon as all goods are received on a PO (state 'done') no new Down Payment is possible64 US-1064: new rule: as soon as all goods are received on a PO (state 'done') no new Down Payment is possible
@@ -81,7 +81,7 @@
81 where pir.invoice_id = inv.id AND inv.state not in ('draft', 'cancel') 81 where pir.invoice_id = inv.id AND inv.state not in ('draft', 'cancel')
82 group by pir.purchase_id) inv on inv.purchase_id = po.id 82 group by pir.purchase_id) inv on inv.purchase_id = po.id
83 LEFT JOIN product_pricelist as prod ON (po.pricelist_id = prod.id AND prod.currency_id = %s) 83 LEFT JOIN product_pricelist as prod ON (po.pricelist_id = prod.id AND prod.currency_id = %s)
84 LEFT JOIN (select pol1.order_id, sum(pol1.price_unit * pol1.product_qty) as total 84 INNER JOIN (select pol1.order_id, sum(pol1.price_unit * pol1.product_qty) as total
85 from purchase_order_line pol1 85 from purchase_order_line pol1
86 where pol1.state in ('confirmed', 'done') group by pol1.order_id) pol on pol.order_id=po.id 86 where pol1.state in ('confirmed', 'done') group by pol1.order_id) pol on pol.order_id=po.id
87 WHERE po.pricelist_id = prod.id 87 WHERE po.pricelist_id = prod.id
8888
=== modified file 'bin/addons/register_accounting/wizard/down_payment.py'
--- bin/addons/register_accounting/wizard/down_payment.py 2017-11-27 15:38:38 +0000
+++ bin/addons/register_accounting/wizard/down_payment.py 2018-07-09 08:35:51 +0000
@@ -86,11 +86,14 @@
8686
87 # Cut away open and paid invoice linked to this PO87 # Cut away open and paid invoice linked to this PO
88 invoice_ids = self.pool.get('account.invoice').search(cr, uid, [('purchase_ids', 'in', [po_id]), ('state', 'in', ['paid', 'open'])])88 invoice_ids = self.pool.get('account.invoice').search(cr, uid, [('purchase_ids', 'in', [po_id]), ('state', 'in', ['paid', 'open'])])
89 included_dp_amls = []
89 for inv in self.pool.get('account.invoice').read(cr, uid, invoice_ids, ['amount_total', 'down_payment_ids']):90 for inv in self.pool.get('account.invoice').read(cr, uid, invoice_ids, ['amount_total', 'down_payment_ids']):
90 lines_amount -= inv.get('amount_total', 0.0)91 lines_amount -= inv.get('amount_total', 0.0)
91 dp_ids = inv.get('down_payment_ids', None)92 dp_ids = [dp_aml_id for dp_aml_id in inv.get('down_payment_ids', []) if dp_aml_id not in included_dp_amls]
92 for dp in self.pool.get('account.move.line').read(cr, uid, dp_ids, ['down_payment_amount']):93 for dp in self.pool.get('account.move.line').read(cr, uid, dp_ids, ['down_payment_amount']):
93 lines_amount += dp.get('down_payment_amount', 0.0)94 lines_amount += dp.get('down_payment_amount', 0.0)
95 # store each DP JI included in the calculation so its amount is counted only once (even if linked to several SIs)
96 included_dp_amls.append(dp.get('id'))
9497
95 total_amount = lines_amount + absl.amount98 total_amount = lines_amount + absl.amount
96 if (total + total_amount) < -0.001:99 if (total + total_amount) < -0.001:

Subscribers

People subscribed via source and target branches