Bug terms

This commit is contained in:
2026-05-17 20:33:20 +02:00
parent 74e6cd0bf2
commit 80b2fed34b
7 changed files with 18 additions and 3 deletions

View File

@@ -910,3 +910,8 @@ Pour cette regle, couvrir au minimum:
- Le widget SAO `tolerance_gauge` est autorise dans les schemas de vues
`form` et `tree` avec `min`, `max`, `min_field`, `max_field`, `center` et
`digits`.
- En formulaire de ligne (`purchase.line` / `sale.line`), ne pas encapsuler
`tolerance_gauge` et `targeted_qt` dans un sous-groupe `colspan="4"`: cela
decale visuellement le bloc vers la droite dans SAO. Les placer directement
dans la grille principale et forcer `xalign="0"` sur la jauge et sur
`targeted_qt` pour garder un alignement a gauche stable.

View File

@@ -339,6 +339,10 @@ them with Python guards and SQL diagnostics.
<td style="vertical-align:top; padding:0.5rem 0.7rem;">Matching gauge</td>
<td style="vertical-align:top; padding:0.5rem 0.7rem;">In <code>Go to matching</code>, the gauge projects <code>already matched + Qt to match</code> against <code>quantity_theorical</code>, with <code>-tol_min</code> / <code>tol_max</code> bounds.</td>
</tr>
<tr style="border-bottom:1px solid #e0e0e0;">
<td style="vertical-align:top; padding:0.5rem 0.7rem;">Line gauge layout</td>
<td style="vertical-align:top; padding:0.5rem 0.7rem;">On <code>purchase.line</code> / <code>sale.line</code> forms, place the gauge and <code>targeted_qt</code> directly in the main grid, without a <code>colspan=&quot;4&quot;</code> subgroup, and use <code>xalign=&quot;0&quot;</code> to avoid a double right shift.</td>
</tr>
</tbody>
</table>

View File

@@ -338,6 +338,10 @@ puis les sécuriser par des checks Python et des diagnostics SQL.
<td style="vertical-align:top; padding:0.5rem 0.7rem;">Jauge matching</td>
<td style="vertical-align:top; padding:0.5rem 0.7rem;">Dans <code>Go to matching</code>, la jauge projette <code>déjà matché + Qt to match</code> contre <code>quantity_theorical</code>, avec bornes <code>-tol_min</code> / <code>tol_max</code>.</td>
</tr>
<tr style="border-bottom:1px solid #e0e0e0;">
<td style="vertical-align:top; padding:0.5rem 0.7rem;">Layout jauge ligne</td>
<td style="vertical-align:top; padding:0.5rem 0.7rem;">En formulaire <code>purchase.line</code> / <code>sale.line</code>, placer la jauge et <code>targeted_qt</code> directement dans la grille principale, sans sous-groupe <code>colspan=&quot;4&quot;</code>, et utiliser <code>xalign=&quot;0&quot;</code> pour éviter un double décalage vers la droite.</td>
</tr>
</tbody>
</table>

View File

@@ -127,6 +127,7 @@ quantity_theorical
| Line gauge | On a line with physical lots, the gauge uses the sum of physical lots; without physical lots, it uses the sum of linked `lot.qt`. |
| Header gauge | The purchase/sale gauge is the weighted average of line gauges, weighted by `quantity_theorical`. |
| Matching gauge | In `Go to matching`, the gauge projects `already matched + Qt to match` against `quantity_theorical`, with `-tol_min` / `tol_max` bounds. |
| Line gauge layout | On `purchase.line` / `sale.line` forms, place the gauge and `targeted_qt` directly in the main grid, without a `colspan="4"` subgroup, and use `xalign="0"` to avoid a double right shift. |
## Developer Section

View File

@@ -126,6 +126,7 @@ quantity_theorical
| Jauge ligne | Sur une ligne avec lots physiques, la jauge utilise la somme des physiques ; sans physique, elle utilise la somme des `lot.qt` liés. |
| Jauge header | La jauge purchase/sale est la moyenne pondérée des jauges de lignes au prorata de `quantity_theorical`. |
| Jauge matching | Dans `Go to matching`, la jauge projette `déjà matché + Qt to match` contre `quantity_theorical`, avec bornes `-tol_min` / `tol_max`. |
| Layout jauge ligne | En formulaire `purchase.line` / `sale.line`, placer la jauge et `targeted_qt` directement dans la grille principale, sans sous-groupe `colspan="4"`, et utiliser `xalign="0"` pour éviter un double décalage vers la droite. |
## Section développeur

View File

@@ -1691,8 +1691,9 @@ class Line(metaclass=PoolMeta):
def _get_basis_component_price(self):
price = Decimal(0)
if self.terms:
for t in self.terms:
terms = getattr(self, 'terms', None)
if terms:
for t in terms:
price += (t.manual_price if t.manual_price else Decimal(0))
else:
if not self.price_components:

View File

@@ -1588,7 +1588,6 @@ class PurchaseTradeTestCase(ModuleTestCase):
line.id = 1
line.price_type = 'basis'
line.price_components = []
line.terms = []
line.enable_linked_currency = False
line.linked_currency = None