[IMP] sale, sale_(various): UX improvements in SO form view

This commit is contained in:
Damien Bouvy
2019-08-20 14:02:30 +00:00
parent b61fd3af7f
commit ef59eabd47
7 changed files with 18 additions and 13 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
<field name="name">Sales Order</field>
<field name="code">sale.order</field>
<field name="prefix">S</field>
<field name="padding">3</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
</record>
+6 -5
View File
@@ -180,12 +180,13 @@ class SaleOrder(models.Model):
signed_on = fields.Datetime('Signed On', help='Date of the signature.', copy=False)
commitment_date = fields.Datetime('Commitment Date',
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
copy=False, readonly=True,
help="This is the delivery date promised to the customer. If set, the delivery order "
"will be scheduled based on this date rather than product lead times.")
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
copy=False, readonly=True,
help="This is the delivery date promised to the customer. "
"If set, the delivery order will be scheduled based on "
"this date rather than product lead times.")
expected_date = fields.Datetime("Expected Date", compute='_compute_expected_date', store=False, # Note: can not be stored since depends on today()
help="Delivery date you can promise to the customer, computed from product lead times and from the shipping policy of the order.")
help="Delivery date you can promise to the customer, computed from the minimum lead time of the order lines.")
amount_undiscounted = fields.Float('Amount Before Discount', compute='_compute_amount_undiscounted', digits=0)
type_name = fields.Char('Type Name', compute='_compute_type_name')
+3 -3
View File
@@ -83,7 +83,7 @@
</field>
</record>
<menuitem id="product_menu_catalog" name="Products" action="product_template_action" parent="sale_menu_root" sequence="4" groups="sales_team.group_sale_salesman"/>
<menuitem id="product_menu_catalog" name="Products" parent="sale_menu_root" sequence="4" groups="sales_team.group_sale_salesman"/>
<menuitem id="menu_product" name="Product Variants" parent="product_menu_catalog" sequence="2" groups="base.group_no_one" active="False"/>
<menuitem action="product_template_action" id="menu_product_template_action" parent="product_menu_catalog" sequence="1" active="False"/>
<menuitem id="prod_config_main" name="Products" parent="menu_sale_config" sequence="5"/>
@@ -316,7 +316,7 @@
<label for="date_order" string="Order Date"/>
</div>
<field name="date_order" attrs="{'required': [('state', 'in', ['sale', 'done'])], 'invisible': [('state', 'in', ['draft', 'sent'])]}" nolabel="1"/>
<field name="pricelist_id" groups="product.group_product_pricelist"/>
<field name="pricelist_id" groups="product.group_product_pricelist" options="{'no_open':True,'no_create': True}"/>
<field name="currency_id" invisible="1"/>
<field name="payment_term_id" options="{'no_open':True,'no_create': True}"/>
</group>
@@ -633,7 +633,7 @@
<group name="sale_info" string="Invoicing">
<field name="fiscal_position_id" options="{'no_create': True}"/>
<field name="analytic_account_id" context="{'default_partner_id':partner_invoice_id, 'default_name':name}" attrs="{'readonly': [('invoice_count','!=',0),('state','=','sale')]}" groups="analytic.group_analytic_accounting" force_save="1"/>
<field name="invoice_status" states="sale,done"/>
<field name="invoice_status" states="sale,done" groups="base.group_no_one"/>
</group>
</group>
<group>
@@ -9,8 +9,8 @@
<xpath expr="//group[@name='note_group']" position="before">
<div class="oe_right">
<button name="%(sale_coupon.sale_coupon_apply_code_action)d" class="btn btn-secondary"
string="Add Coupon" type="action" groups="base.group_user" states="draft"/>
<button name="recompute_coupon_lines" class="btn btn-secondary" string="Add Promotions"
string="Coupon" type="action" groups="base.group_user" states="draft"/>
<button name="recompute_coupon_lines" class="btn btn-secondary" string="Promotions"
help="When clicked, the content of the order will be checked to detect (and apply) possible promotion programs."
type="object" attrs="{'invisible': [('state', 'in', ['sale', 'done', 'cancel'])]}"/>
</div>
@@ -7,7 +7,7 @@
<field name="arch" type="xml">
<xpath expr="//page/field[@name='order_line']/.." position="after">
<page string="Optional Products" name="optional_products">
<page string="Optional Products" name="optional_products" attrs="{'invisible': [('state', 'not in', ['draft', 'sent'])]}">
<field name="sale_order_option_ids" mode="tree,form,kanban">
<form string="Optional Products">
<group>
@@ -11,7 +11,7 @@
<field name="grid_product_tmpl_id" invisible="1"/>
<field name="grid_update" invisible="1"/>
</field>
<xpath expr="//notebook//group[@name='sale_reporting']" position="inside">
<xpath expr="//notebook//group[@name='sale_reporting']/group" position="inside">
<field name="report_grids"/>
</xpath>
</field>
+4
View File
@@ -36,6 +36,10 @@ class SaleOrder(models.Model):
delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids')
procurement_group_id = fields.Many2one('procurement.group', 'Procurement Group', copy=False)
effective_date = fields.Date("Effective Date", compute='_compute_effective_date', store=True, help="Completion date of the first delivery order.")
expected_date = fields.Datetime( help="Delivery date you can promise to the customer, computed from the minimum lead time of "
"the order lines in case of Service products. In case of shipping, the shipping policy of "
"the order will be taken into account to either use the minimum or maximum lead time of "
"the order lines.")
@api.depends('picking_ids.date_done')
def _compute_effective_date(self):