_constraints = [
(_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id'])
]
+ _sql_constraints = [
+ ('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
+ ]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if not args:
args = []
<field name="company_id"/>
<field name="fiscal_position" groups="base.group_extended"/>
<newline/>
- <field name="payment_term" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)"/>
+ <field name="payment_term"/>
<field name="name" select="2"/>
<newline/>
<field name="number" select="2"/>
<field name="origin" select="2"/>
<field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id"/>
<field name="move_id"/>
- <field name="date_invoice" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)" select="1"/>
+ <field name="date_invoice"/>
<field name="period_id"/>
<label align="0.0" colspan="2" string="(keep empty to use the current period)"/>
<separator colspan="4" string="Additionnal Information"/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="currency_id" on_change="onchange_currency_id(currency_id)" select="2"/>
- <field name="date_invoice" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)" select="1"/>
+ <field name="date_invoice" select="1"/>
<field name="period_id"/>
<label align="0.0" colspan="2" string="(keep empty to use the current period)"/>
</group>
<page string="Invoice">
<field domain="[('type','<>','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
<field name="name" select="2"/>
- <field name="payment_term" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)"/>
+ <field name="payment_term"/>
<field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list"/>
<group col="1" colspan="2">
<field name="tax_line" nolabel="1">
<record id="act_open" model="workflow.activity">
<field name="wkf_id" ref="wkf"/>
<field name="name">open</field>
- <field name="action">action_move_create()
+ <field name="action">action_date_assign()
+action_move_create()
action_number()
write({'state':'open'})</field>
<field name="kind">function</field>
if type in ('in_invoice', 'in_refund'):
result['value']['partner_bank'] = bank_id
- if payment_term != partner_payment_term:
- if partner_payment_term:
- to_update = self.onchange_payment_term_date_invoice(
- cr,uid,ids,partner_payment_term,date_invoice)
- result['value'].update(to_update['value'])
- else:
- result['value']['date_due'] = False
-
if partner_bank_id != bank_id:
to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
result['value'].update(to_update['value'])
return {}
res={}
pt_obj= self.pool.get('account.payment.term')
-
if not date_invoice :
date_invoice = time.strftime('%Y-%m-%d')
-
pterm_list= pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice)
-
if pterm_list:
pterm_list = [line[0] for line in pterm_list]
pterm_list.sort()
res= {'value':{'date_due': pterm_list[-1]}}
-
return res
def onchange_invoice_line(self, cr, uid, ids, lines):
})]
return iml
+ def action_date_assign(self, cr, uid, ids, *args):
+ for inv in self.browse(cr, uid, ids):
+ res = self.onchange_payment_term_date_invoice(cr, uid, inv.id, inv.payment_term.id, inv.date_invoice)
+ if res and res['value']:
+ self.write(cr, uid, [inv.id], res['value'])
+ return True
+
def action_move_create(self, cr, uid, ids, *args):
ait_obj = self.pool.get('account.invoice.tax')
cur_obj = self.pool.get('res.currency')
<field name="menu_name"/>
<field name="menu_parent_id"/>
<field name="section_id"/>
+ <label string="this wizard will create all sub-menus, within the selected menu." align="0.0" colspan="4"/>
+ <label string="You may want to create a new parent menu to put all the created menus in." align="0.0" colspan="4"/>
<separator string="Select Views (empty for default)" colspan="4"/>
<field name="view_form"/>
<field name="view_tree"/>
'date_planned': fields.datetime('Scheduled date', required=True),
'date_close': fields.datetime('Date Closed'),
'product_id': fields.many2one('product.product', 'Product', required=True),
- 'product_qty': fields.float('Quantity', required=True),
- 'product_uom': fields.many2one('product.uom', 'Product UoM', required=True),
- 'product_uos_qty': fields.float('UoS Quantity'),
- 'product_uos': fields.many2one('product.uom', 'Product UoS'),
+ 'product_qty': fields.float('Quantity', required=True, states={'draft':[('readonly',False)]}, readonly=True),
+ 'product_uom': fields.many2one('product.uom', 'Product UoM', required=True, states={'draft':[('readonly',False)]}, readonly=True),
+ 'product_uos_qty': fields.float('UoS Quantity', states={'draft':[('readonly',False)]}, readonly=True),
+ 'product_uos': fields.many2one('product.uom', 'Product UoS', states={'draft':[('readonly',False)]}, readonly=True),
'move_id': fields.many2one('stock.move', 'Reservation', ondelete='set null'),
'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
</page>
<page string="Note">
<separator colspan="4" string="Note" />
- <field name="name" colspan="4" />
+ <field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>