Purchase form

This commit is contained in:
2026-07-25 19:26:10 +02:00
parent ffd673f9ef
commit b282fe9bc0
2 changed files with 20 additions and 15 deletions

View File

@@ -1264,7 +1264,8 @@ class Purchase(metaclass=PoolMeta):
Log = Pool().get('ir.model.log')
logs = Log.search([
('resource', '=', 'purchase.purchase,%s' % self.id),
], limit=4)
('event', '!=', 'create'),
], limit=8)
event_types = {
'write': 'info',
'transition': 'approved',
@@ -1274,6 +1275,8 @@ class Purchase(metaclass=PoolMeta):
}
activity = []
for log in logs:
if len(activity) >= 4:
break
date = getattr(log, 'create_date', None)
user = getattr(getattr(log, 'user', None), 'rec_name', None) or ''
text = getattr(log, 'change_summary', None)
@@ -1281,6 +1284,8 @@ class Purchase(metaclass=PoolMeta):
log, 'target', None)
if not text:
text = getattr(log, 'event_string', None) or log.event
if ' create' in text or 'create,' in text or text.startswith('Create'):
continue
activity.append({
"type": event_types.get(log.event, 'info'),
"text": text,

View File

@@ -18,9 +18,9 @@ this repository contains the full copyright notices and license terms. -->
height="168"/>
</group>
<group id="purchase_header_summary" colspan="5" col="8"
<group id="purchase_header_summary" colspan="6" col="10"
panel="summary" xalign="0" yalign="0"
col_widths="min-content,2fr,min-content,130px,min-content,1.2fr,min-content,130px">
col_widths="min-content,2fr,min-content,130px,min-content,1.2fr,min-content,130px,min-content,1fr">
<label name="party"/>
<field name="party"/>
<label name="number"/>
@@ -37,18 +37,18 @@ this repository contains the full copyright notices and license terms. -->
<field name="our_reference"/>
<label name="broker"/>
<field name="broker"/>
</group>
<group id="purchase_header_buttons" col="-1" colspan="1"
panel="summary" xalign="1" yalign="0">
<button name="cancel" icon="tryton-cancel"/>
<button name="draft"/>
<button name="modify_header" icon="tryton-launch"/>
<button name="quote" icon="tryton-forward"/>
<button name="handle_invoice_exception" icon="tryton-forward"/>
<button name="handle_shipment_exception" icon="tryton-forward"/>
<button name="confirm" icon="tryton-ok"/>
<button name="process" invisible="1"/>
<button name="manual_invoice" icon="tryton-forward"/>
<group id="purchase_header_buttons" col="-1" colspan="4"
xalign="1" yalign="0">
<button name="cancel" icon="tryton-cancel"/>
<button name="draft"/>
<button name="modify_header" icon="tryton-launch"/>
<button name="quote" icon="tryton-forward"/>
<button name="handle_invoice_exception" icon="tryton-forward"/>
<button name="handle_shipment_exception" icon="tryton-forward"/>
<button name="confirm" icon="tryton-ok"/>
<button name="process" invisible="1"/>
<button name="manual_invoice" icon="tryton-forward"/>
</group>
</group>
<field name="tolerance_min" invisible="1"/>