deisy 5 éve
szülő
commit
261fa555ac

+ 2 - 2
models/import_cost_calculation.py

@@ -12,7 +12,7 @@ class import_purchase_line(models.Model):
     _name = 'import.purchase.line'
 
     import_id = fields.Many2one('import.cost', 'Compras de importación',ondelete='cascade')
-    purchase_id = fields.Many2one('account.invoice', 'Compras',required=True, domain=[('type', '=', 'in_invoice')])
+    purchase_id = fields.Many2one('account.invoice', 'Compras',required=True)
     purchase_subtotal = fields.Float("Subtotal", related='purchase_id.amount_untaxed', store=True, readonly=True)
     purchase_taxes = fields.Float("Impuestos", related='purchase_id.amount_tax', store=True, readonly=True)
     purchase_total = fields.Float("Total", related='purchase_id.amount_total', store=True, readonly=True)
@@ -32,7 +32,7 @@ class import_expense_line(models.Model):
     _name = 'import.expense.line'
 
     import_id = fields.Many2one('import.cost', 'Gastos de importación',ondelete='cascade')
-    expense_id = fields.Many2one('account.invoice', 'Gastos', required=True,  domain=[('type', '=', 'in_invoice')])
+    expense_id = fields.Many2one('account.invoice', 'Gastos', required=True)
     expense_subtotal = fields.Float("Subtotal", related='expense_id.amount_untaxed', store=True, readonly=True)
     expense_taxes = fields.Float("Impuestos", related='expense_id.amount_tax', store=True, readonly=True)
     expense_total = fields.Float("Total", related='expense_id.amount_total', store=True, readonly=True)

+ 2 - 2
views/import_cost_calculation.xml

@@ -36,7 +36,7 @@
             <group>
               <field name="purchases"  nolabel="1" attrs="{'readonly': [('state','=', 'approved')]}">
                 <tree string="Detalles" editable="bottom" >
-                  <field name="purchase_id" domain="['|',('origin', 'ilike', 'PO'),('origin', '!=', False),('type', '=', 'in_invoice'),('state','=','paid')]"/>
+                  <field name="purchase_id" domain="['|',('origin', 'ilike', 'PO'),('origin', '!=', False),('type', '=', 'in_invoice'),('state','=','paid')]" context="{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase','default_origin':'PO', 'origin':'PO'}"/>
                   <field name="product_qty" readonly="1"/>
                   <field name="purchase_subtotal"/>
                   <field name="purchase_taxes"/>
@@ -59,7 +59,7 @@
             <group>
               <field name="expenses" nolabel="1" attrs="{'readonly': [('state','=', 'approved')]}">
                 <tree string="Detalles" editable="bottom" >
-                  <field name="expense_id" domain="['|',('origin', 'ilike', 'AA'),('origin', '=', False),('type', '=', 'in_invoice'),('state','=','paid')]"/>
+                  <field name="expense_id" domain="['|',('origin', 'ilike', 'AA'),('origin', '=', False),('type', '=', 'in_invoice'),('state','=','paid')]" context="{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase','default_is_a_expense':True,'is_a_expense':True}"/>
                   <field name="expense_subtotal"/>
                   <field name="expense_taxes"/>
                   <field name="expense_total"/>