odoo14-addon-ddmrp 14.0.1.23.4__py3-none-any.whl → 14.0.1.24.1.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -676,6 +676,11 @@ msgstr "Visione futura"
676
676
  msgid "Get configuration warnings for stock buffers."
677
677
  msgstr "Ricevi allerte configurazione per buffer di materiale."
678
678
 
679
+ #. module: ddmrp
680
+ #: model_terms:ir.ui.view,arch_db:ddmrp.view_move_tree
681
+ msgid "Go to Source"
682
+ msgstr ""
683
+
679
684
  #. module: ddmrp
680
685
  #: model:ir.model.fields.selection,name:ddmrp.selection__mrp_production__execution_priority_level__3_green
681
686
  #: model:ir.model.fields.selection,name:ddmrp.selection__purchase_order_line__execution_priority_level__3_green
@@ -1127,9 +1132,8 @@ msgstr "Nessuna richiesta rilevata."
1127
1132
 
1128
1133
  #. module: ddmrp
1129
1134
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1130
- msgid "No stock available on source location for distributed buffer"
1135
+ msgid "No stock available in source location for distributed buffer"
1131
1136
  msgstr ""
1132
- "Nessuna giacenza disponibile nell'ubicazione origine per buffer distribuito"
1133
1137
 
1134
1138
  #. module: ddmrp
1135
1139
  #: code:addons/ddmrp/wizards/make_procurement_buffer.py:0
@@ -1193,11 +1197,6 @@ msgstr "Allarme disponibilità: rosso"
1193
1197
  msgid "On-Hand Alert: Yellow"
1194
1198
  msgstr "Allarme disponibilità: giallo"
1195
1199
 
1196
- #. module: ddmrp
1197
- #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1198
- msgid "Open Non-completed Moves"
1199
- msgstr "Apri movimenti non completi"
1200
-
1201
1200
  #. module: ddmrp
1202
1201
  #: code:addons/ddmrp/hooks.py:0
1203
1202
  #, python-format
@@ -1483,11 +1482,6 @@ msgstr "La quantità deve essere positiva."
1483
1482
  msgid "RFQ Qty (Outside DLT)"
1484
1483
  msgstr "Q.tà RdP (fuori da DLT)"
1485
1484
 
1486
- #. module: ddmrp
1487
- #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1488
- msgid "RFQ Qty Outside DLT"
1489
- msgstr "Q.tà RdP fuori da DLT"
1490
-
1491
1485
  #. module: ddmrp
1492
1486
  #: model:product.product,name:ddmrp.product_product_rm01
1493
1487
  #: model:product.template,name:ddmrp.product_product_rm01_product_template
@@ -1677,16 +1671,29 @@ msgstr ""
1677
1671
  "Visualizza la disponibilità attuale per buffer di materiale espressa in "
1678
1672
  "giorni di copertura."
1679
1673
 
1674
+ #. module: ddmrp
1675
+ #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1676
+ msgid ""
1677
+ "Some RFQ quantities are outside of the DLT Horizon and may require "
1678
+ "rescheduling. Press this button to display the involved "
1679
+ "RFQs"
1680
+ msgstr ""
1681
+
1680
1682
  #. module: ddmrp
1681
1683
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1682
1684
  msgid ""
1683
- "Some incoming quantities are outside of the DLT Horizon and may require "
1684
- "rescheduling. Press this button "
1685
+ "Some incoming RFQs are outside of the DLT Horizon and may require "
1686
+ "rescheduling. Press this button "
1687
+ "to display the involved supply orders"
1688
+ msgstr ""
1689
+
1690
+ #. module: ddmrp
1691
+ #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1692
+ msgid ""
1693
+ "Some incoming qty is outside of the DLT Horizon and may require "
1694
+ "rescheduling. Press this button "
1685
1695
  "to display the involved supply orders"
1686
1696
  msgstr ""
1687
- "Alcune quantità in ingresso sono al di fuori dell'orizzonte DLT e possono "
1688
- "richiedere una rischedulazione. "
1689
- "Cliccare il pulsante per visualizzare gli ordini di acquisto coinvolti"
1690
1697
 
1691
1698
  #. module: ddmrp
1692
1699
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
@@ -1780,6 +1787,12 @@ msgstr "Movimento di magazzino"
1780
1787
  msgid "Stock Move Last Year Consumption"
1781
1788
  msgstr "Consumo movimento di magazzino anno precednete"
1782
1789
 
1790
+ #. module: ddmrp
1791
+ #: code:addons/ddmrp/models/stock_move.py:0
1792
+ #, python-format
1793
+ msgid "Stock Move Source"
1794
+ msgstr ""
1795
+
1783
1796
  #. module: ddmrp
1784
1797
  #: model_terms:ir.ui.view,arch_db:ddmrp.view_move_consumption_pivot
1785
1798
  msgid "Stock Moves Yearly Consumption"
@@ -2027,8 +2040,8 @@ msgstr "Visalizza ADU (passato- fabbisogno indiretto)"
2027
2040
 
2028
2041
  #. module: ddmrp
2029
2042
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
2030
- msgid "View Incoming (Within DLT)"
2031
- msgstr "Visualizza ingressi (interno a DLT)"
2043
+ msgid "View Incoming Moves (Within DLT)"
2044
+ msgstr ""
2032
2045
 
2033
2046
  #. module: ddmrp
2034
2047
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
@@ -2203,6 +2216,30 @@ msgstr "minuti"
2203
2216
  msgid "or"
2204
2217
  msgstr "o"
2205
2218
 
2219
+ #~ msgid "No stock available on source location for distributed buffer"
2220
+ #~ msgstr ""
2221
+ #~ "Nessuna giacenza disponibile nell'ubicazione origine per buffer "
2222
+ #~ "distribuito"
2223
+
2224
+ #~ msgid "Open Non-completed Moves"
2225
+ #~ msgstr "Apri movimenti non completi"
2226
+
2227
+ #~ msgid "RFQ Qty Outside DLT"
2228
+ #~ msgstr "Q.tà RdP fuori da DLT"
2229
+
2230
+ #~ msgid ""
2231
+ #~ "Some incoming quantities are outside of the DLT Horizon and may require "
2232
+ #~ "rescheduling. Press this "
2233
+ #~ "button to display the involved supply orders"
2234
+ #~ msgstr ""
2235
+ #~ "Alcune quantità in ingresso sono al di fuori dell'orizzonte DLT e possono "
2236
+ #~ "richiedere una "
2237
+ #~ "rischedulazione. Cliccare il "
2238
+ #~ "pulsante per visualizzare gli ordini di acquisto coinvolti"
2239
+
2240
+ #~ msgid "View Incoming (Within DLT)"
2241
+ #~ msgstr "Visualizza ingressi (interno a DLT)"
2242
+
2206
2243
  #~ msgid "Top of Red"
2207
2244
  #~ msgstr "Superiore della rossa"
2208
2245
 
@@ -637,6 +637,11 @@ msgstr ""
637
637
  msgid "Get configuration warnings for stock buffers."
638
638
  msgstr ""
639
639
 
640
+ #. module: ddmrp
641
+ #: model_terms:ir.ui.view,arch_db:ddmrp.view_move_tree
642
+ msgid "Go to Source"
643
+ msgstr ""
644
+
640
645
  #. module: ddmrp
641
646
  #: model:ir.model.fields.selection,name:ddmrp.selection__mrp_production__execution_priority_level__3_green
642
647
  #: model:ir.model.fields.selection,name:ddmrp.selection__purchase_order_line__execution_priority_level__3_green
@@ -1079,7 +1084,7 @@ msgstr ""
1079
1084
 
1080
1085
  #. module: ddmrp
1081
1086
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1082
- msgid "No stock available on source location for distributed buffer"
1087
+ msgid "No stock available in source location for distributed buffer"
1083
1088
  msgstr ""
1084
1089
 
1085
1090
  #. module: ddmrp
@@ -1144,11 +1149,6 @@ msgstr ""
1144
1149
  msgid "On-Hand Alert: Yellow"
1145
1150
  msgstr ""
1146
1151
 
1147
- #. module: ddmrp
1148
- #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1149
- msgid "Open Non-completed Moves"
1150
- msgstr ""
1151
-
1152
1152
  #. module: ddmrp
1153
1153
  #: code:addons/ddmrp/hooks.py:0
1154
1154
  #, python-format
@@ -1429,11 +1429,6 @@ msgstr ""
1429
1429
  msgid "RFQ Qty (Outside DLT)"
1430
1430
  msgstr ""
1431
1431
 
1432
- #. module: ddmrp
1433
- #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1434
- msgid "RFQ Qty Outside DLT"
1435
- msgstr ""
1436
-
1437
1432
  #. module: ddmrp
1438
1433
  #: model:product.product,name:ddmrp.product_product_rm01
1439
1434
  #: model:product.template,name:ddmrp.product_product_rm01_product_template
@@ -1611,11 +1606,27 @@ msgstr ""
1611
1606
  msgid "Shows the current on-hand for stock buffers expressed as coverage days."
1612
1607
  msgstr ""
1613
1608
 
1609
+ #. module: ddmrp
1610
+ #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1611
+ msgid ""
1612
+ "Some RFQ quantities are outside of the DLT Horizon and may require "
1613
+ "rescheduling. Press this button to display the involved "
1614
+ "RFQs"
1615
+ msgstr ""
1616
+
1614
1617
  #. module: ddmrp
1615
1618
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1616
1619
  msgid ""
1617
- "Some incoming quantities are outside of the DLT Horizon and may require "
1618
- "rescheduling. Press this button "
1620
+ "Some incoming RFQs are outside of the DLT Horizon and may require "
1621
+ "rescheduling. Press this button "
1622
+ "to display the involved supply orders"
1623
+ msgstr ""
1624
+
1625
+ #. module: ddmrp
1626
+ #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1627
+ msgid ""
1628
+ "Some incoming qty is outside of the DLT Horizon and may require "
1629
+ "rescheduling. Press this button "
1619
1630
  "to display the involved supply orders"
1620
1631
  msgstr ""
1621
1632
 
@@ -1706,6 +1717,12 @@ msgstr ""
1706
1717
  msgid "Stock Move Last Year Consumption"
1707
1718
  msgstr ""
1708
1719
 
1720
+ #. module: ddmrp
1721
+ #: code:addons/ddmrp/models/stock_move.py:0
1722
+ #, python-format
1723
+ msgid "Stock Move Source"
1724
+ msgstr ""
1725
+
1709
1726
  #. module: ddmrp
1710
1727
  #: model_terms:ir.ui.view,arch_db:ddmrp.view_move_consumption_pivot
1711
1728
  msgid "Stock Moves Yearly Consumption"
@@ -1931,7 +1948,7 @@ msgstr ""
1931
1948
 
1932
1949
  #. module: ddmrp
1933
1950
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1934
- msgid "View Incoming (Within DLT)"
1951
+ msgid "View Incoming Moves (Within DLT)"
1935
1952
  msgstr ""
1936
1953
 
1937
1954
  #. module: ddmrp
@@ -649,6 +649,11 @@ msgstr "未来样子"
649
649
  msgid "Get configuration warnings for stock buffers."
650
650
  msgstr ""
651
651
 
652
+ #. module: ddmrp
653
+ #: model_terms:ir.ui.view,arch_db:ddmrp.view_move_tree
654
+ msgid "Go to Source"
655
+ msgstr ""
656
+
652
657
  #. module: ddmrp
653
658
  #: model:ir.model.fields.selection,name:ddmrp.selection__mrp_production__execution_priority_level__3_green
654
659
  #: model:ir.model.fields.selection,name:ddmrp.selection__purchase_order_line__execution_priority_level__3_green
@@ -1099,7 +1104,7 @@ msgstr ""
1099
1104
 
1100
1105
  #. module: ddmrp
1101
1106
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1102
- msgid "No stock available on source location for distributed buffer"
1107
+ msgid "No stock available in source location for distributed buffer"
1103
1108
  msgstr ""
1104
1109
 
1105
1110
  #. module: ddmrp
@@ -1164,11 +1169,6 @@ msgstr "在手警报: 红"
1164
1169
  msgid "On-Hand Alert: Yellow"
1165
1170
  msgstr "在手警报: 黄"
1166
1171
 
1167
- #. module: ddmrp
1168
- #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1169
- msgid "Open Non-completed Moves"
1170
- msgstr "开放未完成的移动"
1171
-
1172
1172
  #. module: ddmrp
1173
1173
  #: code:addons/ddmrp/hooks.py:0
1174
1174
  #, python-format
@@ -1458,11 +1458,6 @@ msgstr ""
1458
1458
  msgid "RFQ Qty (Outside DLT)"
1459
1459
  msgstr ""
1460
1460
 
1461
- #. module: ddmrp
1462
- #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1463
- msgid "RFQ Qty Outside DLT"
1464
- msgstr ""
1465
-
1466
1461
  #. module: ddmrp
1467
1462
  #: model:product.product,name:ddmrp.product_product_rm01
1468
1463
  #: model:product.template,name:ddmrp.product_product_rm01_product_template
@@ -1641,11 +1636,27 @@ msgstr ""
1641
1636
  msgid "Shows the current on-hand for stock buffers expressed as coverage days."
1642
1637
  msgstr ""
1643
1638
 
1639
+ #. module: ddmrp
1640
+ #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_tree
1641
+ msgid ""
1642
+ "Some RFQ quantities are outside of the DLT Horizon and may require "
1643
+ "rescheduling. Press this button to display the involved "
1644
+ "RFQs"
1645
+ msgstr ""
1646
+
1644
1647
  #. module: ddmrp
1645
1648
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1646
1649
  msgid ""
1647
- "Some incoming quantities are outside of the DLT Horizon and may require "
1648
- "rescheduling. Press this button "
1650
+ "Some incoming RFQs are outside of the DLT Horizon and may require "
1651
+ "rescheduling. Press this button "
1652
+ "to display the involved supply orders"
1653
+ msgstr ""
1654
+
1655
+ #. module: ddmrp
1656
+ #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1657
+ msgid ""
1658
+ "Some incoming qty is outside of the DLT Horizon and may require "
1659
+ "rescheduling. Press this button "
1649
1660
  "to display the involved supply orders"
1650
1661
  msgstr ""
1651
1662
 
@@ -1742,6 +1753,12 @@ msgstr "库存缓冲"
1742
1753
  msgid "Stock Move Last Year Consumption"
1743
1754
  msgstr ""
1744
1755
 
1756
+ #. module: ddmrp
1757
+ #: code:addons/ddmrp/models/stock_move.py:0
1758
+ #, python-format
1759
+ msgid "Stock Move Source"
1760
+ msgstr ""
1761
+
1745
1762
  #. module: ddmrp
1746
1763
  #: model_terms:ir.ui.view,arch_db:ddmrp.view_move_consumption_pivot
1747
1764
  msgid "Stock Moves Yearly Consumption"
@@ -1968,7 +1985,7 @@ msgstr ""
1968
1985
 
1969
1986
  #. module: ddmrp
1970
1987
  #: model_terms:ir.ui.view,arch_db:ddmrp.stock_buffer_view_form
1971
- msgid "View Incoming (Within DLT)"
1988
+ msgid "View Incoming Moves (Within DLT)"
1972
1989
  msgstr ""
1973
1990
 
1974
1991
  #. module: ddmrp
@@ -2118,6 +2135,9 @@ msgstr ""
2118
2135
  msgid "or"
2119
2136
  msgstr ""
2120
2137
 
2138
+ #~ msgid "Open Non-completed Moves"
2139
+ #~ msgstr "开放未完成的移动"
2140
+
2121
2141
  #~ msgid "Top of Red"
2122
2142
  #~ msgstr "红顶"
2123
2143
 
@@ -1362,17 +1362,6 @@ class StockBuffer(models.Model):
1362
1362
  "domain": str([("id", "in", lines.ids)]),
1363
1363
  }
1364
1364
 
1365
- def open_moves(self):
1366
- self.ensure_one()
1367
- # Utility method used to add an "Open Moves" button in the buffer
1368
- # planning view
1369
- domain = self._search_open_stock_moves_domain()
1370
- moves = self.env["stock.move"].search(domain)
1371
- moves = moves.filtered(
1372
- lambda move: move.location_dest_id.is_sublocation_of(self.location_id)
1373
- )
1374
- return self._stock_move_tree_view(moves)
1375
-
1376
1365
  def _get_horizon_adu_past_demand(self):
1377
1366
  return self.adu_calculation_method.horizon_past or 0
1378
1367
 
@@ -1821,72 +1810,72 @@ class StockBuffer(models.Model):
1821
1810
  wizard.make_procurement()
1822
1811
  return True
1823
1812
 
1824
- def _search_purchase_order_lines_incoming(self, outside_dlt=False):
1813
+ def action_view_supply_moves(self):
1814
+ result = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action")
1815
+ result["context"] = {}
1816
+ moves = self._search_stock_moves_incoming() + self._search_stock_moves_incoming(
1817
+ outside_dlt=True
1818
+ )
1819
+ result["domain"] = [("id", "in", moves.ids)]
1820
+ return result
1821
+
1822
+ def _get_rfq_dlt(self, outside_dlt=False):
1823
+ self.ensure_one()
1825
1824
  cut_date = self._get_incoming_supply_date_limit()
1826
1825
  if not outside_dlt:
1827
1826
  pols = self.purchase_line_ids.filtered(
1828
1827
  lambda l: l.date_planned <= fields.Datetime.to_datetime(cut_date)
1829
- and l.order_id.state in ("draft", "sent")
1828
+ and l.state in ("draft", "sent")
1830
1829
  )
1831
1830
  else:
1832
1831
  pols = self.purchase_line_ids.filtered(
1833
1832
  lambda l: l.date_planned > fields.Datetime.to_datetime(cut_date)
1834
- and l.order_id.state in ("draft", "sent")
1833
+ and l.state in ("draft", "sent")
1835
1834
  )
1836
1835
  return pols
1837
1836
 
1838
- def action_view_supply(self, outside_dlt=False):
1839
- if self.item_type == "purchased":
1840
- pols = self._search_purchase_order_lines_incoming(outside_dlt)
1841
- moves = self._search_stock_moves_incoming(outside_dlt)
1842
- while moves.mapped("move_orig_ids"):
1843
- moves = moves.mapped("move_orig_ids")
1844
- pos = pols.mapped("order_id") + moves.mapped("purchase_line_id.order_id")
1845
- result = self.env["ir.actions.actions"]._for_xml_id("purchase.purchase_rfq")
1846
- # Remove the context since the action display RFQ and not PO.
1847
- result["context"] = {}
1848
- result["domain"] = [("id", "in", pos.ids)]
1849
- elif self.item_type == "manufactured":
1850
- moves = self._search_stock_moves_incoming(outside_dlt)
1851
- mos = moves.mapped("production_id")
1852
- result = self.env["ir.actions.actions"]._for_xml_id(
1853
- "mrp.mrp_production_action"
1854
- )
1855
- result["context"] = {}
1856
- result["domain"] = [("id", "in", mos.ids)]
1857
- else:
1858
- moves = self._search_stock_moves_incoming(outside_dlt)
1859
- picks = moves.mapped("picking_id")
1860
- result = self.env["ir.actions.actions"]._for_xml_id(
1861
- "stock.action_picking_tree_all"
1862
- )
1863
- result["context"] = {}
1864
- result["domain"] = [("id", "in", picks.ids)]
1837
+ def action_view_supply_moves_inside_dlt_window(self):
1838
+ result = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action")
1839
+ moves = self._search_stock_moves_incoming()
1840
+ result["context"] = {}
1841
+ result["domain"] = [("id", "in", moves.ids)]
1865
1842
  return result
1866
1843
 
1867
- def action_view_supply_inside_dlt_window(self):
1868
- return self.action_view_supply()
1844
+ def action_view_supply_moves_outside_dlt_window(self):
1845
+ result = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action")
1846
+ moves = self._search_stock_moves_incoming(outside_dlt=True)
1847
+ result["context"] = {}
1848
+ result["domain"] = [("id", "in", moves.ids)]
1849
+ return result
1869
1850
 
1870
- def action_view_supply_outside_dlt_window(self):
1871
- return self.action_view_supply(outside_dlt=True)
1851
+ def action_view_supply_rfq_inside_dlt_window(self):
1852
+ result = self.env["ir.actions.actions"]._for_xml_id("purchase.purchase_rfq")
1853
+ pols = self._get_rfq_dlt()
1854
+ pos = pols.mapped("order_id")
1855
+ result["context"] = {}
1856
+ result["domain"] = [("id", "in", pos.ids)]
1857
+ return result
1872
1858
 
1873
- def action_view_qualified_demand_pickings(self):
1874
- moves = self.qualified_demand_stock_move_ids
1875
- picks = moves.mapped("picking_id")
1876
- result = self.env["ir.actions.actions"]._for_xml_id(
1877
- "stock.action_picking_tree_all"
1878
- )
1859
+ def action_view_supply_rfq_outside_dlt_window(self):
1860
+ result = self.env["ir.actions.actions"]._for_xml_id("purchase.purchase_rfq")
1861
+ pols = self._get_rfq_dlt(outside_dlt=True)
1862
+ pos = pols.mapped("order_id")
1879
1863
  result["context"] = {}
1880
- result["domain"] = [("id", "in", picks.ids)]
1864
+ result["domain"] = [("id", "in", pos.ids)]
1865
+ return result
1866
+
1867
+ def action_view_qualified_demand_moves(self):
1868
+ result = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action")
1869
+ result["context"] = {}
1870
+ result["domain"] = [("id", "in", self.qualified_demand_stock_move_ids.ids)]
1881
1871
  return result
1882
1872
 
1883
1873
  def action_view_qualified_demand_mrp(self):
1884
- mrp_moves = self.qualified_demand_mrp_move_ids
1885
1874
  result = self.env["ir.actions.actions"]._for_xml_id(
1886
1875
  "mrp_multi_level.mrp_move_action"
1887
1876
  )
1888
1877
  result["context"] = {}
1889
- result["domain"] = [("id", "in", mrp_moves.ids)]
1878
+ result["domain"] = [("id", "in", self.qualified_demand_mrp_move_ids.ids)]
1890
1879
  return result
1891
1880
 
1892
1881
  def action_view_past_adu_direct_demand(self):
@@ -1,7 +1,7 @@
1
1
  # Copyright 2019-20 ForgeFlow S.L. (http://www.forgeflow.com)
2
2
  # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
3
3
 
4
- from odoo import api, fields, models
4
+ from odoo import _, api, fields, models
5
5
 
6
6
 
7
7
  class StockMove(models.Model):
@@ -84,3 +84,69 @@ class StockMove(models.Model):
84
84
  buffer.cron_actions(only_nfp="out")
85
85
  for buffer in in_buffers.with_context(no_ddmrp_history=True):
86
86
  buffer.cron_actions(only_nfp="in")
87
+
88
+ def _get_all_linked_moves(self):
89
+ """Retrieve all linked moves both origin and destination recursively."""
90
+
91
+ def get_moves(move_set, attr):
92
+ new_moves = move_set.mapped(attr)
93
+ while new_moves:
94
+ move_set |= new_moves
95
+ new_moves = new_moves.mapped(attr)
96
+ return move_set
97
+
98
+ all_moves = (
99
+ self | get_moves(self, "move_orig_ids") | get_moves(self, "move_dest_ids")
100
+ )
101
+ return all_moves
102
+
103
+ def _get_source_field_candidates(self):
104
+ """Extend for more source field candidates."""
105
+ return [
106
+ "sale_line_id.order_id",
107
+ "purchase_line_id.order_id",
108
+ "production_id",
109
+ "raw_material_production_id",
110
+ "unbuild_id",
111
+ "repair_id",
112
+ "rma_line_id",
113
+ "picking_id",
114
+ ]
115
+
116
+ def _has_nested_field(self, field):
117
+ """Check if an object has a nested chain of fields."""
118
+ current_object = self
119
+ try:
120
+ for field in field.split("."):
121
+ current_object = getattr(current_object, field)
122
+ return True
123
+ except AttributeError:
124
+ return False
125
+
126
+ def _get_source_record(self):
127
+ """Find the first source record in the field candidates linked with the moves,
128
+ prioritizing the order of field candidates."""
129
+ moves = self._get_all_linked_moves()
130
+ field_candidates = self._get_source_field_candidates()
131
+ # Iterate over the prioritized list of candidate fields
132
+ for field in field_candidates:
133
+ if self._has_nested_field(field):
134
+ for move in moves:
135
+ record = move.mapped(field)
136
+ if record:
137
+ return record
138
+ return False
139
+
140
+ def action_open_stock_move_source(self):
141
+ """Open the source record of the stock move, if it exists."""
142
+ self.ensure_one()
143
+ record = self._get_source_record()
144
+ if record:
145
+ return {
146
+ "name": getattr(record, "name", _("Stock Move Source")),
147
+ "view_mode": "form",
148
+ "res_model": record._name,
149
+ "type": "ir.actions.act_window",
150
+ "res_id": record.id,
151
+ }
152
+ return False
@@ -366,7 +366,7 @@ ul.auto-toc {
366
366
  !! This file is generated by oca-gen-addon-readme !!
367
367
  !! changes will be overwritten. !!
368
368
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369
- !! source digest: sha256:063af95a356227267e8e39893c40820c278c5d6c3b0e7eeaa56937e9fdab706c
369
+ !! source digest: sha256:81c9f86d5d94033c4e599e426d7a95628e63ebcb642deff966a8e49a5b951476
370
370
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371
371
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/ddmrp/tree/14.0/ddmrp"><img alt="OCA/ddmrp" src="https://img.shields.io/badge/github-OCA%2Fddmrp-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/ddmrp-14-0/ddmrp-14-0-ddmrp"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/ddmrp&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372
372
  <p>Demand Driven Material Requirements Planning is a formal multi-echelon
@@ -38,24 +38,19 @@
38
38
  type="object"
39
39
  />
40
40
  <field name="incoming_dlt_qty" string="Incoming Within DLT" />
41
- <field
42
- name="incoming_total_qty"
43
- string="Total Incoming"
44
- optional="show"
45
- />
46
41
  <field
47
42
  name="incoming_outside_dlt_qty"
48
43
  string="Incoming Outside DLT"
49
44
  optional="hide"
50
45
  />
51
46
  <field
52
- name="rfq_outside_dlt_qty"
53
- string="RFQ Qty Outside DLT"
54
- optional="hide"
47
+ name="incoming_total_qty"
48
+ string="Total Incoming"
49
+ optional="show"
55
50
  />
56
51
  <button
57
- title="Open Non-completed Moves"
58
- name="open_moves"
52
+ title="Total Incoming"
53
+ name="action_view_supply_moves"
59
54
  icon="fa-exchange"
60
55
  type="object"
61
56
  />
@@ -71,13 +66,22 @@
71
66
  />
72
67
  <button
73
68
  title="Some incoming quantities are outside of the DLT Horizon and may require rescheduling. Press this button to display the involved supply orders"
74
- name="action_view_supply_outside_dlt_window"
69
+ name="action_view_supply_moves_outside_dlt_window"
75
70
  icon="fa-warning"
76
71
  type="object"
77
- attrs="{'invisible':[('incoming_outside_dlt_qty', '=', 0), ('rfq_outside_dlt_qty', '=', 0)]}"
72
+ attrs="{'invisible':[('incoming_outside_dlt_qty', '=', 0)]}"
78
73
  />
74
+ <field name="rfq_outside_dlt_qty" invisible="1" />
79
75
  <button
80
- title="No stock available on source location for distributed buffer"
76
+ title="Some RFQ quantities are outside of the DLT Horizon and may require rescheduling.
77
+ Press this button to display the involved RFQs"
78
+ name="action_view_supply_rfq_outside_dlt_window"
79
+ icon="fa-warning"
80
+ type="object"
81
+ attrs="{'invisible':[('rfq_outside_dlt_qty', '=', 0)]}"
82
+ />
83
+ <button
84
+ title="No stock available in source location for distributed buffer"
81
85
  name="action_dummy"
82
86
  icon="fa-warning"
83
87
  type="object"
@@ -397,8 +401,8 @@
397
401
  <div name="incoming_dlt_qty" class="o_row">
398
402
  <field name="incoming_dlt_qty" />
399
403
  <button
400
- title="View Incoming (Within DLT)"
401
- name="action_view_supply_inside_dlt_window"
404
+ title="View Incoming Moves (Within DLT)"
405
+ name="action_view_supply_moves_inside_dlt_window"
402
406
  icon="fa-search"
403
407
  type="object"
404
408
  attrs="{'invisible': [('incoming_dlt_qty', '=', 0)]}"
@@ -409,11 +413,24 @@
409
413
  attrs="{'invisible':[('incoming_outside_dlt_qty', '=', 0), ('rfq_outside_dlt_qty', '=', 0)]}"
410
414
  >
411
415
  <button
412
- title="Some incoming quantities are outside of the DLT Horizon and may require rescheduling.
413
- Press this button to display the involved supply orders"
414
- name="action_view_supply_outside_dlt_window"
416
+ title="Some incoming qty is outside of the DLT Horizon and may require rescheduling.
417
+ Press this button to display the involved supply orders"
418
+ name="action_view_supply_moves_outside_dlt_window"
419
+ icon="fa-warning"
420
+ type="object"
421
+ attrs="{'invisible':[('incoming_outside_dlt_qty', '=', 0)]}"
422
+ />
423
+ <field
424
+ name="rfq_outside_dlt_qty"
425
+ invisible="1"
426
+ />
427
+ <button
428
+ title="Some incoming RFQs are outside of the DLT Horizon and may require rescheduling.
429
+ Press this button to display the involved supply orders"
430
+ name="action_view_supply_rfq_outside_dlt_window"
415
431
  icon="fa-warning"
416
432
  type="object"
433
+ attrs="{'invisible':[('rfq_outside_dlt_qty', '=', 0)]}"
417
434
  />
418
435
  (Outside DLT:
419
436
  <field
@@ -436,7 +453,7 @@
436
453
  />
437
454
  <button
438
455
  title="View Qualified Demand from Pickings"
439
- name="action_view_qualified_demand_pickings"
456
+ name="action_view_qualified_demand_moves"
440
457
  icon="fa-search"
441
458
  type="object"
442
459
  attrs="{'invisible': ['|', ('qualified_demand', '=', 0), ('qualified_demand_stock_move_ids', '=', [])]}"