summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindoteknik_custom/models/sale_order.py9
-rwxr-xr-xindoteknik_custom/views/sale_order.xml4
2 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index f9229bca..55a6bd26 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -84,6 +84,15 @@ class SaleOrder(models.Model):
helper_by_id = fields.Many2one('res.users', 'Helper By')
# picking_ids = fields.Many2many('stock.picking', string='Pickings', compute='_get_pickings', readonly=True, copy=False, search="_search_picking_ids")
+ def override_allow_create_invoice(self):
+ if not self.env.user.is_accounting:
+ raise UserError('Hanya Finance Accounting yang dapat klik tombol ini')
+ for term in self.payment_term_id.line_ids:
+ if term.days > 0:
+ raise UserError('Hanya dapat digunakan pada Cash Before Delivery')
+ for line in self.order_line:
+ line.qty_to_invoice = line.product_uom_qty
+
# def _get_pickings(self):
# state = ['assigned']
# for order in self:
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 125296e3..5db2f1e1 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -51,6 +51,10 @@
<field name="email" required="1"/>
<field name="due_id" readonly="1"/>
<field name="source_id" domain="[('id', 'in', [32, 59, 60, 61])]" required="1"/>
+ <button name="override_allow_create_invoice"
+ string="Override Create Invoice"
+ type="object"
+ />
</field>
<field name="partner_shipping_id" position="after">
<field name="real_shipping_id"/>