[imp] add batches to Sale Orders

This commit is contained in:
NIels Göttsch 2024-10-19 23:04:01 +02:00 committed by madmooose
parent 811a04aadd
commit b682301c2b
7 changed files with 29 additions and 10 deletions

View file

@ -37,6 +37,7 @@ Changelog
:0.0.1: Initial module.
:1.0.0: Add Multi Company ability
:1.0.1: rename product creation methode
:1.1.0: Make validity_date persistent, add batches to SO views
Bug Tracker
===========

View file

@ -4,7 +4,7 @@
"author": "BAKEUP",
"website": "https://www.bakeup.org",
"category": "Sale",
"version": "16.0.1.0.1",
"version": "16.0.1.1.0",
"depends": ["sale", "product"],
"data": [
"data/ir_sequence_data.xml",

View file

@ -5,7 +5,7 @@ from odoo.exceptions import UserError
class SaleOrder(models.Model):
_inherit = "sale.order"
batch_id = fields.Many2one("sale.order.batch", copy=False, check_company=True)
batch_id = fields.Many2one("sale.order.batch", copy=False, check_company=True, domain="[('state','!=','closed')]")
def action_add_to_batch(self):
"""

View file

@ -1,3 +1,4 @@
:0.0.1: Initial module.
:1.0.0: Add Multi Company ability
:1.0.1: rename product creation methode
:1.0.1: rename product creation methode
:1.1.0: Make validity_date persistent, add batches to SO views

View file

@ -398,6 +398,8 @@ anymore as log as they are part of a batch. Only Sale Orders in state Qutotation
</tr>
<tr class="field"><th class="field-name">1.0.1:</th><td class="field-body">rename product creation methode</td>
</tr>
<tr class="field"><th class="field-name">1.1.0:</th><td class="field-body">Make validity_date persistent, add batches to SO views</td>
</tr>
</tbody>
</table>
</div>

View file

@ -99,11 +99,8 @@
</group>
<notebook>
<page string="Sale Orders" name="orders">
<field
name="sale_order_ids"
domain="[('state','in',['draft','sent']),('batch_id','=',False)]"
>
<tree>
<field name="sale_order_ids">
<tree delete="0">
<field name="name"/>
<field name="partner_id"/>
<field name="date_order"/>

View file

@ -36,11 +36,14 @@
name="attrs"
>{'invisible': ['|',('batch_id','!=',False),('state', 'not in', ['draft'])]}</attribute>
</xpath>
<group name="partner_details" position="inside">
<field name="batch_id"/>
</group>
</field>
</record>
<record id="view_order_list_inherit_batch" model="ir.ui.view">
<field name="name">sale.order.list.view.inherited</field>
<record id="view_quatation_tree_inherit_batch" model="ir.ui.view">
<field name="name">sale.order.tree.inherited.batch</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml">
@ -49,6 +52,21 @@
<button type="object" name="action_add_to_batch" string="Add to Batch"/>
</header>
</xpath>
<xpath expr="//field[@name='name']" position="after">
<field name="batch_id"/>
</xpath>
</field>
</record>
<record id="view_order_tree_inherit_batch" model="ir.ui.view">
<field name="name">sale.order.tree.inherited.batch</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="batch_id"/>
</xpath>
</field>
</record>
</odoo>